pmonitor 1.2.1__py3-none-any.whl → 1.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- monitor/DLL/GpuMonitorLib.dll +0 -0
- monitor/exec/GpuMonitor +0 -0
- monitor/monitor_pids.py +52 -44
- monitor/run_monitor.py +1 -1
- {pmonitor-1.2.1.dist-info → pmonitor-1.2.3.dist-info}/METADATA +1 -1
- {pmonitor-1.2.1.dist-info → pmonitor-1.2.3.dist-info}/RECORD +9 -9
- {pmonitor-1.2.1.dist-info → pmonitor-1.2.3.dist-info}/WHEEL +0 -0
- {pmonitor-1.2.1.dist-info → pmonitor-1.2.3.dist-info}/entry_points.txt +0 -0
- {pmonitor-1.2.1.dist-info → pmonitor-1.2.3.dist-info}/top_level.txt +0 -0
monitor/DLL/GpuMonitorLib.dll
CHANGED
|
Binary file
|
monitor/exec/GpuMonitor
CHANGED
|
Binary file
|
monitor/monitor_pids.py
CHANGED
|
@@ -128,9 +128,9 @@ class PidsPerf:
|
|
|
128
128
|
process_io_counters_pre = {pid: pidWinPerf.get_io_counters(pid) for pid in child_pids}
|
|
129
129
|
|
|
130
130
|
dll_path = os.path.join(os.path.dirname(__file__), 'DLL', 'GpuMonitorLib.dll')
|
|
131
|
-
gpu_monitor_dll = CDLL(dll_path)
|
|
132
|
-
gpu_monitor_dll.
|
|
133
|
-
gpu_monitor_dll.
|
|
131
|
+
gpu_monitor_dll = ctypes.CDLL(dll_path)
|
|
132
|
+
gpu_monitor_dll.GetGPUDataForProcess.argtypes = [ctypes.c_ulong]
|
|
133
|
+
gpu_monitor_dll.GetGPUDataForProcess.restype = ctypes.c_char_p
|
|
134
134
|
while True:
|
|
135
135
|
minor_cpu_sum = 0
|
|
136
136
|
minor_workSet_mem_sum = 0
|
|
@@ -143,6 +143,10 @@ class PidsPerf:
|
|
|
143
143
|
minor_gpu_system_sum = 0 # (共享内存)
|
|
144
144
|
minor_gpu_committed_sum = 0 # (总使用内存)
|
|
145
145
|
minor_gpu_percent_sum = 0 # (GPU内存占比)
|
|
146
|
+
main_gpu_dedicated_sum = 0 # (专用内存)
|
|
147
|
+
main_gpu_system_sum = 0 # (共享内存)
|
|
148
|
+
main_gpu_committed_sum = 0 # (总使用内存)
|
|
149
|
+
main_gpu_percent_sum = 0 # (GPU内存占比)
|
|
146
150
|
|
|
147
151
|
current_pids = self.processUtil.get_children_pids(p_pid) # 获取所有子进程
|
|
148
152
|
current_pids.add(p_pid) # 将主进程及子进程添加到list中
|
|
@@ -186,7 +190,7 @@ class PidsPerf:
|
|
|
186
190
|
pid].ReadTransferCount) / self.interval
|
|
187
191
|
write_bytes_sec = (io_counters.WriteTransferCount - process_io_counters_pre[
|
|
188
192
|
pid].WriteTransferCount) / self.interval
|
|
189
|
-
gpu_info_json = gpu_monitor_dll.
|
|
193
|
+
gpu_info_json = gpu_monitor_dll.GetGPUDataForProcess(pid).decode()
|
|
190
194
|
gpu_info = json.loads(gpu_info_json)
|
|
191
195
|
if process_cpu_time_post:
|
|
192
196
|
# 计算CPU使用率
|
|
@@ -197,28 +201,30 @@ class PidsPerf:
|
|
|
197
201
|
workSet_mem = round(memory_info.WorkingSetSize / 1024 / 1024, 2) # MB
|
|
198
202
|
private_mem = round(memory_info.PrivateUsage / 1024 / 1024, 2) # MB
|
|
199
203
|
if pid == p_pid:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
204
|
+
|
|
205
|
+
for item in gpu_info:
|
|
206
|
+
if item['ProcessID'] == p_pid:
|
|
207
|
+
if item['GPUUtilizationPercent'] < 0:
|
|
208
|
+
print('主进程pid:', item['ProcessID'], 'Dedicated:', 0,
|
|
209
|
+
'System:', 0,
|
|
210
|
+
'Committed:', 0, 'GPU Usage:',
|
|
211
|
+
0)
|
|
212
|
+
main_gpu_dedicated_sum += 0
|
|
213
|
+
main_gpu_system_sum += 0
|
|
214
|
+
main_gpu_committed_sum += 0
|
|
215
|
+
else:
|
|
216
|
+
print('主进程pid:', item['ProcessID'], 'Dedicated:',
|
|
217
|
+
item['GPUProcessMemoryLocalUsage'],
|
|
218
|
+
'System:', item['GPUProcessMemorySharedUsage'],
|
|
219
|
+
'Committed:', item['GPUProcessMemoryTotalCommitted'], 'GPU Usage:',
|
|
220
|
+
item['GPUUtilizationPercent'])
|
|
221
|
+
main_gpu_dedicated_sum += item['GPUProcessMemoryDedicatedUsage'] # (专用内存)
|
|
222
|
+
main_gpu_system_sum += item['GPUProcessMemorySharedUsage'] # (共享内存)
|
|
223
|
+
main_gpu_committed_sum += item['GPUProcessMemoryTotalCommitted'] # (总使用内存)
|
|
224
|
+
main_gpu_percent_sum += item['GPUUtilizationPercent'] # (GPU内存占比)
|
|
219
225
|
main_data = {'cpu': cpu_usage, 'private': private_mem, "workset": workSet_mem,
|
|
220
|
-
'gpu_Dedicated': round(
|
|
221
|
-
'gpu_Committed': round(
|
|
226
|
+
'gpu_Dedicated': round(main_gpu_dedicated_sum, 2), 'gpu_System': round(main_gpu_system_sum, 2),
|
|
227
|
+
'gpu_Committed': round(main_gpu_committed_sum, 2), 'gpu_Usage': round(main_gpu_percent_sum, 2)}
|
|
222
228
|
|
|
223
229
|
# print(
|
|
224
230
|
# f'主进程数据:cpu:{cpu_usage},workSet:{workSet_mem},private:{private_mem},mem_percent:{mem_percent},thread_count:{thread_count}')
|
|
@@ -228,25 +234,27 @@ class PidsPerf:
|
|
|
228
234
|
minor_private_mem_sum += private_mem # 子进程private内存
|
|
229
235
|
minor_mem_percent_sum += mem_percent # 子进程内存使用率
|
|
230
236
|
minor_thread_count_sum += thread_count # 子进程线程总数
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
237
|
+
for item in gpu_info:
|
|
238
|
+
if item['ProcessID'] != p_pid:
|
|
239
|
+
if item['GPUUtilizationPercent'] < 0:
|
|
240
|
+
print('子进程pid:', item['ProcessID'], 'Dedicated:', 0,
|
|
241
|
+
'System:', 0,
|
|
242
|
+
'Committed:', 0, 'GPU Usage:',
|
|
243
|
+
0)
|
|
244
|
+
minor_gpu_dedicated_sum += 0
|
|
245
|
+
minor_gpu_system_sum += 0
|
|
246
|
+
minor_gpu_committed_sum += 0
|
|
247
|
+
minor_gpu_percent_sum += 0
|
|
248
|
+
else:
|
|
249
|
+
print('子进程pid:', item['ProcessID'], 'Dedicated:',
|
|
250
|
+
item['GPUProcessMemoryLocalUsage'],
|
|
251
|
+
'System:', item['GPUProcessMemorySharedUsage'],
|
|
252
|
+
'Committed:', item['GPUProcessMemoryTotalCommitted'], 'GPU Usage:',
|
|
253
|
+
item['GPUUtilizationPercent'])
|
|
254
|
+
minor_gpu_dedicated_sum += item['GPUProcessMemoryLocalUsage']
|
|
255
|
+
minor_gpu_system_sum += item['GPUProcessMemorySharedUsage']
|
|
256
|
+
minor_gpu_committed_sum += item['GPUProcessMemoryTotalCommitted']
|
|
257
|
+
minor_gpu_percent_sum += item['GPUUtilizationPercent']
|
|
250
258
|
minor_io_read_sum += read_bytes_sec # 所有进程IO读取速率总数
|
|
251
259
|
minor_io_write_sum += write_bytes_sec # 所有进程IO写入速率总数
|
|
252
260
|
|
monitor/run_monitor.py
CHANGED
|
@@ -2,11 +2,11 @@ monitor/WinPidUtil.py,sha256=NGkit8UoDAW7dz1vrwsb50QFroO-0hZ44fd_fykJ3WM,8523
|
|
|
2
2
|
monitor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
monitor/get_process_name.py,sha256=eUElEd6chW-gw416o3VZg3UZPi8ZCG9rcw8ayrpVcz4,3620
|
|
4
4
|
monitor/monitor_mac.py,sha256=OoptTTXTZQupzBwgGOfKNjyYAKBxDy-wI3l6T7XVE8s,4651
|
|
5
|
-
monitor/monitor_pids.py,sha256=
|
|
5
|
+
monitor/monitor_pids.py,sha256=mSgmp4ksgvtcsVKPdkstI20rxrVDLSMYD8qUbC1IUig,16418
|
|
6
6
|
monitor/monitor_win.py,sha256=xs5nzqqEPoDmJTegh3lQhVjjpPcOWnruWKK65ttqnTo,6161
|
|
7
|
-
monitor/run_monitor.py,sha256=
|
|
7
|
+
monitor/run_monitor.py,sha256=2RcL-HbvMu_tHRJ7H5-6MxzNtotaktLKm0xCIYHZJZY,1577
|
|
8
8
|
monitor/sys_info.py,sha256=aNultuRoQuRYPkYo397xAXVDXP07Qx5JOHtYzNmEvuc,3208
|
|
9
|
-
monitor/DLL/GpuMonitorLib.dll,sha256=
|
|
9
|
+
monitor/DLL/GpuMonitorLib.dll,sha256=xbH4eyDvnv2g6go1fvUt6qQd7qA9n6piP8My4XubLPQ,66560
|
|
10
10
|
monitor/DLL/KernelBase.dll,sha256=MSJ2WSh-2Lk6yFVLX_a8G2EnNuaOtJGpfg-Vw9HY_go,3860744
|
|
11
11
|
monitor/DLL/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
monitor/DLL/advapi32.dll,sha256=vJ0GuBFvanFrmj45Sp4N3W80qGdmJYy0VBdleZPSA2A,737040
|
|
@@ -22,10 +22,10 @@ monitor/DLL/sechost.dll,sha256=1mXCrgNDRBiZ2XZk7eTpDm4oPG-x9BW4uYUVkrfvBkk,69986
|
|
|
22
22
|
monitor/DLL/ucrtbased.dll,sha256=vtmKFPEHyr2OXkrUOu3Qs1dlbKG1dxZ8ItKCkTTU5S4,2238056
|
|
23
23
|
monitor/DLL/vcruntime140.dll,sha256=AsaqDm5iRBGp8ZsDYKeGWrFZCOJgJFEOXDipwINiw1o,119888
|
|
24
24
|
monitor/DLL/vcruntime140_1.dll,sha256=fdmqAuJxxoym1fGNZR0joV1yWXFa9DMmV4993ifzdjc,49640
|
|
25
|
-
monitor/exec/GpuMonitor,sha256=
|
|
25
|
+
monitor/exec/GpuMonitor,sha256=5QBCxkxnaqZcfziHQRIEhKzlfzTqDHTnEOf6D_b4x2g,111568
|
|
26
26
|
monitor/exec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
-
pmonitor-1.2.
|
|
28
|
-
pmonitor-1.2.
|
|
29
|
-
pmonitor-1.2.
|
|
30
|
-
pmonitor-1.2.
|
|
31
|
-
pmonitor-1.2.
|
|
27
|
+
pmonitor-1.2.3.dist-info/METADATA,sha256=Z9jy3irDZl_5MzoFUlEnTKVaPw167tD3fu9xeyUghBY,215
|
|
28
|
+
pmonitor-1.2.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
pmonitor-1.2.3.dist-info/entry_points.txt,sha256=vmlLEANgf2fZar9BeXYiKdF6GMJbVXip-SIZx5yPXDo,55
|
|
30
|
+
pmonitor-1.2.3.dist-info/top_level.txt,sha256=tGkQDkVeyKgP5Rr7acpp0df83NBAnI8up0sGwRxuuQ4,8
|
|
31
|
+
pmonitor-1.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|