pmonitor 1.4.8__py3-none-any.whl → 1.4.9__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 +17 -7
- {pmonitor-1.4.8.dist-info → pmonitor-1.4.9.dist-info}/METADATA +1 -1
- {pmonitor-1.4.8.dist-info → pmonitor-1.4.9.dist-info}/RECORD +6 -6
- {pmonitor-1.4.8.dist-info → pmonitor-1.4.9.dist-info}/WHEEL +0 -0
- {pmonitor-1.4.8.dist-info → pmonitor-1.4.9.dist-info}/entry_points.txt +0 -0
- {pmonitor-1.4.8.dist-info → pmonitor-1.4.9.dist-info}/top_level.txt +0 -0
monitor/monitor_pids.py
CHANGED
|
@@ -25,6 +25,7 @@ class PidsPerf:
|
|
|
25
25
|
async def get_mac_perf(self):
|
|
26
26
|
current_pid = self.processUtil.find_main_process_pid(self.process_name)
|
|
27
27
|
vm = VmMapMemory()
|
|
28
|
+
next_time = time.time() # 初始化下一次执行的时间点
|
|
28
29
|
while True:
|
|
29
30
|
start_time = time.time() # 记录循环开始时间
|
|
30
31
|
minor_cpu_sum = 0
|
|
@@ -80,7 +81,7 @@ class PidsPerf:
|
|
|
80
81
|
# minor_thread_count_sum)
|
|
81
82
|
# 获取磁盘IO
|
|
82
83
|
io_read_bytes_start, io_write_bytes_start = self.get_disk_usage()
|
|
83
|
-
time.sleep(0.1)
|
|
84
|
+
time.sleep(0.1)
|
|
84
85
|
io_read_bytes_end, io_write_bytes_end = self.get_disk_usage() # io read/write
|
|
85
86
|
io_read_bytes = io_read_bytes_end - io_read_bytes_start # io read/byte
|
|
86
87
|
io_write_bytes = io_write_bytes_end - io_write_bytes_start # io write/byte
|
|
@@ -91,9 +92,13 @@ class PidsPerf:
|
|
|
91
92
|
"memory_total": mem_total, "memory_available": mem_available}
|
|
92
93
|
json_data = json.dumps(data)
|
|
93
94
|
print(json_data)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
# 精确控制间隔
|
|
96
|
+
next_time += self.interval
|
|
97
|
+
sleep_time = next_time - time.time()
|
|
98
|
+
if sleep_time > 0:
|
|
99
|
+
await asyncio.sleep(sleep_time)
|
|
100
|
+
else:
|
|
101
|
+
next_time = time.time() # 如果超时,重置时间点
|
|
97
102
|
sys.stdout.flush()
|
|
98
103
|
|
|
99
104
|
def get_disk_usage(self):
|
|
@@ -129,6 +134,7 @@ class PidsPerf:
|
|
|
129
134
|
# 获取GPU物理内存
|
|
130
135
|
computer = Computer()
|
|
131
136
|
gpu_key = list(computer.gpu.keys())[0]
|
|
137
|
+
next_time = time.time() # 初始化下一次执行的时间点
|
|
132
138
|
while True:
|
|
133
139
|
minor_cpu_sum = 0
|
|
134
140
|
minor_workSet_mem_sum = 0
|
|
@@ -280,9 +286,13 @@ class PidsPerf:
|
|
|
280
286
|
sys.stdout.flush()
|
|
281
287
|
# 更新系统时间
|
|
282
288
|
system_time_pre = system_time_post
|
|
283
|
-
#
|
|
284
|
-
|
|
285
|
-
|
|
289
|
+
# 精确控制间隔
|
|
290
|
+
next_time += self.interval
|
|
291
|
+
sleep_time = next_time - time.time()
|
|
292
|
+
if sleep_time > 0:
|
|
293
|
+
time.sleep(sleep_time)
|
|
294
|
+
else:
|
|
295
|
+
next_time = time.time() # 如果超时,重置时间点v
|
|
286
296
|
|
|
287
297
|
async def start_perf(self):
|
|
288
298
|
if platform.system() == 'Windows':
|
|
@@ -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=Lu1AAw6auuZzuNZtASOaNBpRPOOgyzGr1jYSTErmRmo,1971
|
|
7
|
-
monitor/monitor_pids.py,sha256=
|
|
7
|
+
monitor/monitor_pids.py,sha256=Q0YDPguEhuegQF6PNk7_xm_DK3e_02FNPfhj31UFS8o,16915
|
|
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
|
|
@@ -24,8 +24,8 @@ monitor/DLL/sechost.dll,sha256=1mXCrgNDRBiZ2XZk7eTpDm4oPG-x9BW4uYUVkrfvBkk,69986
|
|
|
24
24
|
monitor/DLL/ucrtbased.dll,sha256=vtmKFPEHyr2OXkrUOu3Qs1dlbKG1dxZ8ItKCkTTU5S4,2238056
|
|
25
25
|
monitor/DLL/vcruntime140.dll,sha256=AsaqDm5iRBGp8ZsDYKeGWrFZCOJgJFEOXDipwINiw1o,119888
|
|
26
26
|
monitor/DLL/vcruntime140_1.dll,sha256=fdmqAuJxxoym1fGNZR0joV1yWXFa9DMmV4993ifzdjc,49640
|
|
27
|
-
pmonitor-1.4.
|
|
28
|
-
pmonitor-1.4.
|
|
29
|
-
pmonitor-1.4.
|
|
30
|
-
pmonitor-1.4.
|
|
31
|
-
pmonitor-1.4.
|
|
27
|
+
pmonitor-1.4.9.dist-info/METADATA,sha256=S_4kV_H2DEDAC-by_50e6NwsHyJkM77D7Ga-sfrOWUE,291
|
|
28
|
+
pmonitor-1.4.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
pmonitor-1.4.9.dist-info/entry_points.txt,sha256=vmlLEANgf2fZar9BeXYiKdF6GMJbVXip-SIZx5yPXDo,55
|
|
30
|
+
pmonitor-1.4.9.dist-info/top_level.txt,sha256=tGkQDkVeyKgP5Rr7acpp0df83NBAnI8up0sGwRxuuQ4,8
|
|
31
|
+
pmonitor-1.4.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|