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.
Files changed (86) hide show
  1. package/README.md +73 -16
  2. package/dist/alertChannels-TPSQIJ7S.js +8 -0
  3. package/dist/{blender-7UT5J7IP.js → blender-FGH3ASEQ.js} +2 -2
  4. package/dist/brewHealth-P2GW5Y5C.js +176 -0
  5. package/dist/buildCmd-CDPZ2ZFA.js +38 -0
  6. package/dist/{checkCmd-T7O4KXXA.js → checkCmd-RKW6QGDR.js} +9 -11
  7. package/dist/{chunk-CXL4GYGQ.js → chunk-53O2RGSL.js} +44 -17
  8. package/dist/{chunk-3TE7MJLS.js → chunk-6UHZP4QP.js} +36 -10
  9. package/dist/chunk-GHRDW646.js +2506 -0
  10. package/dist/{prometheus-LFYHF6VO.js → chunk-HT4VQ4OH.js} +1 -0
  11. package/dist/chunk-M73HCQD2.js +95 -0
  12. package/dist/chunk-MZO5QKUR.js +32 -0
  13. package/dist/{chunk-25I533OF.js → chunk-VIACN2RU.js} +1 -1
  14. package/dist/chunk-Z2YV5HKV.js +87 -0
  15. package/dist/chunk-ZLVIVFSO.js +110 -0
  16. package/dist/{collectors-JB4OGUEF.js → collectors-H43PN4PS.js} +6 -3
  17. package/dist/{completions-VQMHQCXE.js → completions-JKYEJNGR.js} +34 -1
  18. package/dist/{config-KS5ZZ3VN.js → config-GYGJXU2Q.js} +9 -1
  19. package/dist/doctor-GYHFTNZQ.js +387 -0
  20. package/dist/explainCmd-MF6PIMLW.js +222 -0
  21. package/dist/extensions-XJGHG7X3.js +134 -0
  22. package/dist/index.js +460 -88
  23. package/dist/ioreport.py +72 -0
  24. package/dist/netUsageCmd-WKBTW2YG.js +90 -0
  25. package/dist/{pipeCmd-TYLJHQ5B.js → pipeCmd-7REDBLBU.js} +4 -3
  26. package/dist/profileProcCmd-N4H6MCBT.js +107 -0
  27. package/dist/prometheus-5BL5PVLC.js +6 -0
  28. package/dist/prometheusCmd-PL64BLN5.js +93 -0
  29. package/dist/replayCmd-Z3PYXY7V.js +164 -0
  30. package/dist/run-HOGQDDTA.js +8 -0
  31. package/dist/serveCmd-2H5VLF3P.js +153 -0
  32. package/dist/service-Q74BBILO.js +181 -0
  33. package/dist/smartCmd-ODWKSFNG.js +166 -0
  34. package/dist/syncCmd-A2W3QB3S.js +126 -0
  35. package/dist/topoCmd-DU2HHZNH.js +148 -0
  36. package/dist/watchdogCmd-UF53JPZB.js +161 -0
  37. package/dist/{wizard-Z3RGA3VB.js → wizard-TD7BGX6O.js} +1 -1
  38. package/install.ps1 +29 -0
  39. package/install.sh +10 -9
  40. package/package.json +7 -3
  41. package/src/ai/models.ts +138 -0
  42. package/src/alertChannels.ts +119 -0
  43. package/src/brewHealth.ts +157 -40
  44. package/src/buildCmd.ts +48 -0
  45. package/src/checkCmd.ts +5 -5
  46. package/src/completions.ts +35 -0
  47. package/src/doctor.ts +235 -7
  48. package/src/easy_features.test.ts +40 -0
  49. package/src/explainCmd.ts +261 -0
  50. package/src/extensions.ts +71 -7
  51. package/src/formatters/render.ts +34 -10
  52. package/src/formatters/types.ts +2 -0
  53. package/src/index.ts +251 -36
  54. package/src/live/input.ts +60 -0
  55. package/src/live/render.ts +67 -0
  56. package/src/live/state.ts +5 -0
  57. package/src/live/types.ts +1 -1
  58. package/src/monitors/batteryPredictor.ts +143 -0
  59. package/src/monitors/buildTracker.ts +121 -0
  60. package/src/monitors/collectors.ts +342 -178
  61. package/src/monitors/ioreport.py +72 -0
  62. package/src/monitors/platform/linux.ts +756 -0
  63. package/src/monitors/platform/windows.ts +519 -0
  64. package/src/monitors/run.ts +27 -3
  65. package/src/monitors/smc.ts +21 -1
  66. package/src/monitors/types.ts +15 -0
  67. package/src/netUsageCmd.ts +121 -0
  68. package/src/platform.test.ts +99 -0
  69. package/src/plugins/index.ts +143 -0
  70. package/src/profileProcCmd.ts +133 -0
  71. package/src/prometheusCmd.ts +107 -0
  72. package/src/replayCmd.ts +186 -0
  73. package/src/serveCmd.ts +180 -0
  74. package/src/service.ts +125 -7
  75. package/src/smartCmd.ts +205 -0
  76. package/src/state/config.ts +58 -17
  77. package/src/syncCmd.ts +166 -0
  78. package/src/topoCmd.ts +176 -0
  79. package/src/watchdogCmd.ts +198 -0
  80. package/src/xbar.ts +22 -11
  81. package/dist/brewHealth-F2BXF5M6.js +0 -74
  82. package/dist/chunk-FH5WDJBF.js +0 -15
  83. package/dist/chunk-N4WJVF5M.js +0 -1184
  84. package/dist/doctor-UV7TWIHX.js +0 -184
  85. package/dist/extensions-DVA5YLGH.js +0 -74
  86. 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('{}')