macpm 3.3.0__tar.gz → 3.4.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 (110) hide show
  1. {macpm-3.3.0 → macpm-3.4.0}/CHANGELOG.md +87 -0
  2. {macpm-3.3.0/macpm.egg-info → macpm-3.4.0}/PKG-INFO +123 -11
  3. {macpm-3.3.0 → macpm-3.4.0}/README.md +122 -10
  4. {macpm-3.3.0 → macpm-3.4.0}/RELEASE.md +14 -14
  5. macpm-3.4.0/docs/model-view-eval.md +606 -0
  6. {macpm-3.3.0 → macpm-3.4.0}/macpm/__init__.py +1 -1
  7. {macpm-3.3.0 → macpm-3.4.0}/macpm/gpuview.py +6 -3
  8. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/sampler.py +6 -7
  9. {macpm-3.3.0 → macpm-3.4.0}/macpm/macpm.py +123 -4
  10. {macpm-3.3.0 → macpm-3.4.0}/macpm/metrics.py +40 -6
  11. macpm-3.4.0/macpm/modelfeed.py +741 -0
  12. macpm-3.4.0/macpm/modellog.py +327 -0
  13. macpm-3.4.0/macpm/modelview.py +894 -0
  14. {macpm-3.3.0 → macpm-3.4.0}/macpm/sampler.py +13 -16
  15. macpm-3.4.0/macpm/serviceregistry.py +541 -0
  16. {macpm-3.3.0 → macpm-3.4.0}/macpm/theme.py +1 -1
  17. {macpm-3.3.0 → macpm-3.4.0/macpm.egg-info}/PKG-INFO +123 -11
  18. {macpm-3.3.0 → macpm-3.4.0}/macpm.egg-info/SOURCES.txt +16 -0
  19. {macpm-3.3.0 → macpm-3.4.0}/packaging/build.sh +4 -3
  20. {macpm-3.3.0 → macpm-3.4.0}/setup.py +1 -1
  21. macpm-3.4.0/tests/test_containerlog.py +61 -0
  22. macpm-3.4.0/tests/test_discovery_real.py +72 -0
  23. macpm-3.4.0/tests/test_gpudiscovery.py +64 -0
  24. {macpm-3.3.0 → macpm-3.4.0}/tests/test_gpuview.py +17 -2
  25. macpm-3.4.0/tests/test_kubelog.py +66 -0
  26. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_view.py +37 -0
  27. macpm-3.4.0/tests/test_modelfeed.py +466 -0
  28. macpm-3.4.0/tests/test_modellog.py +72 -0
  29. macpm-3.4.0/tests/test_modellog_vllm.py +36 -0
  30. macpm-3.4.0/tests/test_modelview.py +357 -0
  31. macpm-3.4.0/tests/test_netns.py +54 -0
  32. macpm-3.4.0/tests/test_power_panel.py +28 -0
  33. macpm-3.4.0/tests/test_sampler.py +78 -0
  34. macpm-3.4.0/tests/test_serviceregistry.py +169 -0
  35. macpm-3.3.0/tests/test_sampler.py +0 -35
  36. {macpm-3.3.0 → macpm-3.4.0}/LICENSE +0 -0
  37. {macpm-3.3.0 → macpm-3.4.0}/MANIFEST.in +0 -0
  38. {macpm-3.3.0 → macpm-3.4.0}/docs/linux-port.md +0 -0
  39. {macpm-3.3.0 → macpm-3.4.0}/macpm/__main__.py +0 -0
  40. {macpm-3.3.0 → macpm-3.4.0}/macpm/backend.py +0 -0
  41. {macpm-3.3.0 → macpm-3.4.0}/macpm/blessed_engine.py +0 -0
  42. {macpm-3.3.0 → macpm-3.4.0}/macpm/capabilities.py +0 -0
  43. {macpm-3.3.0 → macpm-3.4.0}/macpm/dump.py +0 -0
  44. {macpm-3.3.0 → macpm-3.4.0}/macpm/footprint.py +0 -0
  45. {macpm-3.3.0 → macpm-3.4.0}/macpm/ioreport.py +0 -0
  46. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/__init__.py +0 -0
  47. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/cpu.py +0 -0
  48. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/gpu.py +0 -0
  49. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/modelname.py +0 -0
  50. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/net.py +0 -0
  51. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/power.py +0 -0
  52. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/proc.py +0 -0
  53. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/soc.py +0 -0
  54. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/sysfs.py +0 -0
  55. {macpm-3.3.0 → macpm-3.4.0}/macpm/linux_backend/thermal.py +0 -0
  56. {macpm-3.3.0 → macpm-3.4.0}/macpm/macos_gpu.py +0 -0
  57. {macpm-3.3.0 → macpm-3.4.0}/macpm/netinfo.py +0 -0
  58. {macpm-3.3.0 → macpm-3.4.0}/macpm/netmodel.py +0 -0
  59. {macpm-3.3.0 → macpm-3.4.0}/macpm/network.py +0 -0
  60. {macpm-3.3.0 → macpm-3.4.0}/macpm/probe.py +0 -0
  61. {macpm-3.3.0 → macpm-3.4.0}/macpm/processes.py +0 -0
  62. {macpm-3.3.0 → macpm-3.4.0}/macpm/sensors.py +0 -0
  63. {macpm-3.3.0 → macpm-3.4.0}/macpm/smc.py +0 -0
  64. {macpm-3.3.0 → macpm-3.4.0}/macpm/soc.py +0 -0
  65. {macpm-3.3.0 → macpm-3.4.0}/macpm/tui.py +0 -0
  66. {macpm-3.3.0 → macpm-3.4.0}/macpm/widgets.py +0 -0
  67. {macpm-3.3.0 → macpm-3.4.0}/macpm.egg-info/dependency_links.txt +0 -0
  68. {macpm-3.3.0 → macpm-3.4.0}/macpm.egg-info/entry_points.txt +0 -0
  69. {macpm-3.3.0 → macpm-3.4.0}/macpm.egg-info/not-zip-safe +0 -0
  70. {macpm-3.3.0 → macpm-3.4.0}/macpm.egg-info/requires.txt +0 -0
  71. {macpm-3.3.0 → macpm-3.4.0}/macpm.egg-info/top_level.txt +0 -0
  72. {macpm-3.3.0 → macpm-3.4.0}/packaging/README-linux.txt +0 -0
  73. {macpm-3.3.0 → macpm-3.4.0}/packaging/README.txt +0 -0
  74. {macpm-3.3.0 → macpm-3.4.0}/packaging/build-linux.sh +0 -0
  75. {macpm-3.3.0 → macpm-3.4.0}/packaging/entry_tui.py +0 -0
  76. {macpm-3.3.0 → macpm-3.4.0}/packaging/install.sh +0 -0
  77. {macpm-3.3.0 → macpm-3.4.0}/packaging/linux/Dockerfile +0 -0
  78. {macpm-3.3.0 → macpm-3.4.0}/packaging/linux/README.txt +0 -0
  79. {macpm-3.3.0 → macpm-3.4.0}/packaging/macpm-linux.spec +0 -0
  80. {macpm-3.3.0 → macpm-3.4.0}/packaging/macpm.command +0 -0
  81. {macpm-3.3.0 → macpm-3.4.0}/pyproject.toml +0 -0
  82. {macpm-3.3.0 → macpm-3.4.0}/setup.cfg +0 -0
  83. {macpm-3.3.0 → macpm-3.4.0}/tests/__init__.py +0 -0
  84. {macpm-3.3.0 → macpm-3.4.0}/tests/linux_fixtures.py +0 -0
  85. {macpm-3.3.0 → macpm-3.4.0}/tests/test_ane.py +0 -0
  86. {macpm-3.3.0 → macpm-3.4.0}/tests/test_blessed_engine.py +0 -0
  87. {macpm-3.3.0 → macpm-3.4.0}/tests/test_calc_freq.py +0 -0
  88. {macpm-3.3.0 → macpm-3.4.0}/tests/test_cli.py +0 -0
  89. {macpm-3.3.0 → macpm-3.4.0}/tests/test_footprint.py +0 -0
  90. {macpm-3.3.0 → macpm-3.4.0}/tests/test_layout.py +0 -0
  91. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_cpu.py +0 -0
  92. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_gpu.py +0 -0
  93. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_ixsmi.py +0 -0
  94. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_modelname.py +0 -0
  95. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_net.py +0 -0
  96. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_nvidia.py +0 -0
  97. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_power.py +0 -0
  98. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_sampler.py +0 -0
  99. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_thermal.py +0 -0
  100. {macpm-3.3.0 → macpm-3.4.0}/tests/test_linux_wiring.py +0 -0
  101. {macpm-3.3.0 → macpm-3.4.0}/tests/test_macos_gpu.py +0 -0
  102. {macpm-3.3.0 → macpm-3.4.0}/tests/test_netinfo.py +0 -0
  103. {macpm-3.3.0 → macpm-3.4.0}/tests/test_network.py +0 -0
  104. {macpm-3.3.0 → macpm-3.4.0}/tests/test_probe.py +0 -0
  105. {macpm-3.3.0 → macpm-3.4.0}/tests/test_process_linux.py +0 -0
  106. {macpm-3.3.0 → macpm-3.4.0}/tests/test_processes.py +0 -0
  107. {macpm-3.3.0 → macpm-3.4.0}/tests/test_sampler_macos.py +0 -0
  108. {macpm-3.3.0 → macpm-3.4.0}/tests/test_sensors.py +0 -0
  109. {macpm-3.3.0 → macpm-3.4.0}/tests/test_theme.py +0 -0
  110. {macpm-3.3.0 → macpm-3.4.0}/tests/test_widgets.py +0 -0
