pyre-cli 9.5.2 → 10.1.0
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.
- package/README.md +73 -16
- package/dist/alertChannels-TPSQIJ7S.js +8 -0
- package/dist/{blender-7UT5J7IP.js → blender-FGH3ASEQ.js} +2 -2
- package/dist/brewHealth-P2GW5Y5C.js +176 -0
- package/dist/buildCmd-CDPZ2ZFA.js +38 -0
- package/dist/{checkCmd-T7O4KXXA.js → checkCmd-RKW6QGDR.js} +9 -11
- package/dist/{chunk-CXL4GYGQ.js → chunk-53O2RGSL.js} +44 -17
- package/dist/{chunk-3TE7MJLS.js → chunk-6UHZP4QP.js} +36 -10
- package/dist/chunk-GHRDW646.js +2506 -0
- package/dist/{prometheus-LFYHF6VO.js → chunk-HT4VQ4OH.js} +1 -0
- package/dist/chunk-M73HCQD2.js +95 -0
- package/dist/chunk-MZO5QKUR.js +32 -0
- package/dist/{chunk-25I533OF.js → chunk-VIACN2RU.js} +1 -1
- package/dist/chunk-Z2YV5HKV.js +87 -0
- package/dist/chunk-ZLVIVFSO.js +110 -0
- package/dist/{collectors-JB4OGUEF.js → collectors-H43PN4PS.js} +6 -3
- package/dist/{completions-VQMHQCXE.js → completions-JKYEJNGR.js} +34 -1
- package/dist/{config-KS5ZZ3VN.js → config-GYGJXU2Q.js} +9 -1
- package/dist/doctor-GYHFTNZQ.js +387 -0
- package/dist/explainCmd-MF6PIMLW.js +222 -0
- package/dist/extensions-XJGHG7X3.js +134 -0
- package/dist/index.js +460 -88
- package/dist/ioreport.py +72 -0
- package/dist/netUsageCmd-WKBTW2YG.js +90 -0
- package/dist/{pipeCmd-TYLJHQ5B.js → pipeCmd-7REDBLBU.js} +4 -3
- package/dist/profileProcCmd-N4H6MCBT.js +107 -0
- package/dist/prometheus-5BL5PVLC.js +6 -0
- package/dist/prometheusCmd-PL64BLN5.js +93 -0
- package/dist/replayCmd-Z3PYXY7V.js +164 -0
- package/dist/run-HOGQDDTA.js +8 -0
- package/dist/serveCmd-2H5VLF3P.js +153 -0
- package/dist/service-Q74BBILO.js +181 -0
- package/dist/smartCmd-ODWKSFNG.js +166 -0
- package/dist/syncCmd-A2W3QB3S.js +126 -0
- package/dist/topoCmd-DU2HHZNH.js +148 -0
- package/dist/watchdogCmd-UF53JPZB.js +161 -0
- package/dist/{wizard-Z3RGA3VB.js → wizard-TD7BGX6O.js} +1 -1
- package/install.ps1 +29 -0
- package/install.sh +10 -9
- package/package.json +7 -3
- package/src/ai/models.ts +138 -0
- package/src/alertChannels.ts +119 -0
- package/src/brewHealth.ts +157 -40
- package/src/buildCmd.ts +48 -0
- package/src/checkCmd.ts +5 -5
- package/src/completions.ts +35 -0
- package/src/doctor.ts +235 -7
- package/src/easy_features.test.ts +40 -0
- package/src/explainCmd.ts +261 -0
- package/src/extensions.ts +71 -7
- package/src/formatters/render.ts +34 -10
- package/src/formatters/types.ts +2 -0
- package/src/index.ts +251 -36
- package/src/live/input.ts +60 -0
- package/src/live/render.ts +67 -0
- package/src/live/state.ts +5 -0
- package/src/live/types.ts +1 -1
- package/src/monitors/batteryPredictor.ts +143 -0
- package/src/monitors/buildTracker.ts +121 -0
- package/src/monitors/collectors.ts +342 -178
- package/src/monitors/ioreport.py +72 -0
- package/src/monitors/platform/linux.ts +756 -0
- package/src/monitors/platform/windows.ts +519 -0
- package/src/monitors/run.ts +27 -3
- package/src/monitors/smc.ts +21 -1
- package/src/monitors/types.ts +15 -0
- package/src/netUsageCmd.ts +121 -0
- package/src/platform.test.ts +99 -0
- package/src/plugins/index.ts +143 -0
- package/src/profileProcCmd.ts +133 -0
- package/src/prometheusCmd.ts +107 -0
- package/src/replayCmd.ts +186 -0
- package/src/serveCmd.ts +180 -0
- package/src/service.ts +125 -7
- package/src/smartCmd.ts +205 -0
- package/src/state/config.ts +58 -17
- package/src/syncCmd.ts +166 -0
- package/src/topoCmd.ts +176 -0
- package/src/watchdogCmd.ts +198 -0
- package/src/xbar.ts +22 -11
- package/dist/brewHealth-F2BXF5M6.js +0 -74
- package/dist/chunk-FH5WDJBF.js +0 -15
- package/dist/chunk-N4WJVF5M.js +0 -1184
- package/dist/doctor-UV7TWIHX.js +0 -184
- package/dist/extensions-DVA5YLGH.js +0 -74
- package/dist/service-WTS3NBQU.js +0 -73
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import ctypes, ctypes.util, json, time, sys
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
libIOReport = ctypes.cdll.LoadLibrary('/usr/lib/libIOReport.dylib')
|
|
5
|
+
CF = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))
|
|
6
|
+
CFStringRef = ctypes.c_void_p
|
|
7
|
+
CFDictionaryRef = ctypes.c_void_p
|
|
8
|
+
CFArrayRef = ctypes.c_void_p
|
|
9
|
+
CFIndex = ctypes.c_long
|
|
10
|
+
|
|
11
|
+
CF.CFStringCreateWithCString.restype = CFStringRef
|
|
12
|
+
CF.CFStringCreateWithCString.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_uint32]
|
|
13
|
+
CF.CFStringGetCString.restype = ctypes.c_bool
|
|
14
|
+
CF.CFStringGetCString.argtypes = [CFStringRef, ctypes.c_char_p, CFIndex, ctypes.c_uint32]
|
|
15
|
+
CF.CFDictionaryGetValue.restype = ctypes.c_void_p
|
|
16
|
+
CF.CFDictionaryGetValue.argtypes = [CFDictionaryRef, ctypes.c_void_p]
|
|
17
|
+
CF.CFArrayGetCount.restype = CFIndex
|
|
18
|
+
CF.CFArrayGetCount.argtypes = [CFArrayRef]
|
|
19
|
+
CF.CFArrayGetValueAtIndex.restype = ctypes.c_void_p
|
|
20
|
+
CF.CFArrayGetValueAtIndex.argtypes = [CFArrayRef, CFIndex]
|
|
21
|
+
|
|
22
|
+
def cf_str(t):
|
|
23
|
+
return CF.CFStringCreateWithCString(None, t.encode('utf-8'), 0x08000100)
|
|
24
|
+
|
|
25
|
+
def cf_to_str(c):
|
|
26
|
+
if not c: return ''
|
|
27
|
+
b = ctypes.create_string_buffer(128)
|
|
28
|
+
return b.value.decode('utf-8') if CF.CFStringGetCString(c, b, 128, 0x08000100) else ''
|
|
29
|
+
|
|
30
|
+
libIOReport.IOReportCopyChannelsInGroup.restype = CFDictionaryRef
|
|
31
|
+
libIOReport.IOReportCopyChannelsInGroup.argtypes = [CFStringRef, CFStringRef, ctypes.c_uint64, ctypes.c_uint64, ctypes.c_uint64]
|
|
32
|
+
libIOReport.IOReportCreateSubscription.restype = ctypes.c_void_p
|
|
33
|
+
libIOReport.IOReportCreateSubscription.argtypes = [ctypes.c_void_p, CFDictionaryRef, ctypes.POINTER(CFDictionaryRef), ctypes.c_uint64, ctypes.c_void_p]
|
|
34
|
+
libIOReport.IOReportCreateSamples.restype = CFDictionaryRef
|
|
35
|
+
libIOReport.IOReportCreateSamples.argtypes = [ctypes.c_void_p, CFDictionaryRef, ctypes.c_void_p]
|
|
36
|
+
libIOReport.IOReportCreateSamplesDelta.restype = CFDictionaryRef
|
|
37
|
+
libIOReport.IOReportCreateSamplesDelta.argtypes = [CFDictionaryRef, CFDictionaryRef, ctypes.c_void_p]
|
|
38
|
+
libIOReport.IOReportChannelGetChannelName.restype = CFStringRef
|
|
39
|
+
libIOReport.IOReportChannelGetChannelName.argtypes = [CFDictionaryRef]
|
|
40
|
+
libIOReport.IOReportChannelGetUnitLabel.restype = CFStringRef
|
|
41
|
+
libIOReport.IOReportChannelGetUnitLabel.argtypes = [CFDictionaryRef]
|
|
42
|
+
libIOReport.IOReportSimpleGetIntegerValue.restype = ctypes.c_int64
|
|
43
|
+
libIOReport.IOReportSimpleGetIntegerValue.argtypes = [CFDictionaryRef, ctypes.c_int32]
|
|
44
|
+
|
|
45
|
+
ch = libIOReport.IOReportCopyChannelsInGroup(cf_str('Energy Model'), None, 0, 0, 0)
|
|
46
|
+
sub_ch = CFDictionaryRef()
|
|
47
|
+
sub = libIOReport.IOReportCreateSubscription(None, ch, ctypes.byref(sub_ch), 0, None)
|
|
48
|
+
s1 = libIOReport.IOReportCreateSamples(sub, sub_ch, None)
|
|
49
|
+
dt = 0.08
|
|
50
|
+
time.sleep(dt)
|
|
51
|
+
s2 = libIOReport.IOReportCreateSamples(sub, sub_ch, None)
|
|
52
|
+
delta = libIOReport.IOReportCreateSamplesDelta(s1, s2, None)
|
|
53
|
+
arr = CF.CFDictionaryGetValue(delta, cf_str('IOReportChannels'))
|
|
54
|
+
cnt = CF.CFArrayGetCount(arr)
|
|
55
|
+
cpu_w = 0.0
|
|
56
|
+
gpu_w = 0.0
|
|
57
|
+
ane_w = 0.0
|
|
58
|
+
for i in range(cnt):
|
|
59
|
+
item = CF.CFArrayGetValueAtIndex(arr, i)
|
|
60
|
+
n = cf_to_str(libIOReport.IOReportChannelGetChannelName(item))
|
|
61
|
+
if n in ('GPU Energy', 'CPU Energy', 'ANE'):
|
|
62
|
+
u = cf_to_str(libIOReport.IOReportChannelGetUnitLabel(item))
|
|
63
|
+
v = libIOReport.IOReportSimpleGetIntegerValue(item, 0)
|
|
64
|
+
sc = 1e9 if u == 'nJ' else (1e6 if u == 'uJ' else 1e3)
|
|
65
|
+
w = round((v / sc) / dt, 2)
|
|
66
|
+
if n == 'CPU Energy': cpu_w = w
|
|
67
|
+
elif n == 'GPU Energy': gpu_w = w
|
|
68
|
+
elif n == 'ANE': ane_w = w
|
|
69
|
+
combined_w = round(cpu_w + gpu_w + ane_w, 2)
|
|
70
|
+
print(json.dumps({'cpuWatts': cpu_w, 'gpuWatts': gpu_w, 'aneWatts': ane_w, 'combinedWatts': combined_w}))
|
|
71
|
+
except Exception:
|
|
72
|
+
print('{}')
|