macpm 3.3.1__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 (109) hide show
  1. {macpm-3.3.1 → macpm-3.4.0}/CHANGELOG.md +63 -0
  2. {macpm-3.3.1/macpm.egg-info → macpm-3.4.0}/PKG-INFO +102 -5
  3. {macpm-3.3.1 → macpm-3.4.0}/README.md +101 -4
  4. {macpm-3.3.1 → macpm-3.4.0}/RELEASE.md +6 -6
  5. macpm-3.4.0/docs/model-view-eval.md +606 -0
  6. {macpm-3.3.1 → macpm-3.4.0}/macpm/__init__.py +1 -1
  7. {macpm-3.3.1 → macpm-3.4.0}/macpm/macpm.py +74 -2
  8. macpm-3.4.0/macpm/modelfeed.py +741 -0
  9. macpm-3.4.0/macpm/modellog.py +327 -0
  10. macpm-3.4.0/macpm/modelview.py +894 -0
  11. macpm-3.4.0/macpm/serviceregistry.py +541 -0
  12. {macpm-3.3.1 → macpm-3.4.0}/macpm/theme.py +1 -1
  13. {macpm-3.3.1 → macpm-3.4.0/macpm.egg-info}/PKG-INFO +102 -5
  14. {macpm-3.3.1 → macpm-3.4.0}/macpm.egg-info/SOURCES.txt +15 -0
  15. {macpm-3.3.1 → macpm-3.4.0}/packaging/build.sh +4 -3
  16. {macpm-3.3.1 → macpm-3.4.0}/setup.py +1 -1
  17. macpm-3.4.0/tests/test_containerlog.py +61 -0
  18. macpm-3.4.0/tests/test_discovery_real.py +72 -0
  19. macpm-3.4.0/tests/test_gpudiscovery.py +64 -0
  20. macpm-3.4.0/tests/test_kubelog.py +66 -0
  21. macpm-3.4.0/tests/test_modelfeed.py +466 -0
  22. macpm-3.4.0/tests/test_modellog.py +72 -0
  23. macpm-3.4.0/tests/test_modellog_vllm.py +36 -0
  24. macpm-3.4.0/tests/test_modelview.py +357 -0
  25. macpm-3.4.0/tests/test_netns.py +54 -0
  26. macpm-3.4.0/tests/test_serviceregistry.py +169 -0
  27. {macpm-3.3.1 → macpm-3.4.0}/LICENSE +0 -0
  28. {macpm-3.3.1 → macpm-3.4.0}/MANIFEST.in +0 -0
  29. {macpm-3.3.1 → macpm-3.4.0}/docs/linux-port.md +0 -0
  30. {macpm-3.3.1 → macpm-3.4.0}/macpm/__main__.py +0 -0
  31. {macpm-3.3.1 → macpm-3.4.0}/macpm/backend.py +0 -0
  32. {macpm-3.3.1 → macpm-3.4.0}/macpm/blessed_engine.py +0 -0
  33. {macpm-3.3.1 → macpm-3.4.0}/macpm/capabilities.py +0 -0
  34. {macpm-3.3.1 → macpm-3.4.0}/macpm/dump.py +0 -0
  35. {macpm-3.3.1 → macpm-3.4.0}/macpm/footprint.py +0 -0
  36. {macpm-3.3.1 → macpm-3.4.0}/macpm/gpuview.py +0 -0
  37. {macpm-3.3.1 → macpm-3.4.0}/macpm/ioreport.py +0 -0
  38. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/__init__.py +0 -0
  39. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/cpu.py +0 -0
  40. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/gpu.py +0 -0
  41. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/modelname.py +0 -0
  42. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/net.py +0 -0
  43. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/power.py +0 -0
  44. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/proc.py +0 -0
  45. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/sampler.py +0 -0
  46. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/soc.py +0 -0
  47. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/sysfs.py +0 -0
  48. {macpm-3.3.1 → macpm-3.4.0}/macpm/linux_backend/thermal.py +0 -0
  49. {macpm-3.3.1 → macpm-3.4.0}/macpm/macos_gpu.py +0 -0
  50. {macpm-3.3.1 → macpm-3.4.0}/macpm/metrics.py +0 -0
  51. {macpm-3.3.1 → macpm-3.4.0}/macpm/netinfo.py +0 -0
  52. {macpm-3.3.1 → macpm-3.4.0}/macpm/netmodel.py +0 -0
  53. {macpm-3.3.1 → macpm-3.4.0}/macpm/network.py +0 -0
  54. {macpm-3.3.1 → macpm-3.4.0}/macpm/probe.py +0 -0
  55. {macpm-3.3.1 → macpm-3.4.0}/macpm/processes.py +0 -0
  56. {macpm-3.3.1 → macpm-3.4.0}/macpm/sampler.py +0 -0
  57. {macpm-3.3.1 → macpm-3.4.0}/macpm/sensors.py +0 -0
  58. {macpm-3.3.1 → macpm-3.4.0}/macpm/smc.py +0 -0
  59. {macpm-3.3.1 → macpm-3.4.0}/macpm/soc.py +0 -0
  60. {macpm-3.3.1 → macpm-3.4.0}/macpm/tui.py +0 -0
  61. {macpm-3.3.1 → macpm-3.4.0}/macpm/widgets.py +0 -0
  62. {macpm-3.3.1 → macpm-3.4.0}/macpm.egg-info/dependency_links.txt +0 -0
  63. {macpm-3.3.1 → macpm-3.4.0}/macpm.egg-info/entry_points.txt +0 -0
  64. {macpm-3.3.1 → macpm-3.4.0}/macpm.egg-info/not-zip-safe +0 -0
  65. {macpm-3.3.1 → macpm-3.4.0}/macpm.egg-info/requires.txt +0 -0
  66. {macpm-3.3.1 → macpm-3.4.0}/macpm.egg-info/top_level.txt +0 -0
  67. {macpm-3.3.1 → macpm-3.4.0}/packaging/README-linux.txt +0 -0
  68. {macpm-3.3.1 → macpm-3.4.0}/packaging/README.txt +0 -0
  69. {macpm-3.3.1 → macpm-3.4.0}/packaging/build-linux.sh +0 -0
  70. {macpm-3.3.1 → macpm-3.4.0}/packaging/entry_tui.py +0 -0
  71. {macpm-3.3.1 → macpm-3.4.0}/packaging/install.sh +0 -0
  72. {macpm-3.3.1 → macpm-3.4.0}/packaging/linux/Dockerfile +0 -0
  73. {macpm-3.3.1 → macpm-3.4.0}/packaging/linux/README.txt +0 -0
  74. {macpm-3.3.1 → macpm-3.4.0}/packaging/macpm-linux.spec +0 -0
  75. {macpm-3.3.1 → macpm-3.4.0}/packaging/macpm.command +0 -0
  76. {macpm-3.3.1 → macpm-3.4.0}/pyproject.toml +0 -0
  77. {macpm-3.3.1 → macpm-3.4.0}/setup.cfg +0 -0
  78. {macpm-3.3.1 → macpm-3.4.0}/tests/__init__.py +0 -0
  79. {macpm-3.3.1 → macpm-3.4.0}/tests/linux_fixtures.py +0 -0
  80. {macpm-3.3.1 → macpm-3.4.0}/tests/test_ane.py +0 -0
  81. {macpm-3.3.1 → macpm-3.4.0}/tests/test_blessed_engine.py +0 -0
  82. {macpm-3.3.1 → macpm-3.4.0}/tests/test_calc_freq.py +0 -0
  83. {macpm-3.3.1 → macpm-3.4.0}/tests/test_cli.py +0 -0
  84. {macpm-3.3.1 → macpm-3.4.0}/tests/test_footprint.py +0 -0
  85. {macpm-3.3.1 → macpm-3.4.0}/tests/test_gpuview.py +0 -0
  86. {macpm-3.3.1 → macpm-3.4.0}/tests/test_layout.py +0 -0
  87. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_cpu.py +0 -0
  88. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_gpu.py +0 -0
  89. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_ixsmi.py +0 -0
  90. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_modelname.py +0 -0
  91. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_net.py +0 -0
  92. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_nvidia.py +0 -0
  93. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_power.py +0 -0
  94. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_sampler.py +0 -0
  95. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_thermal.py +0 -0
  96. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_view.py +0 -0
  97. {macpm-3.3.1 → macpm-3.4.0}/tests/test_linux_wiring.py +0 -0
  98. {macpm-3.3.1 → macpm-3.4.0}/tests/test_macos_gpu.py +0 -0
  99. {macpm-3.3.1 → macpm-3.4.0}/tests/test_netinfo.py +0 -0
  100. {macpm-3.3.1 → macpm-3.4.0}/tests/test_network.py +0 -0
  101. {macpm-3.3.1 → macpm-3.4.0}/tests/test_power_panel.py +0 -0
  102. {macpm-3.3.1 → macpm-3.4.0}/tests/test_probe.py +0 -0
  103. {macpm-3.3.1 → macpm-3.4.0}/tests/test_process_linux.py +0 -0
  104. {macpm-3.3.1 → macpm-3.4.0}/tests/test_processes.py +0 -0
  105. {macpm-3.3.1 → macpm-3.4.0}/tests/test_sampler.py +0 -0
  106. {macpm-3.3.1 → macpm-3.4.0}/tests/test_sampler_macos.py +0 -0
  107. {macpm-3.3.1 → macpm-3.4.0}/tests/test_sensors.py +0 -0
  108. {macpm-3.3.1 → macpm-3.4.0}/tests/test_theme.py +0 -0
  109. {macpm-3.3.1 → macpm-3.4.0}/tests/test_widgets.py +0 -0