@@ -1,5 +1,92 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.4.0 — 2026-11-28
4
+
5
+ ### Added
6
+ - Model view discovery is now organised around **network namespaces**: one
7
+ service per container/pod, with the launcher and its tensor-parallel workers
8
+ merged, while two servers of the same model on different cards stay two rows.
9
+ Candidates come from the process table, the vendor GPU table (pid → cards and
10
+ memory, no HTTP needed) and published container ports; `sudo -E macpm` also
11
+ resolves endpoints inside container namespaces via `/proc/<pid>/net/tcp`.
12
+ The model name and backend come from `GET /v1/models` (`id` and `owned_by`).
13
+ - Model view **log sources**: the Splash reader is joined by a generic file
14
+ tail, a re-run-and-dedupe command tail (`docker logs`), a Docker json-log
15
+ reader, the kubelet `/var/log/pods/.../0.log` lookup, the Kubernetes log API
16
+ (no kubectl on the node) and a plain HTTP log endpoint, chosen per backend
17
+ with `<PREFIX>_LOG`, `_LOG_CMD`, `_DOCKER`, `_POD`, `_K8S_POD` or `_LOG_URL`.
18
+ - Model view **multi-GPU numbers**: GPU load, VRAM, temperature and power are
19
+ aggregated over the cards the selected service holds (subtitle `2x NV RTX
20
+ 4090`); card names keep the brand and drop the marketing series; STATE is
21
+ refreshed for every row by a five-second `/v1/models` probe.
22
+ - A Chinese README (`README.zh-CN.md`) with a language switcher in both files.
23
+
24
+
25
+ - Model view (key `6`): lists the local model servers found in the process
26
+ table — vLLM, SGLang, llama.cpp, ollama, oMLX and Splash — with the model
27
+ name, endpoint and the processes behind each service. Discovery is
28
+ HTTP-free: a row appears when a launcher process is alive and its port
29
+ accepts a local TCP connection, and every row stays `unverified` until the
30
+ metrics feed lands. `↑/↓` selects, `s` sorts by port/backend/model, `Space`
31
+ pauses and `r` rescans; `--model-url host:port` adds an endpoint by hand.
32
+ - Model view metrics for **Splash** (`GET /status`: decode/prefill rates, TTFT
33
+ percentiles, active phases, context, KV, memory, thermal) and **oMLX**
34
+ (`GET /admin/api/activity`: the current model's active/waiting requests,
35
+ per-request decode speed and prefill progress, model memory). Only the
36
+ selected row is polled — once a second, 1.5 s deadline, 1 MiB cap — and a
37
+ `401`/`403` becomes `auth` instead of a blank row. Keys come from
38
+ `SPLASH_API_KEY` / `OMLX_API_KEY`.
39
+ - Model view metrics for **llama.cpp** (`/props` + `/metrics`: decode/prefill
40
+ rates, processing/deferred requests, slots, context high-water mark, generated
41
+ tokens; a server started without `--metrics` still shows its model and slots)
42
+ and **ollama** (`/api/ps`: loaded model, VRAM, unload countdown — rates stay
43
+ `--` because the endpoint has none). llama.cpp keys come from
44
+ `LLAMACPP_API_KEY`.
45
+ - Model view metrics for **vLLM** and **SGLang**: `/metrics` gauges for
46
+ running/waiting requests and KV usage, plus TTFT averages; since neither
47
+ exposes a tok/s gauge, decode and prefill rates are derived by diffing the
48
+ token counters between polls (the first poll shows `--` and says why).
49
+ - Model view `recent requests`: the feed reconstructs completions from
50
+ consecutive polls (a request id that disappears becomes a row with its
51
+ output tokens, rate and duration) and lists the newest three under the
52
+ metrics for Splash and oMLX; the row is labelled `recent` because it is
53
+ client-side derived, not server history.
54
+ - Model view `CARDS` / `VRAM` columns: services are mapped to the vendor GPU
55
+ table (pid → cards, summed memory) and the columns disappear when no vendor
56
+ table is available (macOS, DRM-only hosts).
57
+ - Model view card grid: a single service now shows metric cards above the
58
+ detail panel at any width ≥56 — four columns and all eight
59
+ (Speed, GPU load, VRAM, GPU temp, Power, Context, CPU, Disk) from 100
60
+ columns, two columns and the six model-relevant ones below that — with the
61
+ cards sourced from the existing IOReport/sysfs sample plus the feed's decode
62
+ rate. The detail card now sits above the grid, the grid fills the remaining
63
+ height, gauges carry the native warning colours and Speed / Disk scroll a
64
+ history chart instead of a progress bar.
65
+
66
+ ## 3.3.1 — 2026-11-25
67
+
68
+ ### Fixed
69
+
70
+ - GPU view: `s` now includes the process table's GPU-memory column on
71
+ single-card hosts (macOS, single-GPU Linux), where the sort cycle skipped it;
72
+ the `GPU MEM` header was widened so its `↓`/`↑` marker is not clipped.
73
+
74
+ - macOS power panel on macOS 27: an energy counter that stops reporting — the
75
+ CPU/ANE `Energy Model` channels do this without root on newer builds — now
76
+ falls back to `n/a` once its last ten samples were silent, instead of
77
+ showing `0.00W` forever. Its stale peak, average and maximum are cleared at
78
+ the same time.
79
+ - The Power box names the half that is still reporting (`Power (GPU only)` /
80
+ `Power (CPU only)`) instead of presenting a partial sum as package power.
81
+ - A counter that has not produced a first reading yet shows `CPU: —` / `GPU: —`
82
+ for the first frames instead of a misleading `0.00W`.
83
+
84
+ ### Changed
85
+
86
+ - Documented `--no-color`: it emits no foreground colour, uses the terminal's
87
+ own foreground, and can be paired with terminal themes and keyword
88
+ highlighting; it stays outside the `←`/`→` ring.
89
+
3
90
  ## 3.3.0 — 2026-11-20
