pmonitor 1.5.2__py3-none-any.whl → 1.5.4__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/monitor_pids.py CHANGED
@@ -26,6 +26,7 @@ class PidsPerf:
26
26
  minor_cpu_sum = 0
27
27
  minor_real_mem_sum = 0
28
28
  minor_mem_percent_sum = 0
29
+ minor_vss_mem_sum = 0
29
30
  minor_thread_count_sum = 0
30
31
  gpu_memory_usage = 0
31
32
  gpu_memory_total = 0
@@ -45,31 +46,35 @@ class PidsPerf:
45
46
  process_memory = process.memory_info()
46
47
  mem_percent = u'%.2f' % (process.memory_percent()) # 内存利用率
47
48
  real_mem = round(process_memory.rss / 1024 / 1024, 2) # 实际内存
49
+ vss_mem = round(process_memory.vms / 1024 / 1024, 2) # 虚拟内存
48
50
  thread_count = process.num_threads() # 线程总数
49
51
  except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
50
52
  cpu_percent = 0
51
53
  mem_percent = 0
52
54
  real_mem = 0
53
55
  thread_count = 0
56
+ vss_mem = 0
54
57
 
55
58
  # 将性能数据保存到对应PID的数据列表中
56
59
  if process.pid == current_pid: # 主进程数据处理
57
60
  main_cpu = cpu_percent
58
61
  main_real_mem = real_mem
59
62
  main_mem_percent = round(float(mem_percent), 2)
63
+ main_vss_mem = vss_mem
60
64
  main_thread_count = thread_count
61
65
  main_data = {'cpu': main_cpu, 'memory': main_real_mem, 'memory percent': main_mem_percent,
62
- 'thread count': main_thread_count}
66
+ 'thread count': main_thread_count, 'vss memory': main_vss_mem}
63
67
  # print('主进程', pid_name, main_cpu, main_real_mem, main_mem_percent, main_thread_count)
64
68
  else: # 子进程数据处理
65
69
  minor_cpu_sum += cpu_percent
66
70
  minor_real_mem_sum += real_mem
71
+ minor_vss_mem_sum += vss_mem
67
72
  minor_mem_percent_sum += float(mem_percent)
68
73
  minor_thread_count_sum += thread_count
69
74
  # pid_data[process.pid].append((cpu_percent, real_mem, mem_percent, thread_count))
70
75
  minor_data = {'cpu': round(float(minor_cpu_sum), 2), 'memory': round(float(minor_real_mem_sum), 2),
71
76
  'memory percent': round(float(minor_mem_percent_sum), 2),
72
- 'thread count': minor_thread_count_sum}
77
+ 'thread count': minor_thread_count_sum, 'vss memory': minor_vss_mem_sum}
73
78
  # print('其他子进程', pid_name, minor_cpu_sum, minor_real_mem_sum, minor_mem_percent_sum,
74
79
  # minor_thread_count_sum)
75
80
  # 获取磁盘IO
@@ -118,13 +123,14 @@ class PidsPerf:
118
123
  gpu_monitor_dll.GetGPUDataForProcess.argtypes = [ctypes.c_ulong]
119
124
  gpu_monitor_dll.GetGPUDataForProcess.restype = ctypes.c_char_p
120
125
  # 获取GPU物理内存
121
- computer = Computer()
122
- gpu_key = list(computer.gpu.keys())[0]
126
+ # computer = Computer()
127
+ # gpu_key = list(computer.gpu.keys())[0]
123
128
  while True:
124
129
  minor_cpu_sum = 0
125
130
  minor_workSet_mem_sum = 0
126
131
  minor_private_mem_sum = 0
127
132
  minor_mem_percent_sum = 0
133
+ minor_vss_mem_sum = 0
128
134
  minor_thread_count_sum = 0
129
135
  minor_io_read_sum = 0
130
136
  minor_io_write_sum = 0
@@ -151,7 +157,7 @@ class PidsPerf:
151
157
  child_pids.add(p_pid) # app内所有pid
152
158
  child_pids = {pid for pid in child_pids if psutil.pid_exists(pid)} # 移除不存在的进程
153
159
 
154
- small_data = computer.gpu[gpu_key]['SmallData'] # 获取GPU物理内存信息
160
+ # small_data = computer.gpu[gpu_key]['SmallData'] # 获取GPU物理内存信息
155
161
  try:
