pmonitor 1.4.0__py3-none-any.whl → 1.4.2__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/mac_gpu.py +48 -47
- monitor/monitor_pids.py +2 -1
- {pmonitor-1.4.0.dist-info → pmonitor-1.4.2.dist-info}/METADATA +1 -1
- {pmonitor-1.4.0.dist-info → pmonitor-1.4.2.dist-info}/RECORD +7 -7
- {pmonitor-1.4.0.dist-info → pmonitor-1.4.2.dist-info}/WHEEL +0 -0
- {pmonitor-1.4.0.dist-info → pmonitor-1.4.2.dist-info}/entry_points.txt +0 -0
- {pmonitor-1.4.0.dist-info → pmonitor-1.4.2.dist-info}/top_level.txt +0 -0
monitor/mac_gpu.py
CHANGED
|
@@ -6,50 +6,51 @@ try:
|
|
|
6
6
|
except:
|
|
7
7
|
pass
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
9
|
+
if platform.system() != 'Windows':
|
|
10
|
+
IOKit = Foundation.NSBundle.bundleWithIdentifier_("com.apple.framework.IOKit")
|
|
11
|
+
|
|
12
|
+
functions = [
|
|
13
|
+
("IOServiceGetMatchingService", b"II@"),
|
|
14
|
+
("IOServiceMatching", b"@*"),
|
|
15
|
+
("IORegistryEntryCreateCFProperties", b"IIo^@@I"),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
objc.loadBundleFunctions(IOKit, globals(), functions)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def accelerator_performance_statistics() -> dict[str, int]:
|
|
22
|
+
accelerator_info = IOServiceGetMatchingService(
|
|
23
|
+
0, IOServiceMatching(b"IOAccelerator")
|
|
24
|
+
)
|
|
25
|
+
if accelerator_info == 0:
|
|
26
|
+
raise RuntimeError("IOAccelerator not found")
|
|
27
|
+
# else...
|
|
28
|
+
err, props = IORegistryEntryCreateCFProperties(accelerator_info, None, None, 0)
|
|
29
|
+
if err != 0:
|
|
30
|
+
raise RuntimeError("IOAccelerator properties not found")
|
|
31
|
+
# else...
|
|
32
|
+
return dict(props)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_gpu_memory():
|
|
36
|
+
try:
|
|
37
|
+
gpu_info = accelerator_performance_statistics()
|
|
38
|
+
use_gpu_memory = 0
|
|
39
|
+
device_usage = 0
|
|
40
|
+
# print(f"gpu_info: {gpu_info['PerformanceStatistics']}")
|
|
41
|
+
for key, value in gpu_info["PerformanceStatistics"].items():
|
|
42
|
+
if key == "In use system memory":
|
|
43
|
+
use_gpu_memory = int(value) / 1024 / 1024
|
|
44
|
+
# print(f"{key}: {value}")
|
|
45
|
+
elif key == "inUseSysMemoryBytes":
|
|
46
|
+
use_gpu_memory = int(value) / 1024 / 1024
|
|
47
|
+
# print(f"{key}: {value}")
|
|
48
|
+
elif key == "Device Utilization %":
|
|
49
|
+
device_usage = int(value)
|
|
50
|
+
# print('device usage', device_usage)
|
|
51
|
+
# use_gpu_memory = gpu_info["PerformanceStatistics"]["In use system memory"]
|
|
52
|
+
# total_gpu_memory = gpu_info["PerformanceStatistics"]["Alloc system memory"]
|
|
53
|
+
except Exception as e:
|
|
54
|
+
print(f"Mac端在arm64平台通过接口获取Gpu Memory失败:{e}")
|
|
55
|
+
use_gpu_memory = 0
|
|
56
|
+
return use_gpu_memory, device_usage
|
monitor/monitor_pids.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
monitor/WinPidUtil.py,sha256=0vu2cqcQRrBTb5t_9HOmUoOfbe9KRrI-cyDlJX9bcrw,8753
|
|
2
2
|
monitor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
monitor/get_process_name.py,sha256=HxePo2gdrTo2Ukg4DTnYzUMdczVWywCeLCXQ-RRWyu8,3913
|
|
4
|
-
monitor/mac_gpu.py,sha256=
|
|
4
|
+
monitor/mac_gpu.py,sha256=dM0KtLKos5ZIV0JV7vtNQMV3QvB4L05KBH1y9nryk-Q,2089
|
|
5
5
|
monitor/monitor_mac.py,sha256=OoptTTXTZQupzBwgGOfKNjyYAKBxDy-wI3l6T7XVE8s,4651
|
|
6
|
-
monitor/monitor_pids.py,sha256=
|
|
6
|
+
monitor/monitor_pids.py,sha256=6Y75WJUHQgLbNEuKUfviu46JHDFANtHggqvdAJVykrg,14608
|
|
7
7
|
monitor/monitor_win.py,sha256=xs5nzqqEPoDmJTegh3lQhVjjpPcOWnruWKK65ttqnTo,6161
|
|
8
8
|
monitor/run_monitor.py,sha256=JKjb0X2tjPECFg_k7oby7Yg5Xhs8UNmbjCBP_6oXqMk,1579
|
|
9
9
|
monitor/sys_info.py,sha256=aNultuRoQuRYPkYo397xAXVDXP07Qx5JOHtYzNmEvuc,3208
|
|
@@ -24,8 +24,8 @@ monitor/DLL/ucrtbased.dll,sha256=vtmKFPEHyr2OXkrUOu3Qs1dlbKG1dxZ8ItKCkTTU5S4,223
|
|
|
24
24
|
monitor/DLL/vcruntime140.dll,sha256=AsaqDm5iRBGp8ZsDYKeGWrFZCOJgJFEOXDipwINiw1o,119888
|
|
25
25
|
monitor/DLL/vcruntime140_1.dll,sha256=fdmqAuJxxoym1fGNZR0joV1yWXFa9DMmV4993ifzdjc,49640
|
|
26
26
|
monitor/exec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
-
pmonitor-1.4.
|
|
28
|
-
pmonitor-1.4.
|
|
29
|
-
pmonitor-1.4.
|
|
30
|
-
pmonitor-1.4.
|
|
31
|
-
pmonitor-1.4.
|
|
27
|
+
pmonitor-1.4.2.dist-info/METADATA,sha256=01Bx2eDmkJ5cP9cILiaN0LuuleEKTg6JhoDYovXMbx4,215
|
|
28
|
+
pmonitor-1.4.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
pmonitor-1.4.2.dist-info/entry_points.txt,sha256=vmlLEANgf2fZar9BeXYiKdF6GMJbVXip-SIZx5yPXDo,55
|
|
30
|
+
pmonitor-1.4.2.dist-info/top_level.txt,sha256=tGkQDkVeyKgP5Rr7acpp0df83NBAnI8up0sGwRxuuQ4,8
|
|
31
|
+
pmonitor-1.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|