4
91
 
5
92
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macpm
3
- Version: 3.3.0
3
+ Version: 3.4.0
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
@@ -42,6 +42,8 @@ Dynamic: summary
42
42
 
43
43
  # macpm
44
44
 
45
+ [English](README.md) · [简体中文](README.zh-CN.md)
46
+
45
47
  **Performance monitoring CLI for Apple Silicon — and now Linux.**<br>
46
48
  On macOS, macpm reads the same hardware counters as `powermetrics`, but through
47
49
  IOReport/IOKit/SMC — no `sudo`, no password, no privileged helper. On Linux it
@@ -52,6 +54,20 @@ A Python-based `nvtop`-inspired terminal monitor for Apple Silicon Macs,
52
54
  forked from [asitop](https://github.com/tlkh/asitop), with an x86_64/arm64
53
55
  Linux backend.
54
56
 
57
+ ## What's new in 3.4
58
+
59
+ - **Model view (key `6`)** for local LLM servers: vLLM, SGLang, llama.cpp,
60
+ ollama, oMLX and Splash. It discovers services from the process table, the
61
+ GPU table and published container ports, polls only the selected service,
62
+ and reads per-request rows from the server's own log when one is available.
63
+ See [Model view](#model-view).
64
+ - **Multi-GPU numbers are real numbers.** On an 8-card host the GPU boxes and
65
+ the service table now aggregate the cards a service actually holds, and card
66
+ names are normalised (`NV RTX 4090`).
67
+ - **Container-aware logs**: a `docker logs` command, a kubelet log file, the
68
+ Kubernetes API, or a container's json file — no kubectl required on the GPU
69
+ node.
70
+
55
71
  ## What's new in 3.3
56
72
 
57
73
  - **Built-in semantic colour theme.** The ninth `←`/`→` stop (`--native`)
@@ -126,6 +142,9 @@ Network view (press `4` while running):
126
142
  - GPU view (`5`) with utilisation, clock, power, VRAM, temperature and the
127
143
  processes using the GPU, ranked by GPU time; AMD/Intel cards also show each
128
144
  process's VRAM/GTT and the card it holds
145
+ - Model view (`6`) for local inference servers: model, decode/prefill rate,
146
+ KV and context use, time-to-first-token, recent requests and the cards the
147
+ service holds; see [Model view](#model-view)
129
148
  - Key-hint footer in every view; the default view puts the network identity
130
149
  (interface, CIDR, gateway, public IP and city) on the Network IO box's bottom
131
150
  border, and the key hints are a plain line below it
@@ -165,10 +184,11 @@ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [-
165
184
  | `--interval SECONDS` | Sampling and display interval (default `1`) |
166
185
  | `--color 1-8` | Display colour (default `2`) |
167
186
  | `--native` | Start in the built-in semantic colour theme |
168
- | `--no-color` | Use the terminal's default foreground (no accent colour) |
187
+ | `--no-color` | Emit no colour; use the terminal's default foreground (works with terminal themes and keyword highlighting) |
169
188
  | `--avg SECONDS` | Averaging window for power values (default `30`) |
170
189
  | `--show_cores [BOOL]` | Start in the per-core view |
171
190
  | `--no-public-ip` | Do not look up the public IP and location |
191
+ | `--model-url URL` | Extra model-service endpoint for the model view (repeatable) |
172
192
  | `--version` | Print the version |
173
193
 
174
194
  The default view also has a footer with the key hints. Keys:
@@ -176,10 +196,10 @@ The default view also has a footer with the key hints. Keys:
176
196
  ```text
177
197
  q / ESC quit
178
198
  ← / → change colour
179
- 1 / 2 / 3 / 4 / 5 default / per-core / process / network / GPU view
199
+ 1 / 2 / 3 / 4 / 5 / 6 default / per-core / process / network / GPU / model view
180
200
  s cycle the sort column (process / network / GPU view)
181
201
  ↑ / ↓ scroll the list or the focused network pane
182
- Space pause / resume the list (process / network / GPU view)
202
+ Space pause / resume the list (process / network / GPU / model view)
183
203
  Tab switch the focused network pane
184
204
  Ctrl+R reset peaks
185
205
  ```
@@ -198,8 +218,20 @@ single-card GPU tables only the header row and the current sort column are
198
218
  bright; the other normal cells stay dim. The palette uses fixed xterm-256
199
219
  indices (16-255), so it does not follow the terminal profile.
200
220
 
201
- `--no-color` is outside the ring: it keeps the terminal's default foreground
202
- for a monochrome setup or a terminal-side keyword highlighter.
221
+ ### No colour
222
+
223
+ `--no-color` emits no foreground colour at all: frames, labels, numbers, bars
224
+ and footer hints all use the terminal's default foreground. This is the mode
225
+ to combine with the terminal's own theme and keyword highlighting (iTerm2
226
+ `Triggers → Highlight Text`, NyaTerm `内置规则`, etc.), so numbers, errors or
227
+ IP addresses can be coloured by the terminal instead of macpm. It is outside
228
+ the `←`/`→` ring: pressing an arrow returns to a colour theme, and the flag wins
229
+ over `--color`/`--native` if both are given. Bars and frames stay readable
230
+ because they are drawn with block and box glyphs, not colour.
231
+
232
+ ```sh
233
+ macpm --no-color
234
+ ```
203
235
 
204
236
  | | |
205
237
  |---|---|
@@ -367,7 +399,7 @@ shows `n/a` and the reason stays in the data
367
399
 
368
400
  A single-GPU machine keeps the older layout: card summary on top, process table
369
401
  below. Every view's footer starts with the app name and version
370
- (`macpm v3.3.0 · q quit …`).
402
+ (`macpm v3.4.0 · q quit …`).
371
403
 
372
404
  ```text
373
405
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -381,7 +413,7 @@ below. Every view's footer starts with the app name and version
381
413
  │ └ 222 Xorg 2.0G │
382
414
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
383
415
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
384
- └ macpm v3.3.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
416
+ └ macpm v3.4.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
385
417
  ```
386
418
 
387
419
  | Platform | What fills each row |
@@ -458,6 +490,69 @@ Notes:
458
490
  - The default view's GPU gauge shows the busiest card and appends `(max of N)`
459
491
  when the machine has more than one.
460
492
 
493
+ ## Model view
494
+
495
+ Press `6` for the model-serving view. It answers "which models are being
496
+ served here, on which cards, and how fast are they right now" without asking
497
+ the servers anything until you select one.
498
+
499
+ **Discovery is HTTP-free.** Each service comes from one of three sources:
500
+
501
+ | Source | What it contributes |
502
+ |---|---|
503
+ | Process table | the launcher command line (`vllm serve …`, `sglang.launch_server …`, `llama-server`, `ollama serve`, oMLX, Splash) and its `--port` |
504
+ | GPU table | which cards and how much VRAM each card-holding PID owns, plus the served model name |
505
+ | Published container ports | `docker ps` port mappings, when the image identifies a backend |
506
+
507
+ Candidate rows are grouped by network namespace — a launcher and its tensor-
508
+ parallel workers are one service, while two servers of the same model on
509
+ different cards stay two rows. Endpoints are then resolved **inside that
510
+ namespace** (`/proc/<pid>/net/tcp`, descending into the container when run as
511
+ root) and confirmed with `GET /v1/models`: the model name and the backend come
512
+ from that answer (`id` and `owned_by`), never from a guess.
513
+
514
+ **Polling.** Only the selected service is polled (once per second); the rest
515
+ only get a cheap `/v1/models` probe every five seconds so the STATE column
516
+ stays meaningful. Nothing is written to any server.
517
+
518
+ **Per backend:**
519
+
520
+ | Backend | What it can read | Keys |
521
+ |---|---|---|
522
+ | Splash | `/status`, plus per-request rows from `~/Library/Logs/Splash/server.log` (prompt/output/cached tokens, TTFT, tok/s) | `SPLASH_LOG` |
523
+ | llama.cpp | `/props`, `/metrics`, `/slots` | — |
524
+ | vLLM | `/metrics` counters (prefill/decode rates, running/waiting, KV); the `Engine 000:` log line also provides prefix-cache hit rate and running counts | — |
525
+ | SGLang | `/metrics` + `/get_server_info` when enabled; otherwise the model only | — |
526
+ | oMLX | `/admin/api/activity` (current request only) | — |
527
+ | ollama | `/api/ps` — the loaded models, no throughput | — |
528
+
529
+ When a server does not expose `/metrics` (SGLang often ships with it off), the
530
+ view stays useful: model, endpoint, context limit and the GPU boxes remain, and
531
+ the note says `metrics endpoint unavailable` rather than pretending.
532
+
533
+ **Reading rows from a log file or a container** (optional, one variable per
534
+ backend, prefix `SPLASH_`, `VLLM_`, `SGLANG_`, `OLLAMA_`, `LLAMACPP_`):
535
+
536
+ ```sh
537
+ VLLM_LOG=/var/log/vllm/server.log # a file on this host
538
+ VLLM_LOG_CMD="docker logs --since=10s vllm-qwen" # any command, re-run and deduped
539
+ VLLM_DOCKER=vllm-qwen # docker inspect → its json log
540
+ VLLM_POD=deploy-model93 # newest /var/log/pods/…/0.log
541
+ VLLM_K8S_POD=deploy-model93 # the Kubernetes log API
542
+ K8S_APISERVER=https://10.0.0.1:6443 K8S_TOKEN=… # …with a token (kubeconfig works too)
543
+ VLLM_LOG_URL=http://127.0.0.1:8080/admin/api/logs # any text log endpoint
544
+ ```
545
+
546
+ **What the boxes show.** Decode and prefill rates, GPU load / VRAM / GPU
547
+ temperature / power for **the cards the selected service holds** (the subtitle
548
+ says how many, e.g. `2x NV RTX 4090`), context use and the recent-request list.
549
+ Cards whose PIDs cannot be attributed fall back to all cards, and the subtitle
550
+ then says so by listing the full count.
551
+
552
+ **Manual endpoints.** `--model-url host:port` adds a service that discovery
553
+ missed (repeatable), which is the escape hatch for a server that only listens
554
+ inside another namespace.
555
+
461
556
  ## Compatibility
462
557
 
463
558
  Tested on macOS 27.2 with an M3 Max. Behaviour depends more on the chip
@@ -677,9 +772,12 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
677
772
  - **`macpm: command not found`** — add your Python user-base `bin` directory to
678
773
  `PATH`, or run `python3 -m macpm`.
679
774
  - **Power readings freeze or show `n/a` on macOS 27** — some builds restrict
680
- unprivileged `Energy Model` refreshes. CPU/GPU usage and frequency still
681
- work; a counter that never reports is shown as `n/a` instead of `0.00W`.
682
- Run `macpm-dump` to inspect the raw values.
775
+ unprivileged `Energy Model` refreshes, and the CPU/ANE channels can stop
776
+ updating while the GPU one keeps working. CPU/GPU usage and frequency still
777
+ work; a counter that has been silent for ten samples is shown as `n/a`
778
+ instead of `0.00W`, and the Power box then reads `Power (GPU only)`. The
779
+ first frames of a session show `CPU: —` until a counter reports once. Run
780
+ `macpm-dump` to inspect the raw values.
683
781
  - **M5/Ultra values look wrong** — CPU tier/channel mapping is not complete;
684
782
  see the compatibility table.
685
783
  - **The Temps & Fans box says `SMC unavailable`** — the AppleSMC user client
@@ -708,6 +806,20 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
708
806
  install with `pip install --user`, or fix the modes (`sudo chmod -R a+rX
709
807
  /usr/local/lib/python3.*/dist-packages/macpm*` and the dependencies).
710
808
 
809
+ - **Model view lists nothing** — discovery needs to see the launcher process or
810
+ the GPU table. In a container on a node where you are not root, run
811
+ `sudo -E macpm` so `/proc/<pid>/net/tcp` and `nvidia-smi` are complete; a
812
+ service that still cannot be found can be added with `--model-url host:port`.
813
+ - **Model view shows `?` instead of an endpoint** — the port could not be
814
+ resolved inside that namespace (no permission) or no API answered. The GPU
815
+ data is still real; the row becomes pollable once `--model-url` names it.
816
+ - **Selected model shows `metrics endpoint unavailable`** — the server answered
817
+ `/v1/models` but not `/metrics` (common with SGLang). Start the backend with
818
+ metrics enabled to get rates; the model, context limit and GPU boxes work
819
+ regardless.
820
+ - **`STATE` stays `unverified`** — the five-second `/v1/models` probe cannot
821
+ reach that pod IP from this host; the selected row will also fail to poll.
822
+
711
823
  ## Changelog
712
824
 
713
825
  See [CHANGELOG.md](https://github.com/visualcjy/macpm/blob/main/CHANGELOG.md). The 2.0 release removes the dependency on
@@ -1,5 +1,7 @@
1
1
  # macpm
2
2
 
3
+ [English](README.md) · [简体中文](README.zh-CN.md)
4
+
3
5
  **Performance monitoring CLI for Apple Silicon — and now Linux.**<br>
4
6
  On macOS, macpm reads the same hardware counters as `powermetrics`, but through
5
7
  IOReport/IOKit/SMC — no `sudo`, no password, no privileged helper. On Linux it
@@ -10,6 +12,20 @@ A Python-based `nvtop`-inspired terminal monitor for Apple Silicon Macs,
10
12
  forked from [asitop](https://github.com/tlkh/asitop), with an x86_64/arm64
11
13
  Linux backend.
12
14
 
15
+ ## What's new in 3.4
16
+
17
+ - **Model view (key `6`)** for local LLM servers: vLLM, SGLang, llama.cpp,
18
+ ollama, oMLX and Splash. It discovers services from the process table, the
19
+ GPU table and published container ports, polls only the selected service,
20
+ and reads per-request rows from the server's own log when one is available.
21
+ See [Model view](#model-view).
22
+ - **Multi-GPU numbers are real numbers.** On an 8-card host the GPU boxes and
23
+ the service table now aggregate the cards a service actually holds, and card
24
+ names are normalised (`NV RTX 4090`).
25
+ - **Container-aware logs**: a `docker logs` command, a kubelet log file, the
26
+ Kubernetes API, or a container's json file — no kubectl required on the GPU
27
+ node.
28
+
13
29
  ## What's new in 3.3
14
30
 
15
31
  - **Built-in semantic colour theme.** The ninth `←`/`→` stop (`--native`)
@@ -84,6 +100,9 @@ Network view (press `4` while running):
84
100
  - GPU view (`5`) with utilisation, clock, power, VRAM, temperature and the
85
101
  processes using the GPU, ranked by GPU time; AMD/Intel cards also show each
86
102
  process's VRAM/GTT and the card it holds
103
+ - Model view (`6`) for local inference servers: model, decode/prefill rate,
104
+ KV and context use, time-to-first-token, recent requests and the cards the
105
+ service holds; see [Model view](#model-view)
87
106
  - Key-hint footer in every view; the default view puts the network identity
88
107
  (interface, CIDR, gateway, public IP and city) on the Network IO box's bottom
89
108
  border, and the key hints are a plain line below it
@@ -123,10 +142,11 @@ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [-
123
142
  | `--interval SECONDS` | Sampling and display interval (default `1`) |
124
143
  | `--color 1-8` | Display colour (default `2`) |
125
144
  | `--native` | Start in the built-in semantic colour theme |
126
- | `--no-color` | Use the terminal's default foreground (no accent colour) |
145
+ | `--no-color` | Emit no colour; use the terminal's default foreground (works with terminal themes and keyword highlighting) |
127
146
  | `--avg SECONDS` | Averaging window for power values (default `30`) |
128
147
  | `--show_cores [BOOL]` | Start in the per-core view |
129
148
  | `--no-public-ip` | Do not look up the public IP and location |
149
+ | `--model-url URL` | Extra model-service endpoint for the model view (repeatable) |
130
150
  | `--version` | Print the version |
131
151
 
132
152
  The default view also has a footer with the key hints. Keys:
@@ -134,10 +154,10 @@ The default view also has a footer with the key hints. Keys:
134
154
  ```text
135
155
  q / ESC quit
136
156
  ← / → change colour
137
- 1 / 2 / 3 / 4 / 5 default / per-core / process / network / GPU view
157
+ 1 / 2 / 3 / 4 / 5 / 6 default / per-core / process / network / GPU / model view
138
158
  s cycle the sort column (process / network / GPU view)
139
159
  ↑ / ↓ scroll the list or the focused network pane
140
- Space pause / resume the list (process / network / GPU view)
160
+ Space pause / resume the list (process / network / GPU / model view)
141
161
  Tab switch the focused network pane
142
162
  Ctrl+R reset peaks
143
163
  ```
@@ -156,8 +176,20 @@ single-card GPU tables only the header row and the current sort column are
156
176
  bright; the other normal cells stay dim. The palette uses fixed xterm-256
157
177
  indices (16-255), so it does not follow the terminal profile.
158
178
 
159
- `--no-color` is outside the ring: it keeps the terminal's default foreground
160
- for a monochrome setup or a terminal-side keyword highlighter.
179
+ ### No colour
180
+
181
+ `--no-color` emits no foreground colour at all: frames, labels, numbers, bars
182
+ and footer hints all use the terminal's default foreground. This is the mode
183
+ to combine with the terminal's own theme and keyword highlighting (iTerm2
184
+ `Triggers → Highlight Text`, NyaTerm `内置规则`, etc.), so numbers, errors or
185
+ IP addresses can be coloured by the terminal instead of macpm. It is outside
186
+ the `←`/`→` ring: pressing an arrow returns to a colour theme, and the flag wins
187
+ over `--color`/`--native` if both are given. Bars and frames stay readable
188
+ because they are drawn with block and box glyphs, not colour.
189
+
190
+ ```sh
191
+ macpm --no-color
192
+ ```
161
193
 
162
194
  | | |
163
195
  |---|---|
@@ -325,7 +357,7 @@ shows `n/a` and the reason stays in the data
325
357
 
326
358
  A single-GPU machine keeps the older layout: card summary on top, process table
327
359
  below. Every view's footer starts with the app name and version
328
- (`macpm v3.3.0 · q quit …`).
360
+ (`macpm v3.4.0 · q quit …`).
329
361
 
330
362
  ```text
331
363
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -339,7 +371,7 @@ below. Every view's footer starts with the app name and version
339
371
  │ └ 222 Xorg 2.0G │
340
372
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
341
373
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
342
- └ macpm v3.3.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
374
+ └ macpm v3.4.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
343
375
  ```
344
376
 
345
377
  | Platform | What fills each row |
@@ -416,6 +448,69 @@ Notes:
416
448
  - The default view's GPU gauge shows the busiest card and appends `(max of N)`
417
449
  when the machine has more than one.
418
450
 
451
+ ## Model view
452
+
453
+ Press `6` for the model-serving view. It answers "which models are being
454
+ served here, on which cards, and how fast are they right now" without asking
455
+ the servers anything until you select one.
456
+
457
+ **Discovery is HTTP-free.** Each service comes from one of three sources:
458
+
459
+ | Source | What it contributes |
460
+ |---|---|
461
+ | Process table | the launcher command line (`vllm serve …`, `sglang.launch_server …`, `llama-server`, `ollama serve`, oMLX, Splash) and its `--port` |
462
+ | GPU table | which cards and how much VRAM each card-holding PID owns, plus the served model name |
463
+ | Published container ports | `docker ps` port mappings, when the image identifies a backend |
464
+
465
+ Candidate rows are grouped by network namespace — a launcher and its tensor-
466
+ parallel workers are one service, while two servers of the same model on
467
+ different cards stay two rows. Endpoints are then resolved **inside that
468
+ namespace** (`/proc/<pid>/net/tcp`, descending into the container when run as
469
+ root) and confirmed with `GET /v1/models`: the model name and the backend come
470
+ from that answer (`id` and `owned_by`), never from a guess.
471
+
472
+ **Polling.** Only the selected service is polled (once per second); the rest
473
+ only get a cheap `/v1/models` probe every five seconds so the STATE column
474
+ stays meaningful. Nothing is written to any server.
475
+
476
+ **Per backend:**
477
+
478
+ | Backend | What it can read | Keys |
479
+ |---|---|---|
480
+ | Splash | `/status`, plus per-request rows from `~/Library/Logs/Splash/server.log` (prompt/output/cached tokens, TTFT, tok/s) | `SPLASH_LOG` |
481
+ | llama.cpp | `/props`, `/metrics`, `/slots` | — |
482
+ | vLLM | `/metrics` counters (prefill/decode rates, running/waiting, KV); the `Engine 000:` log line also provides prefix-cache hit rate and running counts | — |
483
+ | SGLang | `/metrics` + `/get_server_info` when enabled; otherwise the model only | — |
484
+ | oMLX | `/admin/api/activity` (current request only) | — |
485
+ | ollama | `/api/ps` — the loaded models, no throughput | — |
486
+
487
+ When a server does not expose `/metrics` (SGLang often ships with it off), the
488
+ view stays useful: model, endpoint, context limit and the GPU boxes remain, and
489
+ the note says `metrics endpoint unavailable` rather than pretending.
490
+
491
+ **Reading rows from a log file or a container** (optional, one variable per
492
+ backend, prefix `SPLASH_`, `VLLM_`, `SGLANG_`, `OLLAMA_`, `LLAMACPP_`):
493
+
494
+ ```sh
495
+ VLLM_LOG=/var/log/vllm/server.log # a file on this host
496
+ VLLM_LOG_CMD="docker logs --since=10s vllm-qwen" # any command, re-run and deduped
497
+ VLLM_DOCKER=vllm-qwen # docker inspect → its json log
498
+ VLLM_POD=deploy-model93 # newest /var/log/pods/…/0.log
499
+ VLLM_K8S_POD=deploy-model93 # the Kubernetes log API
500
+ K8S_APISERVER=https://10.0.0.1:6443 K8S_TOKEN=… # …with a token (kubeconfig works too)
501
+ VLLM_LOG_URL=http://127.0.0.1:8080/admin/api/logs # any text log endpoint
502
+ ```
503
+
504
+ **What the boxes show.** Decode and prefill rates, GPU load / VRAM / GPU
505
+ temperature / power for **the cards the selected service holds** (the subtitle
506
+ says how many, e.g. `2x NV RTX 4090`), context use and the recent-request list.
507
+ Cards whose PIDs cannot be attributed fall back to all cards, and the subtitle
508
+ then says so by listing the full count.
509
+
510
+ **Manual endpoints.** `--model-url host:port` adds a service that discovery
511
+ missed (repeatable), which is the escape hatch for a server that only listens
512
+ inside another namespace.
513
+
419
514
  ## Compatibility
420
515
 
421
516
  Tested on macOS 27.2 with an M3 Max. Behaviour depends more on the chip
@@ -635,9 +730,12 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
635
730
  - **`macpm: command not found`** — add your Python user-base `bin` directory to
636
731
  `PATH`, or run `python3 -m macpm`.
637
732
  - **Power readings freeze or show `n/a` on macOS 27** — some builds restrict
638
- unprivileged `Energy Model` refreshes. CPU/GPU usage and frequency still
639
- work; a counter that never reports is shown as `n/a` instead of `0.00W`.
640
- Run `macpm-dump` to inspect the raw values.
733
+ unprivileged `Energy Model` refreshes, and the CPU/ANE channels can stop
734
+ updating while the GPU one keeps working. CPU/GPU usage and frequency still
735
+ work; a counter that has been silent for ten samples is shown as `n/a`
736
+ instead of `0.00W`, and the Power box then reads `Power (GPU only)`. The
737
+ first frames of a session show `CPU: —` until a counter reports once. Run
738
+ `macpm-dump` to inspect the raw values.
641
739
  - **M5/Ultra values look wrong** — CPU tier/channel mapping is not complete;
642
740
  see the compatibility table.
643
741
  - **The Temps & Fans box says `SMC unavailable`** — the AppleSMC user client
@@ -666,6 +764,20 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
666
764
  install with `pip install --user`, or fix the modes (`sudo chmod -R a+rX
667
765
  /usr/local/lib/python3.*/dist-packages/macpm*` and the dependencies).
668
766
 
767
+ - **Model view lists nothing** — discovery needs to see the launcher process or
768
+ the GPU table. In a container on a node where you are not root, run
769
+ `sudo -E macpm` so `/proc/<pid>/net/tcp` and `nvidia-smi` are complete; a
770
+ service that still cannot be found can be added with `--model-url host:port`.
771
+ - **Model view shows `?` instead of an endpoint** — the port could not be
772
+ resolved inside that namespace (no permission) or no API answered. The GPU
773
+ data is still real; the row becomes pollable once `--model-url` names it.
774
+ - **Selected model shows `metrics endpoint unavailable`** — the server answered
775
+ `/v1/models` but not `/metrics` (common with SGLang). Start the backend with
776
+ metrics enabled to get rates; the model, context limit and GPU boxes work
777
+ regardless.
778
+ - **`STATE` stays `unverified`** — the five-second `/v1/models` probe cannot
779
+ reach that pod IP from this host; the selected row will also fail to poll.
780
+
669
781
  ## Changelog
670
782
 
671
783
  See [CHANGELOG.md](https://github.com/visualcjy/macpm/blob/main/CHANGELOG.md). The 2.0 release removes the dependency on
@@ -1,4 +1,4 @@
1
- # Releasing macpm 3.3.0
1
+ # Releasing macpm 3.4.0
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.3.0` in:
10
+ - Version is `3.4.0` 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.3.0` entry.
14
+ - `CHANGELOG.md` has the `3.4.0` 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.3.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.3.0.tar.gz dist/macpm-3.3.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.3.0
87
+ python3 -m pip install --upgrade macpm==3.4.0
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.3.0: built-in semantic colour theme"
97
- git tag -a v3.3.0 -m "macpm 3.3.0"
96
+ git commit -m "Release macpm 3.4.0: macOS 27 power fallback and GPU sort fixes"
97
+ git tag -a v3.3.1 -m "macpm 3.4.0"
98
98
  git push origin main
99
- git push origin v3.3.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.3.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.3.0-linux-x86_64.tar.gz
152
- dist/macpm-3.3.0-linux-aarch64.tar.gz
153
- dist/macpm_3.3.0_amd64.deb
154
- dist/macpm_3.3.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