macpm 3.2.0__tar.gz → 3.3.1__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 (95) hide show
  1. {macpm-3.2.0 → macpm-3.3.1}/CHANGELOG.md +66 -0
  2. {macpm-3.2.0/macpm.egg-info → macpm-3.3.1}/PKG-INFO +65 -7
  3. {macpm-3.2.0 → macpm-3.3.1}/README.md +64 -6
  4. {macpm-3.2.0 → macpm-3.3.1}/RELEASE.md +14 -14
  5. {macpm-3.2.0 → macpm-3.3.1}/macpm/__init__.py +1 -1
  6. {macpm-3.2.0 → macpm-3.3.1}/macpm/blessed_engine.py +65 -23
  7. {macpm-3.2.0 → macpm-3.3.1}/macpm/footprint.py +14 -2
  8. {macpm-3.2.0 → macpm-3.3.1}/macpm/gpuview.py +252 -41
  9. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/sampler.py +6 -7
  10. {macpm-3.2.0 → macpm-3.3.1}/macpm/macpm.py +153 -17
  11. {macpm-3.2.0 → macpm-3.3.1}/macpm/metrics.py +40 -6
  12. {macpm-3.2.0 → macpm-3.3.1}/macpm/network.py +148 -3
  13. {macpm-3.2.0 → macpm-3.3.1}/macpm/processes.py +101 -23
  14. {macpm-3.2.0 → macpm-3.3.1}/macpm/sampler.py +13 -16
  15. {macpm-3.2.0 → macpm-3.3.1}/macpm/sensors.py +47 -0
  16. macpm-3.3.1/macpm/theme.py +286 -0
  17. {macpm-3.2.0 → macpm-3.3.1}/macpm/widgets.py +6 -0
  18. {macpm-3.2.0 → macpm-3.3.1/macpm.egg-info}/PKG-INFO +65 -7
  19. {macpm-3.2.0 → macpm-3.3.1}/macpm.egg-info/SOURCES.txt +3 -0
  20. {macpm-3.2.0 → macpm-3.3.1}/setup.py +1 -1
  21. {macpm-3.2.0 → macpm-3.3.1}/tests/test_footprint.py +30 -0
  22. {macpm-3.2.0 → macpm-3.3.1}/tests/test_gpuview.py +130 -2
  23. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_view.py +37 -0
  24. macpm-3.3.1/tests/test_power_panel.py +28 -0
  25. macpm-3.3.1/tests/test_sampler.py +78 -0
  26. {macpm-3.2.0 → macpm-3.3.1}/tests/test_sampler_macos.py +19 -0
  27. macpm-3.3.1/tests/test_theme.py +185 -0
  28. macpm-3.2.0/tests/test_sampler.py +0 -35
  29. {macpm-3.2.0 → macpm-3.3.1}/LICENSE +0 -0
  30. {macpm-3.2.0 → macpm-3.3.1}/MANIFEST.in +0 -0
  31. {macpm-3.2.0 → macpm-3.3.1}/docs/linux-port.md +0 -0
  32. {macpm-3.2.0 → macpm-3.3.1}/macpm/__main__.py +0 -0
  33. {macpm-3.2.0 → macpm-3.3.1}/macpm/backend.py +0 -0
  34. {macpm-3.2.0 → macpm-3.3.1}/macpm/capabilities.py +0 -0
  35. {macpm-3.2.0 → macpm-3.3.1}/macpm/dump.py +0 -0
  36. {macpm-3.2.0 → macpm-3.3.1}/macpm/ioreport.py +0 -0
  37. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/__init__.py +0 -0
  38. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/cpu.py +0 -0
  39. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/gpu.py +0 -0
  40. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/modelname.py +0 -0
  41. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/net.py +0 -0
  42. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/power.py +0 -0
  43. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/proc.py +0 -0
  44. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/soc.py +0 -0
  45. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/sysfs.py +0 -0
  46. {macpm-3.2.0 → macpm-3.3.1}/macpm/linux_backend/thermal.py +0 -0
  47. {macpm-3.2.0 → macpm-3.3.1}/macpm/macos_gpu.py +0 -0
  48. {macpm-3.2.0 → macpm-3.3.1}/macpm/netinfo.py +0 -0
  49. {macpm-3.2.0 → macpm-3.3.1}/macpm/netmodel.py +0 -0
  50. {macpm-3.2.0 → macpm-3.3.1}/macpm/probe.py +0 -0
  51. {macpm-3.2.0 → macpm-3.3.1}/macpm/smc.py +0 -0
  52. {macpm-3.2.0 → macpm-3.3.1}/macpm/soc.py +0 -0
  53. {macpm-3.2.0 → macpm-3.3.1}/macpm/tui.py +0 -0
  54. {macpm-3.2.0 → macpm-3.3.1}/macpm.egg-info/dependency_links.txt +0 -0
  55. {macpm-3.2.0 → macpm-3.3.1}/macpm.egg-info/entry_points.txt +0 -0
  56. {macpm-3.2.0 → macpm-3.3.1}/macpm.egg-info/not-zip-safe +0 -0
  57. {macpm-3.2.0 → macpm-3.3.1}/macpm.egg-info/requires.txt +0 -0
  58. {macpm-3.2.0 → macpm-3.3.1}/macpm.egg-info/top_level.txt +0 -0
  59. {macpm-3.2.0 → macpm-3.3.1}/packaging/README-linux.txt +0 -0
  60. {macpm-3.2.0 → macpm-3.3.1}/packaging/README.txt +0 -0
  61. {macpm-3.2.0 → macpm-3.3.1}/packaging/build-linux.sh +0 -0
  62. {macpm-3.2.0 → macpm-3.3.1}/packaging/build.sh +0 -0
  63. {macpm-3.2.0 → macpm-3.3.1}/packaging/entry_tui.py +0 -0
  64. {macpm-3.2.0 → macpm-3.3.1}/packaging/install.sh +0 -0
  65. {macpm-3.2.0 → macpm-3.3.1}/packaging/linux/Dockerfile +0 -0
  66. {macpm-3.2.0 → macpm-3.3.1}/packaging/linux/README.txt +0 -0
  67. {macpm-3.2.0 → macpm-3.3.1}/packaging/macpm-linux.spec +0 -0
  68. {macpm-3.2.0 → macpm-3.3.1}/packaging/macpm.command +0 -0
  69. {macpm-3.2.0 → macpm-3.3.1}/pyproject.toml +0 -0
  70. {macpm-3.2.0 → macpm-3.3.1}/setup.cfg +0 -0
  71. {macpm-3.2.0 → macpm-3.3.1}/tests/__init__.py +0 -0
  72. {macpm-3.2.0 → macpm-3.3.1}/tests/linux_fixtures.py +0 -0
  73. {macpm-3.2.0 → macpm-3.3.1}/tests/test_ane.py +0 -0
  74. {macpm-3.2.0 → macpm-3.3.1}/tests/test_blessed_engine.py +0 -0
  75. {macpm-3.2.0 → macpm-3.3.1}/tests/test_calc_freq.py +0 -0
  76. {macpm-3.2.0 → macpm-3.3.1}/tests/test_cli.py +0 -0
  77. {macpm-3.2.0 → macpm-3.3.1}/tests/test_layout.py +0 -0
  78. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_cpu.py +0 -0
  79. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_gpu.py +0 -0
  80. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_ixsmi.py +0 -0
  81. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_modelname.py +0 -0
  82. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_net.py +0 -0
  83. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_nvidia.py +0 -0
  84. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_power.py +0 -0
  85. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_sampler.py +0 -0
  86. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_thermal.py +0 -0
  87. {macpm-3.2.0 → macpm-3.3.1}/tests/test_linux_wiring.py +0 -0
  88. {macpm-3.2.0 → macpm-3.3.1}/tests/test_macos_gpu.py +0 -0
  89. {macpm-3.2.0 → macpm-3.3.1}/tests/test_netinfo.py +0 -0
  90. {macpm-3.2.0 → macpm-3.3.1}/tests/test_network.py +0 -0
  91. {macpm-3.2.0 → macpm-3.3.1}/tests/test_probe.py +0 -0
  92. {macpm-3.2.0 → macpm-3.3.1}/tests/test_process_linux.py +0 -0
  93. {macpm-3.2.0 → macpm-3.3.1}/tests/test_processes.py +0 -0
  94. {macpm-3.2.0 → macpm-3.3.1}/tests/test_sensors.py +0 -0
  95. {macpm-3.2.0 → macpm-3.3.1}/tests/test_widgets.py +0 -0