@@ -1,5 +1,68 @@
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
+
3
66
  ## 3.3.1 — 2026-11-25
4
67
 
5
68
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macpm
3
- Version: 3.3.1
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
@@ -169,6 +188,7 @@ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [-
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
  ```
@@ -379,7 +399,7 @@ shows `n/a` and the reason stays in the data
379
399
 
380
400
  A single-GPU machine keeps the older layout: card summary on top, process table
381
401
  below. Every view's footer starts with the app name and version
382
- (`macpm v3.3.1 · q quit …`).
402
+ (`macpm v3.4.0 · q quit …`).
383
403
 
384
404
  ```text
385
405
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -393,7 +413,7 @@ below. Every view's footer starts with the app name and version
393
413
  │ └ 222 Xorg 2.0G │
394
414
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
395
415
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
396
- └ macpm v3.3.1 · 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 ────────────────┘
397
417
  ```
398
418
 
399
419
  | Platform | What fills each row |
@@ -470,6 +490,69 @@ Notes:
470
490
  - The default view's GPU gauge shows the busiest card and appends `(max of N)`
471
491
  when the machine has more than one.
472
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
+
473
556
  ## Compatibility
474
557
 
475
558
  Tested on macOS 27.2 with an M3 Max. Behaviour depends more on the chip
@@ -723,6 +806,20 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
723
806
  install with `pip install --user`, or fix the modes (`sudo chmod -R a+rX
724
807
  /usr/local/lib/python3.*/dist-packages/macpm*` and the dependencies).
725
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
+
726
823
  ## Changelog
727
824
 
728
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
@@ -127,6 +146,7 @@ macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [-
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
  ```
@@ -337,7 +357,7 @@ shows `n/a` and the reason stays in the data
337
357
 
338
358
  A single-GPU machine keeps the older layout: card summary on top, process table
339
359
  below. Every view's footer starts with the app name and version
340
- (`macpm v3.3.1 · q quit …`).
360
+ (`macpm v3.4.0 · q quit …`).
341
361
 
342
362
  ```text
343
363
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -351,7 +371,7 @@ below. Every view's footer starts with the app name and version
351
371
  │ └ 222 Xorg 2.0G │
352
372
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
353
373
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
354
- └ macpm v3.3.1 · 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 ────────────────┘
355
375
  ```
356
376
 
357
377
  | Platform | What fills each row |
@@ -428,6 +448,69 @@ Notes:
428
448
  - The default view's GPU gauge shows the busiest card and appends `(max of N)`
429
449
  when the machine has more than one.
430
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
+
431
514
  ## Compatibility
432
515
 
433
516
  Tested on macOS 27.2 with an M3 Max. Behaviour depends more on the chip
@@ -681,6 +764,20 @@ Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/
681
764
  install with `pip install --user`, or fix the modes (`sudo chmod -R a+rX
682
765
  /usr/local/lib/python3.*/dist-packages/macpm*` and the dependencies).
683
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
+
684
781
  ## Changelog
685
782
 
686
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.1
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.1` 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.1` entry.
14
+ - `CHANGELOG.md` has the `3.4.0` entry.
15
15
 
16
16
  ## 2. Test from source
17
17
 
@@ -84,7 +84,7 @@ python3 -m twine upload --non-interactive \
84
84
  Then verify:
85
85
 
86
86
  ```sh
87
- python3 -m pip install --upgrade macpm==3.3.1
87
+ python3 -m pip install --upgrade macpm==3.4.0
88
88
  macpm --version
89
89
  ```
90
90
 
@@ -93,8 +93,8 @@ 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.1: macOS 27 power fallback and GPU sort fixes"
97
- git tag -a v3.3.1 -m "macpm 3.3.1"
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
99
  git push origin v3.3.1
100
100
  ```