macpm 2.1__tar.gz → 3.0__tar.gz

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. macpm-3.0/CHANGELOG.md +229 -0
  2. {macpm-2.1 → macpm-3.0}/MANIFEST.in +1 -0
  3. macpm-3.0/PKG-INFO +600 -0
  4. macpm-3.0/README.md +558 -0
  5. {macpm-2.1 → macpm-3.0}/RELEASE.md +14 -12
  6. macpm-3.0/docs/linux-port.md +241 -0
  7. {macpm-2.1 → macpm-3.0}/macpm/__init__.py +1 -1
  8. macpm-3.0/macpm/backend.py +145 -0
  9. macpm-3.0/macpm/capabilities.py +62 -0
  10. macpm-3.0/macpm/dump.py +81 -0
  11. macpm-3.0/macpm/gpuview.py +796 -0
  12. macpm-3.0/macpm/linux_backend/__init__.py +37 -0
  13. macpm-3.0/macpm/linux_backend/cpu.py +321 -0
  14. macpm-3.0/macpm/linux_backend/gpu.py +1411 -0
  15. macpm-3.0/macpm/linux_backend/modelname.py +145 -0
  16. macpm-3.0/macpm/linux_backend/net.py +319 -0
  17. macpm-3.0/macpm/linux_backend/power.py +195 -0
  18. macpm-3.0/macpm/linux_backend/proc.py +145 -0
  19. macpm-3.0/macpm/linux_backend/sampler.py +289 -0
  20. macpm-3.0/macpm/linux_backend/soc.py +113 -0
  21. macpm-3.0/macpm/linux_backend/sysfs.py +124 -0
  22. macpm-3.0/macpm/linux_backend/thermal.py +212 -0
  23. macpm-3.0/macpm/macos_gpu.py +184 -0
  24. {macpm-2.1 → macpm-3.0}/macpm/macpm.py +608 -329
  25. macpm-3.0/macpm/metrics.py +103 -0
  26. macpm-3.0/macpm/netinfo.py +401 -0
  27. macpm-3.0/macpm/netmodel.py +110 -0
  28. macpm-3.0/macpm/network.py +653 -0
  29. macpm-3.0/macpm/probe.py +409 -0
  30. {macpm-2.1 → macpm-3.0}/macpm/processes.py +59 -226
  31. {macpm-2.1 → macpm-3.0}/macpm/sampler.py +28 -81
  32. macpm-3.0/macpm/sensors.py +206 -0
  33. {macpm-2.1 → macpm-3.0}/macpm/smc.py +38 -23
  34. macpm-3.0/macpm/tui.py +91 -0
  35. macpm-3.0/macpm.egg-info/PKG-INFO +600 -0
  36. macpm-3.0/macpm.egg-info/SOURCES.txt +77 -0
  37. {macpm-2.1 → macpm-3.0}/packaging/README.txt +1 -1
  38. {macpm-2.1 → macpm-3.0}/packaging/build.sh +2 -2
  39. macpm-3.0/packaging/linux/Dockerfile +32 -0
  40. macpm-3.0/packaging/linux/README.txt +50 -0
  41. {macpm-2.1 → macpm-3.0}/setup.py +4 -3
  42. macpm-3.0/tests/linux_fixtures.py +258 -0
  43. {macpm-2.1 → macpm-3.0}/tests/test_cli.py +2 -1
  44. macpm-3.0/tests/test_gpuview.py +391 -0
  45. {macpm-2.1 → macpm-3.0}/tests/test_layout.py +79 -1
  46. macpm-3.0/tests/test_linux_cpu.py +130 -0
  47. macpm-3.0/tests/test_linux_gpu.py +284 -0
  48. macpm-3.0/tests/test_linux_ixsmi.py +334 -0
  49. macpm-3.0/tests/test_linux_modelname.py +113 -0
  50. macpm-3.0/tests/test_linux_net.py +149 -0
  51. macpm-3.0/tests/test_linux_nvidia.py +155 -0
  52. macpm-3.0/tests/test_linux_power.py +132 -0
  53. macpm-3.0/tests/test_linux_sampler.py +327 -0
  54. macpm-3.0/tests/test_linux_thermal.py +108 -0
  55. macpm-3.0/tests/test_linux_view.py +285 -0
  56. macpm-3.0/tests/test_linux_wiring.py +114 -0
  57. macpm-3.0/tests/test_netinfo.py +295 -0
  58. macpm-3.0/tests/test_network.py +495 -0
  59. macpm-3.0/tests/test_probe.py +66 -0
  60. macpm-3.0/tests/test_sampler_macos.py +80 -0
  61. {macpm-2.1 → macpm-3.0}/tests/test_sensors.py +22 -25
  62. macpm-2.1/CHANGELOG.md +0 -79
  63. macpm-2.1/PKG-INFO +0 -286
  64. macpm-2.1/README.md +0 -245
  65. macpm-2.1/macpm/dump.py +0 -21
  66. macpm-2.1/macpm/sensors.py +0 -128
  67. macpm-2.1/macpm.egg-info/PKG-INFO +0 -286
  68. macpm-2.1/macpm.egg-info/SOURCES.txt +0 -36
  69. {macpm-2.1 → macpm-3.0}/LICENSE +0 -0
  70. {macpm-2.1 → macpm-3.0}/macpm/__main__.py +0 -0
  71. {macpm-2.1 → macpm-3.0}/macpm/ioreport.py +0 -0
  72. {macpm-2.1 → macpm-3.0}/macpm/soc.py +0 -0
  73. {macpm-2.1 → macpm-3.0}/macpm.egg-info/dependency_links.txt +0 -0
  74. {macpm-2.1 → macpm-3.0}/macpm.egg-info/entry_points.txt +0 -0
  75. {macpm-2.1 → macpm-3.0}/macpm.egg-info/not-zip-safe +0 -0
  76. {macpm-2.1 → macpm-3.0}/macpm.egg-info/requires.txt +0 -0
  77. {macpm-2.1 → macpm-3.0}/macpm.egg-info/top_level.txt +0 -0
  78. {macpm-2.1 → macpm-3.0}/packaging/entry_tui.py +0 -0
  79. {macpm-2.1 → macpm-3.0}/packaging/install.sh +0 -0
  80. {macpm-2.1 → macpm-3.0}/packaging/macpm.command +0 -0
  81. {macpm-2.1 → macpm-3.0}/pyproject.toml +0 -0
  82. {macpm-2.1 → macpm-3.0}/setup.cfg +0 -0
  83. {macpm-2.1 → macpm-3.0}/tests/__init__.py +0 -0
  84. {macpm-2.1 → macpm-3.0}/tests/test_calc_freq.py +0 -0
  85. {macpm-2.1 → macpm-3.0}/tests/test_processes.py +0 -0
  86. {macpm-2.1 → macpm-3.0}/tests/test_sampler.py +0 -0