@@ -1,5 +1,71 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.3.1 — 2026-11-25
4
+
5
+ ### Fixed
6
+
7
+ - GPU view: `s` now includes the process table's GPU-memory column on
8
+ single-card hosts (macOS, single-GPU Linux), where the sort cycle skipped it;
9
+ the `GPU MEM` header was widened so its `↓`/`↑` marker is not clipped.
10
+
11
+ - macOS power panel on macOS 27: an energy counter that stops reporting — the
12
+ CPU/ANE `Energy Model` channels do this without root on newer builds — now
13
+ falls back to `n/a` once its last ten samples were silent, instead of
14
+ showing `0.00W` forever. Its stale peak, average and maximum are cleared at
15
+ the same time.
16
+ - The Power box names the half that is still reporting (`Power (GPU only)` /
17
+ `Power (CPU only)`) instead of presenting a partial sum as package power.
18
+ - A counter that has not produced a first reading yet shows `CPU: —` / `GPU: —`
19
+ for the first frames instead of a misleading `0.00W`.
20
+
21
+ ### Changed
22
+
23
+ - Documented `--no-color`: it emits no foreground colour, uses the terminal's
24
+ own foreground, and can be paired with terminal themes and keyword
25
+ highlighting; it stays outside the `←`/`→` ring.
26
+
27
+ ## 3.3.0 — 2026-11-20
28
+
29
+ ### Added
30
+
31
+ - A ninth colour stop, the built-in semantic theme (`--native`, or `→` from
32
+ `8`): grey frame, bright-white machine title and numbers, brown category box
33
+ names, near-white field names, dim secondary text, blue IO rates, cyan IP
34
+ addresses, green normal bars, yellow footer key hints, and amber/red only for
35
+ warnings. Gauges and temperatures use green/amber/red at 60/85% load,
36
+ 75/90°C, 75/90% RAM, 50/80% process CPU and 5/15% process memory. The palette
37
+ uses fixed xterm-256 indices (16-255), so it does not follow the terminal.
38
+ - Table lists only keep the header row and the current sort column bright; all
39
+ other normal cells are dim. This applies to the process view, the network
40
+ traffic/listener tables and the single-card GPU process table, and fits the
41
+ brown titles, blue rates, cyan addresses and yellow footer keys throughout.
42
+ - GPU card `BUSY`/`VRAM` bars use the same green/amber/red thresholds instead of
43
+ being uncoloured; `GPU INFO`, `GPUs (N)` and the per-card headers follow the
44
+ same title/header roles.
45
+ - `--no-color` remains a startup-only monochrome mode outside the ring.
46
+ - `images/native.png`: the semantic palette screenshot used in the README.
47
+
48
+ ### Changed
49
+
50
+ - macOS GPU view: a process stays listed while it holds GPU memory, even when
51
+ its `GPU%` is momentarily 0 (a browser between frames), instead of flickering
52
+ in and out of the table. The `CARD` column is hidden on macOS, where a
53
+ single integrated GPU would make every row read `-`.
54
+ - The macOS `footprint` poller now targets only processes that actually hold a
55
+ Metal client (from the IORegistry), and rotates the idle targets beyond its
56
+ 32-target cap, so every GPU app is eventually measured instead of the
57
+ lowest-PID daemons taking the slots.
58
+ - A single-card GPU view no longer repeats that card's power in the box title;
59
+ the total stays on multi-GPU hosts, where each row is one card.
60
+ - Narrow terminals keep the card table's VRAM column: it first shrinks to a
61
+ short bar with compact numbers, then to numbers only, and is dropped only
62
+ below ~74 columns. Previously the whole column disappeared under 86
63
+ columns.
64
+ - The card table sizes `NAME` to the longest card plus padding instead of
65
+ letting it absorb the whole spare width; the surplus goes to the VRAM bar
66
+ (`BUSY` on tables too narrow for VRAM). `BUSY` is left-aligned so its bar
67
+ starts directly after the name.
68
+
3
69
  ## 3.2.0 — 2026-11-16