156
162
  new_pids_cpu_time_pre = {pid: pidWinPerf.get_process_cpu_time(pid) for pid in child_pids if
157
163
  pid not in process_cpu_times_pre}
@@ -170,12 +176,14 @@ class PidsPerf:
170
176
  try:
171
177
  process = psutil.Process(pid)
172
178
  pid_name = process.name()
179
+ mem_vss = round(process.memory_info().vms / 1024 / 1024, 2)
173
180
  mem_percent = round(process.memory_percent(), 2)
174
181
  thread_count = process.num_threads()
175
182
  except (psutil.AccessDenied, psutil.NoSuchProcess, psutil.ZombieProcess):
176
183
  # print('pid is not found')
177
184
  mem_percent = 0
178
185
  thread_count = 0
186
+ mem_vss = 0
179
187
  process_cpu_time_post = pidWinPerf.get_process_cpu_time(pid)
180
188
  memory_info = pidWinPerf.get_process_memory(pid)
181
189
  io_counters = pidWinPerf.get_io_counters(pid)
@@ -210,6 +218,9 @@ class PidsPerf:
210
218
  # 'Committed:', main_gpu_committed_sum, 'GPU Usage:',
211
219
  # main_gpu_percent_sum)
212
220
  main_data = {'cpu': cpu_usage, 'private': private_mem, "workset": workSet_mem,
221
+ "vss memory": mem_vss,
222
+ "mem percent": mem_percent,
223
+ "thread count": thread_count,
213
224
  'gpu_Dedicated': round(float(main_gpu_dedicated_sum), 2),
214
225
  'gpu_System': round(float(main_gpu_system_sum), 2),
215
226
  'gpu_Committed': round(float(main_gpu_committed_sum), 2),
@@ -219,6 +230,7 @@ class PidsPerf:
219
230
  # f'主进程数据:cpu:{cpu_usage},workSet:{workSet_mem},private:{private_mem},mem_percent:{mem_percent},thread_count:{thread_count}')
220
231
  else:
221
232
  minor_cpu_sum += cpu_usage # 子进程总
233
+ minor_vss_mem_sum += mem_vss # 子进程vss内存
222
234
  minor_workSet_mem_sum += workSet_mem # 子进程workSet内存
223
235
  minor_private_mem_sum += private_mem # 子进程private内存
224
236
  minor_mem_percent_sum += mem_percent # 子进程内存使用率
@@ -244,23 +256,24 @@ class PidsPerf:
244
256
  disk_data = {'io read': minor_io_read_sum, 'io write': minor_io_write_sum}
245
257
  other_data = {'cpu': minor_cpu_sum, 'private': round(float(minor_private_mem_sum), 2),
246
258
  'workset': round(float(minor_workSet_mem_sum), 2),
259
+ 'vss memory': minor_vss_mem_sum,
247
260
  'memory percent': round(float(minor_mem_percent_sum), 2),
248
261
  'thread count': minor_thread_count_sum,
249
262
  'gpu_Dedicated': round(minor_gpu_dedicated_sum, 2),
250
263
  'gpu_System': round(minor_gpu_system_sum, 2),
251
264
  'gpu_Committed': round(minor_gpu_committed_sum, 2),
252
265
  'gpu_Usage': round(minor_gpu_percent_sum, 2)}
253
- if 'GPU Memory Used' in small_data:
254
- gpu_data = {'gpu memory usage': round(small_data['GPU Memory Used'], 2),
255
- 'gpu memory total': round(small_data['GPU Memory Total'], 2),
256
- 'gpu memory free': round(small_data['GPU Memory Free'], 2)}
257
- else:
258
- gpu_data = {'gpu memory usage': round(small_data['D3D Shared Memory Used'], 2),
259
- 'gpu memory total': round(small_data['D3D Shared Memory Total'], 2),
260
- 'gpu memory free': round(small_data['D3D Shared Memory Free'], 2)}
266
+ # if 'GPU Memory Used' in small_data:
267
+ # gpu_data = {'gpu memory usage': round(small_data['GPU Memory Used'], 2),
268
+ # 'gpu memory total': round(small_data['GPU Memory Total'], 2),
269
+ # 'gpu memory free': round(small_data['GPU Memory Free'], 2)}
270
+ # else:
271
+ # gpu_data = {'gpu memory usage': round(small_data['D3D Shared Memory Used'], 2),
272
+ # 'gpu memory total': round(small_data['D3D Shared Memory Total'], 2),
273
+ # 'gpu memory free': round(small_data['D3D Shared Memory Free'], 2)}
261
274
  try:
262
275
  data = {'main': main_data, 'other': other_data, 'disk': disk_data,
263
- 'gpu': gpu_data,
276
+ # 'gpu': gpu_data,
264
277
  'memory_total': memory_total,
265
278
  'memory_available': memory_available}
266
279
  json_data = json.dumps(data)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pmonitor
3
- Version: 1.5.2
3
+ Version: 1.5.4
4
4
  Summary: pc monitor
5
5
  Author: cfr
6
6
  Author-email: 1354592998@qq.com
@@ -4,7 +4,7 @@ monitor/get_process_name.py,sha256=HxePo2gdrTo2Ukg4DTnYzUMdczVWywCeLCXQ-RRWyu8,3
4
4
  monitor/mac_gpu.py,sha256=kQDPMW04lIYPBbJw772Jh1OQxj-D4JNmdjJlP6BuR4w,2320
5
5
  monitor/monitor_mac.py,sha256=OoptTTXTZQupzBwgGOfKNjyYAKBxDy-wI3l6T7XVE8s,4651
6
6
  monitor/monitor_mac_vmmap.py,sha256=2ZLhig5ymY6XU7bZGnHM9VIK-d5DAqWOFItIfv7KDPE,3819
7
- monitor/monitor_pids.py,sha256=DftMSexy87lHIiSJoVJDxNQLXcfHpZg4jNwsJRc4hjw,15968
7
+ monitor/monitor_pids.py,sha256=VqgN4puRMDXzNukiHVrZp-gsYKswUiFkuvhPRo56sII,16772
8
8
  monitor/monitor_win.py,sha256=xs5nzqqEPoDmJTegh3lQhVjjpPcOWnruWKK65ttqnTo,6161
9
9
  monitor/run_monitor.py,sha256=HDQXHIx47ZRN4Gp0PTr0yWKVM28n8A7-NaO--_pdgso,1577
10
10
  monitor/sys_info.py,sha256=aNultuRoQuRYPkYo397xAXVDXP07Qx5JOHtYzNmEvuc,3208
@@ -25,8 +25,8 @@ monitor/DLL/sechost.dll,sha256=1mXCrgNDRBiZ2XZk7eTpDm4oPG-x9BW4uYUVkrfvBkk,69986
25
25
  monitor/DLL/ucrtbased.dll,sha256=vtmKFPEHyr2OXkrUOu3Qs1dlbKG1dxZ8ItKCkTTU5S4,2238056
26
26
  monitor/DLL/vcruntime140.dll,sha256=AsaqDm5iRBGp8ZsDYKeGWrFZCOJgJFEOXDipwINiw1o,119888
27
27
  monitor/DLL/vcruntime140_1.dll,sha256=fdmqAuJxxoym1fGNZR0joV1yWXFa9DMmV4993ifzdjc,49640
28
- pmonitor-1.5.2.dist-info/METADATA,sha256=ppCC12Qt8JYHdv7t6_j_UB7LsOlPnsP9ekkzrY1N0xM,427
29
- pmonitor-1.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- pmonitor-1.5.2.dist-info/entry_points.txt,sha256=RiT4cQ3f8vsU3HSGbQrMROCHMi7eOFzdh-k0g7TzoFE,54
31
- pmonitor-1.5.2.dist-info/top_level.txt,sha256=tGkQDkVeyKgP5Rr7acpp0df83NBAnI8up0sGwRxuuQ4,8
32
- pmonitor-1.5.2.dist-info/RECORD,,
28
+ pmonitor-1.5.4.dist-info/METADATA,sha256=u7U43Hm3aPIp6Gxrpx7K8ZBhEFDUH_pODlLr3aBYrzc,427
29
+ pmonitor-1.5.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
30
+ pmonitor-1.5.4.dist-info/entry_points.txt,sha256=RiT4cQ3f8vsU3HSGbQrMROCHMi7eOFzdh-k0g7TzoFE,54
31
+ pmonitor-1.5.4.dist-info/top_level.txt,sha256=tGkQDkVeyKgP5Rr7acpp0df83NBAnI8up0sGwRxuuQ4,8
32
+ pmonitor-1.5.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5