macpm-3.0/CHANGELOG.md ADDED
@@ -0,0 +1,229 @@
1
+ # Changelog
2
+
3
+ ## 3.0 — 2026-11-14
4
+
5
+ The Linux release. The same package and the same TUI now run on x86_64 and
6
+ arm64 Linux, and the GPU view grew into a per-card monitor that scales from one
7
+ Apple GPU to a 64-card accelerator server. Verified on 16× Iluvatar BI-V150S,
8
+ 64× Denglin KS58, 8× Techo TECO_AICARD_01 and 8× RTX 4090.
9
+
10
+ ### Added
11
+
12
+ - **Linux backend** (`macpm/backend.py`, `macpm/linux_backend/`): the platform
13
+ is chosen at runtime, and every reading is normalised into the powermetrics
14
+ shaped sample the UI already understood, so all four views and key bindings
15
+ are unchanged.
16
+ - CPU: per-core utilisation from `/proc/stat`, frequency from
17
+ `cpufreq/scaling_cur_freq` (residency-weighted when
18
+ `cpu/stats/time_in_state` exists), and an E/P split inferred from
19
+ `topology/core_type`, `cpu_capacity` or `cpuinfo_max_freq`.
20
+ - Power: RAPL `energy_uj` (root on kernels >= 5.10), GPU hwmon power and the
21
+ battery's `power_now` as a whole-system fallback.
22
+ - GPU: amdgpu (`gpu_busy_percent`, `pp_dpm_sclk`, hwmon), Intel i915/xe
23
+ (frequency plus aggregate DRM `fdinfo` engine time) and NVIDIA via
24
+ `nvidia-smi`.
25
+ - Thermals: hwmon temperatures/fans classified by chip name and label, plus
26
+ a PSI/x86-throttle approximation of the thermal state.
27
+ - Process view: per-process GPU time from `drm-engine-*` `fdinfo`; Linux lets
28
+ `psutil` read every user's CPU/memory as root.
29
+ - Network view: `/proc/net/{tcp,tcp6,udp,udp6}` for counts and listeners and
30
+ `ss -tanie` `tcp_info` joined by inode for the per-process traffic table
31
+ (TCP only).
32
+ - Capabilities say what the kernel and permission level actually expose;
33
+ everything else is shown as `n/a` instead of a fake zero, and the UI hides
34
+ panels it cannot fill.
35
+ - **GPU view** on key `5` — one table with **two lines per card**: the metrics
36
+ line (utilisation bar, clock, power, a 10-cell VRAM bar, temperature) and the
37
+ processes on that card (`PID NAME [cards] GPU% MEM`), with the served model
38
+ name right-aligned. A process holding several cards appears under each of
39
+ them with its range in brackets; a card with more processes than fit shows
40
+ `… +N`. `s` cycles the in-card order (PID → NAME → MEM), `↑` / `↓` turn
41
+ whole pages and the footer shows `Page N/M`. A single-GPU machine keeps the
42
+ card summary and the separate process table.
43
+ - **GPU INFO box** above the table: vendor card name, device count, card count
44
+ and dies per card (devices ÷ unique serials), driver, CUDA, PCIe link
45
+ (maximum, so idle cards do not read as generation 1) and VBIOS — each hidden
46
+ when the tool does not report it. Consumer cards that report `[N/A]` serials
47
+ leave the card/die counts out instead of guessing.
48
+ - **Vendor accelerator backends** — cards with no DRM counters are read through
49
+ the vendor's NVML-style CLI: `ixsmi` (Iluvatar / 天数, `--query-gpu`),
50
+ `dlsmi` (Denglin / 登临, `--query-gpu`) and `teco-smi` (Techo / 太初,
51
+ `--query-device`). Each tool's switch and property names are mapped onto the
52
+ same fields, the power property is negotiated per tool, and the binaries are
53
+ found on `PATH`, in their install directories or via `MACPM_IXSMI`,
54
+ `MACPM_DLSMI` and `MACPM_TECO`.
55
+ - **Vendor compute processes** feed the GPU view: `ixsmi pmon` joined with
56
+ `--query-compute-apps` (memory), `dlsmi --query-compute-apps` and
57
+ `teco-smi pmon`. One row per PID with the cards it holds (compressed to
58
+ `0-7`), its card memory and the vendor's GPU% where the tool reports one
59
+ (`—` otherwise, e.g. `dlsmi`). Processes that hold several cards are listed
60
+ under each of them, and `teco-smi`'s per-device repetition is preserved
61
+ rather than pretending a process lives on one card.
62
+ - **Served model name** on the process line, right-aligned: resolved from the
63
+ launcher's command line (`--served-model-name`, `--model`, `--model-path`,
64
+ `--model-id`, `vllm serve`, `sglang.launch_server`, TGI, llama.cpp, including
65
+ k8s `bash -c` wrappers) by walking the parent chain, cached for ten seconds.
66
+ Only procfs is read; model directories are never opened because a stalled
67
+ network mount can block that indefinitely.
68
+ - **NVIDIA GPU view** — one `nvidia-smi --query-gpu` call for the card rows,
69
+ `--query-compute-apps` (joined with `pmon` for SM%) for the process lines and
70
+ the same tool for the INFO box. `nvidia-smi` is resolved from
71
+ `MACPM_NVIDIA_SMI`, `PATH` or the WSL mount, and NVIDIA DRM nodes are skipped
72
+ when `nvidia-smi` is available so cards are not listed twice.
73
+ - **`python3 -m macpm.probe`** — a standard-library inventory (cards, drivers,
74
+ vendor tools, capability report) for compute nodes, with no psutil or
75
+ terminal needed. `macpm-dump --capabilities` prints the platform, root
76
+ state and the same report.
77
+ - **Deterministic tests on any machine** — `MACPM_SYSROOT` replays a captured
78
+ `/proc` + `/sys` tree, `MACPM_PLATFORM` forces the Linux backend, and
79
+ `tests/linux_fixtures.py` builds hybrid x86, arm64 big.LITTLE, multi-card and
80
+ empty trees.
81
+ - Every view's footer starts with the app name and version
82
+ (`macpm v3.0 · q quit …`), so a screenshot or pasted frame identifies the
83
+ build.
84
+
85
+ ### Changed
86
+
87
+ - CoreFoundation/IOKit/IOReport/AppleSMC are loaded lazily, so importing macpm
88
+ (and `--version` / `--help`) works on platforms without those frameworks.
89
+ - The UI builds its gauges from the detected capabilities: no E cluster means a
90
+ single `CPU Usage` gauge, no ANE means no ANE gauge, no GPU means no GPU
91
+ gauge, and the power panel is hidden when no power source exists.
92
+ - The default route and public-IP lookup use `urllib` instead of `curl`, and
93
+ `ip route` / `/proc/net/route` instead of `route -n get default` on Linux.
94
+ - The sensor panel says `sensors unavailable` instead of `SMC unavailable`
95
+ (the backend may be hwmon).
96
+
97
+ ### Fixed
98
+
99
+ - NVIDIA GPUs were listed twice on drivers that expose DRM nodes (16 rows for
100
+ 8 cards); the DRM duplicate is skipped when `nvidia-smi` is present.
101
+ - Drivers that reject `cuda_version` (e.g. 580) made the whole INFO query fail;
102
+ the query now falls back to the remaining fields.
103
+ - `teco-smi` cards/dies are no longer derived from serials: it exposes eight
104
+ cards of four SDAA dies each without a board grouping, so only the device
105
+ count is shown.
106
+ - VRAM cells pad the used-memory number to a fixed width, so busy and idle
107
+ cards keep their bars aligned.
108
+
109
+ ## 2.2 — 2026-11-12
110
+
111
+ ### Added
112
+
113
+ - **Network view** on key `4` — a rootless overview built from `nettop`: TCP
114
+ socket counts by state (`ESTABLISHED`, `LISTEN`, `CLOSE_WAIT`, `TIME_WAIT`),
115
+ UDP socket count, interface throughput, a listening table (address, PID,
116
+ process) and a per-process traffic table with socket count and download /
117
+ upload rates. `Tab` switches the focused table, `s` cycles its sort column,
118
+ `↑` / `↓` scroll it and `Space` pauses sampling. The traffic table
119
+ refreshes every 2 seconds and the full socket snapshot every 5 seconds while
120
+ the view is open. `nettop` needs no root and sees sockets owned by root
121
+ daemons; sockets without an owner (typically `TIME_WAIT`) are not reported.
122
+ - The network summary box has a line with the active IPv4 interface and prefix,
123
+ the default gateway, and the public IP with its city. For Chinese addresses
124
+ the carrier abbreviation (Telecom, Unicom, Mobile) is appended after the
125
+ country code, e.g. `Shanghai, CN Telecom`.
126
+ The public lookup is one HTTPS request to `ipinfo.io` (falling back to
127
+ `ipwho.is`), cached for 10 minutes and disabled with `--no-public-ip`.
128
+
129
+ ### Changed
130
+
131
+ - The network summary uses fixed-width fields, so the labels no longer move as
132
+ the counter and rate values change. The traffic table is sorted by the
133
+ visible `↓/s` column by default; the combined rate is no longer a hidden sort
134
+ key.
135
+ - The Temps & Fans panel now pairs each component's temperature with its peak
136
+ (CPU on one row, GPU on the next), followed by fan RPMs and one fan-load bar
137
+ per fan. The bars omit the numeric percentage so they can use the full panel
138
+ width. The network identity line is only shown in view 1, not in the
139
+ per-core view.
140
+ - README: screenshots for the process and network views and refreshed
141
+ highlights.
142
+
143
+ ### Fixed
144
+
145
+ - Arrow keys were delivered as a bare `ESC` — which quits macpm — because the
146
+ curses window never enabled keypad mode. `↑` / `↓` now scroll the process
147
+ and network tables as documented.
148
+ - The views reset only the foreground colour after drawing, not the whole SGR
149
+ state. A full reset also cleared the black background set by curses, so the
150
+ terminal profile's background (often grey) showed through in the default,
151
+ process and network views.
152
+
153
+ ## 2.1 — 2026-11-11
154
+
155
+ ### Changed
156
+
157
+ - The power panel is titled `Power` instead of `CPU+GPU+ANE Power`, and every
158
+ panel title is clipped to its box so a long title never wraps the frame.
159
+ - The Temps & Fans panel now uses its spare rows for CPU/GPU peak temperatures
160
+ and fan limits instead of leaving them blank.
161
+ - Per-core gauges are labelled `E1…` / `P1…` instead of `Core-1` / `C-1`, so
162
+ narrow gauges keep the percentage readable.
163
+
164
+ ### Added
165
+
166
+ - **Temps & Fans panel** in the default view — hottest CPU and GPU sensor in
167
+ °C and the current RPM of every fan, read from `AppleSMC` without root.
168
+ - **Process view** on key `3` — a two-box layout: a
169
+ CPU/GPU/RAM summary box (with wired/active/inactive/free memory) and a
170
+ process table with PID, NAME, USER, CPU%, MEM and GPU% columns, sorted with
171
+ `s`, scrolled with `↑`/`↓` and paused with `Space`. The table refreshes
172
+ every 2 seconds to keep macpm's own CPU low. There is no power column.
173
+
174
+ ### Removed
175
+
176
+ - The separate `macpm-sensors` command. The SMC reader is now part of the TUI
177
+ (`macpm.sensors.SensorReader`).
178
+
179
+ ### Fixed
180
+
181
+ - Impossible power peaks (such as `peak: 6208.38W`) caused by coalesced or
182
+ reset Energy Model counters are now discarded instead of being recorded.
183
+ - When the unprivileged Energy Model counters never report, the power panel
184
+ shows `n/a` instead of a misleading `0.00W`; the total is withheld only when
185
+ both CPU and GPU are unreadable.
186
+
187
+ ## 2.0 — 2026-11-10
188
+
189
+ ### Changed
190
+
191
+ - **Rootless by default**: macpm no longer runs `sudo`, `powermetrics` or any
192
+ privileged helper. Data is collected from IOReport, IOKit, `psutil`,
193
+ `sysctl`, `ioreg` and `pmset`.
194
+ - Reworked the sampler into `macpm.sampler`, with ctypes bindings in
195
+ `macpm.ioreport` and SoC/DVFS discovery in `macpm.soc`.
196
+ - The terminal layout, panel titles, charts, colours and key bindings remain
197
+ the same as macpm 0.x.
198
+ - Version bumped to 2.0.
199
+
200
+ ### Added
201
+
202
+ - `macpm-sensors` / `macpm.sensors` — read SMC temperatures and fan speeds
203
+ without root (read-only).
204
+ - `macpm-dump` / `macpm.dump` — print the rootless metrics as JSON for
205
+ debugging.
206
+ - Optional per-core view improvements and reset/peak handling retained from
207
+ 0.24.
208
+ - `--version` flag.
209
+ - Compatibility notes for macOS 12–27, M1–M4 and partial M5/Ultra support.
210
+
211
+ ### Fixed
212
+
213
+ - `--show_cores` now accepts a real boolean value and `--show_cores` alone.
214
+ - Zero-division guards for `--avg < --interval` and for chips without E cores.
215
+ - No child `powermetrics` process is left behind when the TUI exits.
216
+ - `ioreg` output is filtered at the source to avoid retaining tens of MB of
217
+ XML in the Python allocator.
218
+ - Only the required `Energy Model` channels are subscribed, reducing memory
219
+ and CPU usage.
220
+
221
+ ### Removed
222
+
223
+ - `sudo echo` pre-authentication and the `sudo nice powermetrics` subprocess.
224
+ - The `macpm2` development package (merged into `macpm`).
225
+
226
+ ## 0.24
227
+
228
+ - Last 0.x release: `sudo` + `powermetrics` based sampler, Python TUI with
229
+ CPU/GPU/ANE power, RAM, disk and network panels.
@@ -4,3 +4,4 @@ include RELEASE.md
4
4
  include LICENSE
5
5
  recursive-include packaging *
6
6
  recursive-include tests *.py
7
+ recursive-include docs *.md