4
70
 
5
71
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macpm
3
- Version: 3.2.0
3
+ Version: 3.3.1
4
4
  Summary: Performance monitoring CLI for Apple Silicon and Linux
5
5
  Home-page: https://github.com/visualcjy/macpm
6
6
  Author: Jinyu Chen
@@ -52,6 +52,21 @@ A Python-based `nvtop`-inspired terminal monitor for Apple Silicon Macs,
52
52
  forked from [asitop](https://github.com/tlkh/asitop), with an x86_64/arm64
53
53
  Linux backend.
54
54
 
55
+ ## What's new in 3.3
56
+
57
+ - **Built-in semantic colour theme.** The ninth `←`/`→` stop (`--native`)
58
+ paints by role instead of one accent colour: grey frame, bright-white machine
59
+ title and numbers, brown category box names, near-white field names, dim
60
+ secondary text, blue IO rates, cyan IP addresses, green normal bars, yellow
61
+ footer key hints, and amber/red only for warnings. The palette is fixed
62
+ xterm-256 output, so it does not depend on the terminal profile.
63
+ - **Readable tables.** In the process, network and single-card GPU tables only
64
+ the header row and the current sort column stay bright; other normal cells
65
+ are dim. GPU card BUSY/VRAM bars follow the same green/amber/red thresholds.
66
+ - **`--no-color` stays monochrome** and remains outside the colour ring.
67
+
68
+ ![macpm native semantic palette](https://raw.githubusercontent.com/visualcjy/macpm/main/images/native.png)
69
+
55
70
  ## What's new in 3.0
56
71
 
57
72
  - **Runs on Linux** (x86_64/arm64/LoongArch64) from the same package: `/proc`
@@ -76,6 +91,10 @@ disk I/O and network, updating once per second:
76
91
 
77
92
  ![macpm default view](https://raw.githubusercontent.com/visualcjy/macpm/main/images/macpm_v.gif)
78
93
 
94
+ The built-in semantic palette (`--native`, the ninth colour stop):
95
+
96
+ ![macpm native semantic palette](https://raw.githubusercontent.com/visualcjy/macpm/main/images/native.png)
97
+
79
98
  Same view in another colour theme (press ← / → to cycle through them):
80
99
 
81
100
  ![macpm cyan colour theme](https://raw.githubusercontent.com/visualcjy/macpm/main/images/macpm.gif)
@@ -145,6 +164,8 @@ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [-
145
164
  |---|---|
146
165
  | `--interval SECONDS` | Sampling and display interval (default `1`) |
147
166
  | `--color 1-8` | Display colour (default `2`) |
167
+ | `--native` | Start in the built-in semantic colour theme |
168
+ | `--no-color` | Emit no colour; use the terminal's default foreground (works with terminal themes and keyword highlighting) |
148
169
  | `--avg SECONDS` | Averaging window for power values (default `30`) |
149
170
  | `--show_cores [BOOL]` | Start in the per-core view |
150
171
  | `--no-public-ip` | Do not look up the public IP and location |
@@ -166,7 +187,31 @@ Ctrl+R reset peaks
166
187
  ## Colour themes
167
188
 
168
189
  Pick one with `--color N`, or press ← / → while macpm is running. The default
169
- is `2` (green).
190
+ is `2` (green). The ring has nine stops: `1`-`8` paint the whole UI in one ANSI
191
+ accent colour, and the ninth (`--native`, or → from `8`) uses macpm's own
192
+ semantic palette instead: frame lines stay grey, the machine title and numbers
193
+ are bright white, category box names (Memory, Power, Disk IO, Network IO) are
194
+ brown, field names near-white, ordinary text dim, IO rates blue, IP addresses
195
+ cyan, normal bars the original green, footer key hints yellow, and only
196
+ warnings/critical readings use amber/red. In the process, network and
197
+ single-card GPU tables only the header row and the current sort column are
198
+ bright; the other normal cells stay dim. The palette uses fixed xterm-256
199
+ indices (16-255), so it does not follow the terminal profile.
200
+
201
+ ### No colour
202
+
203
+ `--no-color` emits no foreground colour at all: frames, labels, numbers, bars
204
+ and footer hints all use the terminal's default foreground. This is the mode
205
+ to combine with the terminal's own theme and keyword highlighting (iTerm2
206
+ `Triggers → Highlight Text`, NyaTerm `内置规则`, etc.), so numbers, errors or
207
+ IP addresses can be coloured by the terminal instead of macpm. It is outside
208
+ the `←`/`→` ring: pressing an arrow returns to a colour theme, and the flag wins
209
+ over `--color`/`--native` if both are given. Bars and frames stay readable
210
+ because they are drawn with block and box glyphs, not colour.
211
+
212
+ ```sh
213
+ macpm --no-color
214
+ ```
170
215
 
171
216
  | | |
172
217
  |---|---|
@@ -334,7 +379,7 @@ shows `n/a` and the reason stays in the data
334
379
 
335
380
  A single-GPU machine keeps the older layout: card summary on top, process table
336
381
  below. Every view's footer starts with the app name and version
337
- (`macpm v3.2.0 · q quit …`).
382
+ (`macpm v3.3.1 · q quit …`).
338
383
 
339
384
  ```text
340
385
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -348,7 +393,7 @@ below. Every view's footer starts with the app name and version
348
393
  │ └ 222 Xorg 2.0G │
349
394
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
350
395
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
351
- └ macpm v3.2.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
396
+ └ macpm v3.3.1 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
352
397
  ```
353
398
 
354
399
  | Platform | What fills each row |
@@ -387,6 +432,11 @@ Notes:
387
432
  idle ones every 30 s, with a minute of backoff after three failures, and it
388
433
  stops ~10 s after the view is closed. Without root `footprint` can only read
389
434
  your own processes; the rest keep `n/a`.
435
+ - On macOS, the table keeps a process listed while it holds GPU memory even
436
+ when its `GPU%` is momentarily 0 (a browser between frames), and the `CARD`
437
+ column is omitted: a Mac has one integrated GPU, so it would only ever show
438
+ `-`. On Linux multi-GPU hosts `CARD` still shows the index/range the process
439
+ holds.
390
440
  - The nested process line comes from the vendor's own compute-process list
391
441
  (`ixsmi pmon`/`--query-compute-apps`, `dlsmi --query-compute-apps`,
392
442
  `teco-smi pmon`) or, on macOS and DRM GPUs, from `fdinfo`/IOAccelerator. A
@@ -412,6 +462,11 @@ Notes:
412
462
  placements, so their difference is never used as "private" memory; anything
413
463
  unprovable stays `n/a` rather than being guessed. Other users' processes
414
464
  need root to be inspected, and their bytes show as unattributed.
465
+ - The card table sizes `NAME` to the longest card plus padding rather than
466
+ stretching it; the spare width goes to the VRAM bar. On narrow terminals it
467
+ sheds columns, and the VRAM cell shrinks to a short bar with compact numbers
468
+ (then to numbers only) before the column is dropped, so memory stays visible
469
+ down to ~74 columns.
415
470
  - The default view's GPU gauge shows the busiest card and appends `(max of N)`
416
471
  when the machine has more than one.
417
472
 
@@ -634,9 +689,12 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
634
689
  - **`macpm: command not found`** — add your Python user-base `bin` directory to
635
690
  `PATH`, or run `python3 -m macpm`.
636
691
  - **Power readings freeze or show `n/a` on macOS 27** — some builds restrict
637
- unprivileged `Energy Model` refreshes. CPU/GPU usage and frequency still
638
- work; a counter that never reports is shown as `n/a` instead of `0.00W`.
639
- Run `macpm-dump` to inspect the raw values.
692
+ unprivileged `Energy Model` refreshes, and the CPU/ANE channels can stop
693
+ updating while the GPU one keeps working. CPU/GPU usage and frequency still
694
+ work; a counter that has been silent for ten samples is shown as `n/a`
695
+ instead of `0.00W`, and the Power box then reads `Power (GPU only)`. The
696
+ first frames of a session show `CPU: —` until a counter reports once. Run
697
+ `macpm-dump` to inspect the raw values.
640
698
  - **M5/Ultra values look wrong** — CPU tier/channel mapping is not complete;
641
699
  see the compatibility table.
642
700
  - **The Temps & Fans box says `SMC unavailable`** — the AppleSMC user client
@@ -10,6 +10,21 @@ A Python-based `nvtop`-inspired terminal monitor for Apple Silicon Macs,
10
10
  forked from [asitop](https://github.com/tlkh/asitop), with an x86_64/arm64
11
11
  Linux backend.
12
12
 
13
+ ## What's new in 3.3
14
+
15
+ - **Built-in semantic colour theme.** The ninth `←`/`→` stop (`--native`)
16
+ paints by role instead of one accent colour: grey frame, bright-white machine
17
+ title and numbers, brown category box names, near-white field names, dim
18
+ secondary text, blue IO rates, cyan IP addresses, green normal bars, yellow
19
+ footer key hints, and amber/red only for warnings. The palette is fixed
20
+ xterm-256 output, so it does not depend on the terminal profile.
21
+ - **Readable tables.** In the process, network and single-card GPU tables only
22
+ the header row and the current sort column stay bright; other normal cells
23
+ are dim. GPU card BUSY/VRAM bars follow the same green/amber/red thresholds.
24
+ - **`--no-color` stays monochrome** and remains outside the colour ring.
25
+
26
+ ![macpm native semantic palette](https://raw.githubusercontent.com/visualcjy/macpm/main/images/native.png)
27
+
13
28
  ## What's new in 3.0
14
29
 
15
30
  - **Runs on Linux** (x86_64/arm64/LoongArch64) from the same package: `/proc`
@@ -34,6 +49,10 @@ disk I/O and network, updating once per second:
34
49
 
35
50
  ![macpm default view](https://raw.githubusercontent.com/visualcjy/macpm/main/images/macpm_v.gif)
36
51
 
52
+ The built-in semantic palette (`--native`, the ninth colour stop):
53
+
54
+ ![macpm native semantic palette](https://raw.githubusercontent.com/visualcjy/macpm/main/images/native.png)
55
+
37
56
  Same view in another colour theme (press ← / → to cycle through them):
38
57
 
39
58
  ![macpm cyan colour theme](https://raw.githubusercontent.com/visualcjy/macpm/main/images/macpm.gif)
@@ -103,6 +122,8 @@ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [-
103
122
  |---|---|
104
123
  | `--interval SECONDS` | Sampling and display interval (default `1`) |
105
124
  | `--color 1-8` | Display colour (default `2`) |
125
+ | `--native` | Start in the built-in semantic colour theme |
126
+ | `--no-color` | Emit no colour; use the terminal's default foreground (works with terminal themes and keyword highlighting) |
106
127
  | `--avg SECONDS` | Averaging window for power values (default `30`) |
107
128
  | `--show_cores [BOOL]` | Start in the per-core view |
108
129
  | `--no-public-ip` | Do not look up the public IP and location |
@@ -124,7 +145,31 @@ Ctrl+R reset peaks
124
145
  ## Colour themes
125
146
 
126
147
  Pick one with `--color N`, or press ← / → while macpm is running. The default
127
- is `2` (green).
148
+ is `2` (green). The ring has nine stops: `1`-`8` paint the whole UI in one ANSI
149
+ accent colour, and the ninth (`--native`, or → from `8`) uses macpm's own
150
+ semantic palette instead: frame lines stay grey, the machine title and numbers
151
+ are bright white, category box names (Memory, Power, Disk IO, Network IO) are
152
+ brown, field names near-white, ordinary text dim, IO rates blue, IP addresses
153
+ cyan, normal bars the original green, footer key hints yellow, and only
154
+ warnings/critical readings use amber/red. In the process, network and
155
+ single-card GPU tables only the header row and the current sort column are
156
+ bright; the other normal cells stay dim. The palette uses fixed xterm-256
157
+ indices (16-255), so it does not follow the terminal profile.
158
+
159
+ ### No colour
160
+
161
+ `--no-color` emits no foreground colour at all: frames, labels, numbers, bars
162
+ and footer hints all use the terminal's default foreground. This is the mode
163
+ to combine with the terminal's own theme and keyword highlighting (iTerm2
164
+ `Triggers → Highlight Text`, NyaTerm `内置规则`, etc.), so numbers, errors or
165
+ IP addresses can be coloured by the terminal instead of macpm. It is outside
166
+ the `←`/`→` ring: pressing an arrow returns to a colour theme, and the flag wins
167
+ over `--color`/`--native` if both are given. Bars and frames stay readable
168
+ because they are drawn with block and box glyphs, not colour.
169
+
170
+ ```sh
171
+ macpm --no-color
172
+ ```
128
173
 
129
174
  | | |
130
175
  |---|---|
@@ -292,7 +337,7 @@ shows `n/a` and the reason stays in the data
292
337
 
293
338
  A single-GPU machine keeps the older layout: card summary on top, process table
294
339
  below. Every view's footer starts with the app name and version
295
- (`macpm v3.2.0 · q quit …`).
340
+ (`macpm v3.3.1 · q quit …`).
296
341
 
297
342
  ```text
298
343
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -306,7 +351,7 @@ below. Every view's footer starts with the app name and version
306
351
  │ └ 222 Xorg 2.0G │
307
352
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
308
353
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
309
- └ macpm v3.2.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
354
+ └ macpm v3.3.1 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
310
355
  ```
311
356
 
312
357
  | Platform | What fills each row |
@@ -345,6 +390,11 @@ Notes:
345
390
  idle ones every 30 s, with a minute of backoff after three failures, and it
346
391
  stops ~10 s after the view is closed. Without root `footprint` can only read
347
392
  your own processes; the rest keep `n/a`.
393
+ - On macOS, the table keeps a process listed while it holds GPU memory even
394
+ when its `GPU%` is momentarily 0 (a browser between frames), and the `CARD`
395
+ column is omitted: a Mac has one integrated GPU, so it would only ever show
396
+ `-`. On Linux multi-GPU hosts `CARD` still shows the index/range the process
397
+ holds.
348
398
  - The nested process line comes from the vendor's own compute-process list
349
399
  (`ixsmi pmon`/`--query-compute-apps`, `dlsmi --query-compute-apps`,
350
400
  `teco-smi pmon`) or, on macOS and DRM GPUs, from `fdinfo`/IOAccelerator. A
@@ -370,6 +420,11 @@ Notes:
370
420
  placements, so their difference is never used as "private" memory; anything
371
421
  unprovable stays `n/a` rather than being guessed. Other users' processes
372
422
  need root to be inspected, and their bytes show as unattributed.
423
+ - The card table sizes `NAME` to the longest card plus padding rather than
424
+ stretching it; the spare width goes to the VRAM bar. On narrow terminals it
425
+ sheds columns, and the VRAM cell shrinks to a short bar with compact numbers
426
+ (then to numbers only) before the column is dropped, so memory stays visible
427
+ down to ~74 columns.
373
428
  - The default view's GPU gauge shows the busiest card and appends `(max of N)`
374
429
  when the machine has more than one.
375
430
 
@@ -592,9 +647,12 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
592
647
  - **`macpm: command not found`** — add your Python user-base `bin` directory to
593
648
  `PATH`, or run `python3 -m macpm`.
594
649
  - **Power readings freeze or show `n/a` on macOS 27** — some builds restrict
595
- unprivileged `Energy Model` refreshes. CPU/GPU usage and frequency still
596
- work; a counter that never reports is shown as `n/a` instead of `0.00W`.
597
- Run `macpm-dump` to inspect the raw values.
650
+ unprivileged `Energy Model` refreshes, and the CPU/ANE channels can stop
651
+ updating while the GPU one keeps working. CPU/GPU usage and frequency still
652
+ work; a counter that has been silent for ten samples is shown as `n/a`
653
+ instead of `0.00W`, and the Power box then reads `Power (GPU only)`. The
654
+ first frames of a session show `CPU: —` until a counter reports once. Run
655
+ `macpm-dump` to inspect the raw values.
598
656
  - **M5/Ultra values look wrong** — CPU tier/channel mapping is not complete;
599
657
  see the compatibility table.
600
658
  - **The Temps & Fans box says `SMC unavailable`** — the AppleSMC user client
@@ -1,4 +1,4 @@
1
- # Releasing macpm 3.2.0
1
+ # Releasing macpm 3.3.1
2
2
 
3
3
  This checklist prepares a GitHub tag and a PyPI upload. It does not push or
4
4
  publish anything by itself.
@@ -7,11 +7,11 @@ publish anything by itself.
7
7
 
8
8
  - macOS Apple Silicon, Python 3.9+.
9
9
  - Clean working tree (`git status`), all tests passing.
10
- - Version is `3.2.0` in:
10
+ - Version is `3.3.1` in:
11
11
  - `setup.py`
12
12
  - `macpm/__init__.py` (`__version__`)
13
13
  - the banner and `--version` derive from it (`macpm/macpm.py`)
14
- - `CHANGELOG.md` has the `3.2.0` entry.
14
+ - `CHANGELOG.md` has the `3.3.1` entry.
15
15
 
16
16
  ## 2. Test from source
17
17
 
@@ -38,7 +38,7 @@ Test the wheel in a **clean** venv (this is the real "no source tree" test):
38
38
 
39
39
  ```sh
40
40
  python3 -m venv /tmp/macpm-wheel-test
41
- /tmp/macpm-wheel-test/bin/pip install dist/macpm-3.2.0-py3-none-any.whl
41
+ /tmp/macpm-wheel-test/bin/pip install dist/macpm-3.3.1-py3-none-any.whl
42
42
  /tmp/macpm-wheel-test/bin/macpm --help
43
43
  /tmp/macpm-wheel-test/bin/macpm-dump # Ctrl+C
44
44
  ```
@@ -78,13 +78,13 @@ Manual alternative (fallback, e.g. when OIDC is unavailable):
78
78
  ```sh
79
79
  # requires a PyPI API token in ~/.pypirc or TWINE_PASSWORD
80
80
  python3 -m twine upload --non-interactive \
81
- dist/macpm-3.2.0.tar.gz dist/macpm-3.2.0-py3-none-any.whl
81
+ dist/macpm-3.3.1.tar.gz dist/macpm-3.3.1-py3-none-any.whl
82
82
  ```
83
83
 
84
84
  Then verify:
85
85
 
86
86
  ```sh
87
- python3 -m pip install --upgrade macpm==3.2.0
87
+ python3 -m pip install --upgrade macpm==3.3.1
88
88
  macpm --version
89
89
  ```
90
90
 
@@ -93,10 +93,10 @@ macpm --version
93
93
  ```sh
94
94
  git add setup.py pyproject.toml MANIFEST.in README.md CHANGELOG.md RELEASE.md \
95
95
  macpm packaging tests .github bin
96
- git commit -m "Release macpm 3.2.0: per-process GPU memory, ANE utilisation"
97
- git tag -a v3.2.0 -m "macpm 3.2.0"
96
+ git commit -m "Release macpm 3.3.1: macOS 27 power fallback and GPU sort fixes"
97
+ git tag -a v3.3.1 -m "macpm 3.3.1"
98
98
  git push origin main
99
- git push origin v3.2.0
99
+ git push origin v3.3.1
100
100
  ```
101
101
 
102
102
  The `Release` workflow builds the sdist/wheel, checks metadata and attaches
@@ -122,7 +122,7 @@ PYTHON=python3 packaging/build.sh
122
122
  This produces:
123
123
 
124
124
  ```text
125
- dist/macpm-3.2.0-macos-arm64.tar.gz
125
+ dist/macpm-3.3.1-macos-arm64.tar.gz
126
126
  ```
127
127
 
128
128
  Attach it to the GitHub release. The binaries are ad-hoc signed, not
@@ -148,10 +148,10 @@ The first run downloads python-build-standalone (cached in
148
148
  `~/.cache/macpm-build/pbs`) and produces:
149
149
 
150
150
  ```text
151
- dist/macpm-3.2.0-linux-x86_64.tar.gz
152
- dist/macpm-3.2.0-linux-aarch64.tar.gz
153
- dist/macpm_3.2.0_amd64.deb
154
- dist/macpm_3.2.0_arm64.deb
151
+ dist/macpm-3.3.1-linux-x86_64.tar.gz
152
+ dist/macpm-3.3.1-linux-aarch64.tar.gz
153
+ dist/macpm_3.3.1_amd64.deb
154
+ dist/macpm_3.3.1_arm64.deb
155
155
  ```
156
156
 
157
157
  Both architectures keep a glibc 2.17 floor. Building x86_64 on an arm64 host
@@ -1,3 +1,3 @@
1
1
  """macpm: rootless performance monitor for Apple Silicon."""
2
2
 
3
- __version__ = "3.2.0"
3
+ __version__ = "3.3.1"
@@ -7,6 +7,7 @@ blessed/ANSI so views 1/2 share the palette and border helpers of views 3-5.
7
7
 
8
8
  from __future__ import annotations
9
9
 
10
+ from .theme import KEY, OK, TITLE, UniformPalette, metric_spans, paint_spans, severity, title_spans
10
11
  from .tui import RESET_FG, _border, _bottom, _fit, _pad
11
12
 
12
13
  _VBARS = "▁▂▃▄▅▆▇█"
@@ -27,21 +28,39 @@ def _bordered(tile) -> bool:
27
28
  return getattr(tile, "border_color", None) is not None
28
29
 
29
30
 
30
- def _write(out: list, term, row: int, column: int, text: str, color: str) -> None:
31
+ def _write(out: list, term, row: int, column: int, text: str, palette, role=None) -> None:
31
32
  # Always write, including spaces: the terminal keeps stale cells when a
32
33
  # bar shrinks, which looked like a horizontal streak at the chart top.
33
- out.append(term.move(row, column) + color + text + RESET_FG)
34
+ if getattr(palette, "native", False):
35
+ spans = metric_spans(text, role or KEY)
36
+ else:
37
+ spans = [(text, role)]
38
+ out.append(term.move(row, column) + paint_spans(spans, palette))
39
+
40
+
41
+ def _write_spans(out: list, term, row: int, column: int, spans, palette, width=None) -> None:
42
+ out.append(term.move(row, column) + paint_spans(spans, palette, width))
34
43
 
35
44
 
36
- def _box(tile, row, col, width, height, out, term, color) -> None:
45
+ def _box(tile, row, col, width, height, out, term, palette) -> None:
46
+ color = palette.accent()
47
+ title_role = getattr(tile, "title_role", None) or TITLE
37
48
  title = getattr(tile, "title", "") or ""
38
49
  bottom = getattr(tile, "bottom_title", "") or ""
39
50
  line = _fit(f" {title} ", max(0, width - 2)) if title else ""
40
51
  out.append(term.move(row, col) + color + _border(width, line) + RESET_FG)
52
+ if line:
53
+ _write_spans(out, term, row, col + 1, title_spans(line, title_role), palette)
41
54
  if height > 1:
42
55
  out.append(
43
56
  term.move(row + height - 1, col) + color + _bottom(width, bottom) + RESET_FG
44
57
  )
58
+ fitted_bottom = _fit(bottom, max(0, width - 2))
59
+ if fitted_bottom:
60
+ _write_spans(
61
+ out, term, row + height - 1, col + 1,
62
+ metric_spans(fitted_bottom, TITLE), palette,
63
+ )
45
64
  for offset in range(1, max(1, height - 1)):
46
65
  out.append(term.move(row + offset, col) + color + "│" + RESET_FG)
47
66
  out.append(
@@ -122,7 +141,7 @@ def _chart_values(tile, width: int) -> list:
122
141
  return points[-width:] if width > 0 else []
123
142
 
124
143
 
125
- def _chart(tile, row, col, width, height, out, term, color) -> None:
144
+ def _chart(tile, row, col, width, height, out, term, palette) -> None:
126
145
  points = _chart_values(tile, width)
127
146
  # Newest sample sits at the right edge; older ones scroll out to the left.
128
147
  offset = width - len(points)
@@ -138,25 +157,45 @@ def _chart(tile, row, col, width, height, out, term, color) -> None:
138
157
  chars.append(_VBARS[min(7, max(0, int(level * 8) - 1))])
139
158
  else:
140
159
  chars.append(" ")
141
- _write(out, term, row + line, col, "".join(chars), color)
160
+ _write(out, term, row + line, col, "".join(chars), palette, OK)
142
161
 
143
162
 
144
- def _sensor(tile, row, col, width, height, out, term, color) -> None:
163
+ def _sensor(tile, row, col, width, height, out, term, palette) -> None:
145
164
  lines = list(getattr(tile, "lines", []) or [])
165
+ styled = [list(line) for line in (getattr(tile, "styled_lines", []) or [])]
146
166
  levels = getattr(tile, "levels", None)
147
- if levels and len(lines) < height:
148
- lines.append(tile._fan_bars(max(0, width - 1)))
167
+ if levels:
168
+ fan_line = [(tile._fan_bars(max(0, width - 1)), None)]
169
+ if styled:
170
+ if len(styled) < height:
171
+ styled.append(fan_line)
172
+ elif len(lines) < height:
173
+ lines.append(tile._fan_bars(max(0, width - 1)))
149
174
  for offset in range(height):
150
- text = lines[offset] if offset < len(lines) else ""
151
- _write(out, term, row + offset, col, _pad(_fit(text, width), width), color)
175
+ if offset < len(styled):
176
+ _write_spans(out, term, row + offset, col, styled[offset], palette, width)
177
+ elif offset < len(lines):
178
+ text = _pad(_fit(lines[offset], width), width)
179
+ _write(out, term, row + offset, col, text, palette, KEY)
180
+ else:
181
+ _write_spans(out, term, row + offset, col, [], palette, width)
182
+
183
+
184
+ def _bar_role(palette, tile):
185
+ if not getattr(palette, "native", False):
186
+ return None
187
+ metric = getattr(tile, "metric", None)
188
+ if not metric:
189
+ return None
190
+ return severity(metric, getattr(tile, "value", 0))
152
191
 
153
192
 
154
- def paint(tile, row, col, width, height, out, term, color) -> None:
193
+ def paint(tile, row, col, width, height, out, term, palette) -> None:
155
194
  if width <= 0 or height <= 0:
156
195
  return
157
196
  bordered = _bordered(tile) and width >= 3 and height >= 3
158
197
  if bordered:
159
- _box(tile, row, col, width, height, out, term, color)
198
+ _box(tile, row, col, width, height, out, term, palette)
160
199
  row, col, width, height = row + 1, col + 1, width - 2, height - 2
161
200
 
162
201
  name = type(tile).__name__
@@ -165,7 +204,7 @@ def paint(tile, row, col, width, height, out, term, color) -> None:
165
204
  if name in ("VSplit", "FillVSplit"):
166
205
  y = row
167
206
  for item, child_height in zip(items, _heights(tile, height)):
168
- paint(item, y, col, width, child_height, out, term, color)
207
+ paint(item, y, col, width, child_height, out, term, palette)
169
208
  y += child_height
170
209
  else:
171
210
  x = col
@@ -175,7 +214,7 @@ def paint(tile, row, col, width, height, out, term, color) -> None:
175
214
  # one long bar. Bordered panels already have their own frame,
176
215
  # so they stay flush.
177
216
  gutter = 1 if index < len(items) - 1 and not _bordered(item) else 0
178
- paint(item, row, x, max(0, child_width - gutter), height, out, term, color)
217
+ paint(item, row, x, max(0, child_width - gutter), height, out, term, palette)
179
218
  x += child_width
180
219
  return
181
220
 
@@ -183,25 +222,27 @@ def paint(tile, row, col, width, height, out, term, color) -> None:
183
222
  start = 0
184
223
  title = getattr(tile, "title", "") or ""
185
224
  if title and not bordered:
186
- _write(out, term, row, col, _pad(_fit(title, width), width), color)
225
+ _write(out, term, row, col, _pad(_fit(title, width), width), palette, KEY)
187
226
  start = 1
188
227
  if getattr(tile, "plain", False):
189
228
  return
190
229
  value = getattr(tile, "value", 0)
230
+ role = _bar_role(palette, tile)
191
231
  # Fill every row the layout gave us. View 2 stretches the E/P usage
192
232
  # gauges on purpose; the boxes with fixed content height (Memory) cap
193
233
  # theirs so this does not repeat a reading there.
194
234
  for line in range(start, height):
195
- _write(out, term, row + line, col, _hbar(value, width), color)
235
+ _write(out, term, row + line, col, _hbar(value, width), palette, role)
196
236
  elif name == "VGauge":
197
237
  start = 0
198
238
  title = getattr(tile, "title", "") or ""
199
239
  if title and not bordered:
200
- _write(out, term, row, col, _pad(_fit(title, width), width), color)
240
+ _write(out, term, row, col, _pad(_fit(title, width), width), palette, KEY)
201
241
  start = 1
202
242
  if getattr(tile, "plain", False):
203
243
  return
204
244
  value = getattr(tile, "value", 0)
245
+ role = _bar_role(palette, tile)
205
246
  inner = max(0, height - start)
206
247
  filled = inner * max(0.0, min(100.0, float(value))) / 100.0
207
248
  # A vertical bar, not full-width stripes: the height follows the value
@@ -219,24 +260,25 @@ def paint(tile, row, col, width, height, out, term, color) -> None:
219
260
  char = _VBARS[min(7, max(0, int(level * 8) - 1))]
220
261
  else:
221
262
  char = " "
222
- _write(out, term, row + line, bar_col, char * bar_width, color)
263
+ _write(out, term, row + line, bar_col, char * bar_width, palette, role)
223
264
  elif name == "HChart":
224
265
  start = 0
225
266
  title = getattr(tile, "title", "") or ""
226
267
  if title and not bordered:
227
- _write(out, term, row, col, _pad(_fit(title, width), width), color)
268
+ _write(out, term, row, col, _pad(_fit(title, width), width), palette, KEY)
228
269
  start = 1
229
- _chart(tile, row + start, col, width, height - start, out, term, color)
270
+ _chart(tile, row + start, col, width, height - start, out, term, palette)
230
271
  elif name == "SensorPanel":
231
- _sensor(tile, row, col, width, height, out, term, color)
272
+ _sensor(tile, row, col, width, height, out, term, palette)
232
273
  else:
233
274
  title = getattr(tile, "title", "") or ""
234
275
  if title:
235
- _write(out, term, row, col, _fit(title, width), color)
276
+ _write(out, term, row, col, _fit(title, width), palette, KEY)
236
277
 
237
278
 
238
279
  def render_tiles(tile, term, color) -> None:
239
280
  """Paint ``tile`` over the terminal, leaving the footer row free."""
281
+ palette = color if hasattr(color, "style") else UniformPalette(color)
240
282
  out: list = []
241
- paint(tile, 0, 0, term.width, max(1, term.height - 1), out, term, color)
283
+ paint(tile, 0, 0, term.width, max(1, term.height - 1), out, term, palette)
242
284
  print("".join(out), end="", flush=True)
@@ -147,6 +147,9 @@ class FootprintPoller:
147
147
  self._entries: dict = {}
148
148
  self._targets: dict = {}
149
149
  self._targets_at = 0.0
150
+ # Rotates the idle targets when there are more of them than
151
+ # MAX_TARGETS, so a process beyond the cap still gets measured.
152
+ self._rotation = 0
150
153
  self._lock = threading.Lock()
151
154
  self._stop = threading.Event()
152
155
  self._thread: Optional[threading.Thread] = None
@@ -186,9 +189,18 @@ class FootprintPoller:
186
189
 
187
190
  def poll_once(self) -> None:
188
191
  with self._lock:
189
- targets = sorted(
192
+ items = sorted(
190
193
  self._targets.items(), key=lambda item: (not item[1], item[0])
191
- )[: self.MAX_TARGETS]
194
+ )
195
+ busy = [item for item in items if item[1]]
196
+ idle = [item for item in items if not item[1]]
197
+ if len(items) > self.MAX_TARGETS and idle:
198
+ slots = max(0, self.MAX_TARGETS - len(busy))
199
+ if slots:
200
+ start = self._rotation % len(idle)
201
+ idle = idle[start:] + idle[:start]
202
+ self._rotation = (start + slots) % len(idle)
203
+ targets = (busy + idle)[: self.MAX_TARGETS]
192
204
  now = self._clock()
193
205
  for pid, busy in targets:
194
206
  if self._stop.is_set():