macpm 3.0.2__tar.gz → 3.1.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 (85) hide show
  1. {macpm-3.0.2 → macpm-3.1.0}/CHANGELOG.md +40 -0
  2. {macpm-3.0.2/macpm.egg-info → macpm-3.1.0}/PKG-INFO +4 -4
  3. {macpm-3.0.2 → macpm-3.1.0}/README.md +2 -2
  4. {macpm-3.0.2 → macpm-3.1.0}/RELEASE.md +9 -9
  5. {macpm-3.0.2 → macpm-3.1.0}/macpm/__init__.py +1 -1
  6. macpm-3.1.0/macpm/blessed_engine.py +228 -0
  7. {macpm-3.0.2 → macpm-3.1.0}/macpm/gpuview.py +41 -9
  8. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/gpu.py +119 -50
  9. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/net.py +17 -2
  10. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/sampler.py +7 -1
  11. {macpm-3.0.2 → macpm-3.1.0}/macpm/macpm.py +189 -197
  12. {macpm-3.0.2 → macpm-3.1.0}/macpm/network.py +28 -6
  13. {macpm-3.0.2 → macpm-3.1.0}/macpm/processes.py +126 -1
  14. macpm-3.1.0/macpm/widgets.py +135 -0
  15. {macpm-3.0.2 → macpm-3.1.0/macpm.egg-info}/PKG-INFO +4 -4
  16. {macpm-3.0.2 → macpm-3.1.0}/macpm.egg-info/SOURCES.txt +6 -2
  17. {macpm-3.0.2 → macpm-3.1.0}/macpm.egg-info/requires.txt +1 -1
  18. {macpm-3.0.2 → macpm-3.1.0}/setup.py +2 -2
  19. macpm-3.1.0/tests/test_blessed_engine.py +78 -0
  20. {macpm-3.0.2 → macpm-3.1.0}/tests/test_cli.py +1 -1
  21. {macpm-3.0.2 → macpm-3.1.0}/tests/test_gpuview.py +82 -2
  22. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_gpu.py +24 -1
  23. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_net.py +17 -0
  24. {macpm-3.0.2 → macpm-3.1.0}/tests/test_network.py +23 -0
  25. macpm-3.1.0/tests/test_process_linux.py +41 -0
  26. macpm-3.1.0/tests/test_widgets.py +61 -0
  27. macpm-3.0.2/tests/test_dashing_compat.py +0 -113
  28. {macpm-3.0.2 → macpm-3.1.0}/LICENSE +0 -0
  29. {macpm-3.0.2 → macpm-3.1.0}/MANIFEST.in +0 -0
  30. {macpm-3.0.2 → macpm-3.1.0}/docs/linux-port.md +0 -0
  31. {macpm-3.0.2 → macpm-3.1.0}/macpm/__main__.py +0 -0
  32. {macpm-3.0.2 → macpm-3.1.0}/macpm/backend.py +0 -0
  33. {macpm-3.0.2 → macpm-3.1.0}/macpm/capabilities.py +0 -0
  34. {macpm-3.0.2 → macpm-3.1.0}/macpm/dump.py +0 -0
  35. {macpm-3.0.2 → macpm-3.1.0}/macpm/ioreport.py +0 -0
  36. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/__init__.py +0 -0
  37. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/cpu.py +0 -0
  38. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/modelname.py +0 -0
  39. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/power.py +0 -0
  40. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/proc.py +0 -0
  41. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/soc.py +0 -0
  42. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/sysfs.py +0 -0
  43. {macpm-3.0.2 → macpm-3.1.0}/macpm/linux_backend/thermal.py +0 -0
  44. {macpm-3.0.2 → macpm-3.1.0}/macpm/macos_gpu.py +0 -0
  45. {macpm-3.0.2 → macpm-3.1.0}/macpm/metrics.py +0 -0
  46. {macpm-3.0.2 → macpm-3.1.0}/macpm/netinfo.py +0 -0
  47. {macpm-3.0.2 → macpm-3.1.0}/macpm/netmodel.py +0 -0
  48. {macpm-3.0.2 → macpm-3.1.0}/macpm/probe.py +0 -0
  49. {macpm-3.0.2 → macpm-3.1.0}/macpm/sampler.py +0 -0
  50. {macpm-3.0.2 → macpm-3.1.0}/macpm/sensors.py +0 -0
  51. {macpm-3.0.2 → macpm-3.1.0}/macpm/smc.py +0 -0
  52. {macpm-3.0.2 → macpm-3.1.0}/macpm/soc.py +0 -0
  53. {macpm-3.0.2 → macpm-3.1.0}/macpm/tui.py +0 -0
  54. {macpm-3.0.2 → macpm-3.1.0}/macpm.egg-info/dependency_links.txt +0 -0
  55. {macpm-3.0.2 → macpm-3.1.0}/macpm.egg-info/entry_points.txt +0 -0
  56. {macpm-3.0.2 → macpm-3.1.0}/macpm.egg-info/not-zip-safe +0 -0
  57. {macpm-3.0.2 → macpm-3.1.0}/macpm.egg-info/top_level.txt +0 -0
  58. {macpm-3.0.2 → macpm-3.1.0}/packaging/README.txt +0 -0
  59. {macpm-3.0.2 → macpm-3.1.0}/packaging/build.sh +0 -0
  60. {macpm-3.0.2 → macpm-3.1.0}/packaging/entry_tui.py +0 -0
  61. {macpm-3.0.2 → macpm-3.1.0}/packaging/install.sh +0 -0
  62. {macpm-3.0.2 → macpm-3.1.0}/packaging/linux/Dockerfile +0 -0
  63. {macpm-3.0.2 → macpm-3.1.0}/packaging/linux/README.txt +0 -0
  64. {macpm-3.0.2 → macpm-3.1.0}/packaging/macpm.command +0 -0
  65. {macpm-3.0.2 → macpm-3.1.0}/pyproject.toml +0 -0
  66. {macpm-3.0.2 → macpm-3.1.0}/setup.cfg +0 -0
  67. {macpm-3.0.2 → macpm-3.1.0}/tests/__init__.py +0 -0
  68. {macpm-3.0.2 → macpm-3.1.0}/tests/linux_fixtures.py +0 -0
  69. {macpm-3.0.2 → macpm-3.1.0}/tests/test_calc_freq.py +0 -0
  70. {macpm-3.0.2 → macpm-3.1.0}/tests/test_layout.py +0 -0
  71. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_cpu.py +0 -0
  72. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_ixsmi.py +0 -0
  73. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_modelname.py +0 -0
  74. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_nvidia.py +0 -0
  75. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_power.py +0 -0
  76. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_sampler.py +0 -0
  77. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_thermal.py +0 -0
  78. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_view.py +0 -0
  79. {macpm-3.0.2 → macpm-3.1.0}/tests/test_linux_wiring.py +0 -0
  80. {macpm-3.0.2 → macpm-3.1.0}/tests/test_netinfo.py +0 -0
  81. {macpm-3.0.2 → macpm-3.1.0}/tests/test_probe.py +0 -0
  82. {macpm-3.0.2 → macpm-3.1.0}/tests/test_processes.py +0 -0
  83. {macpm-3.0.2 → macpm-3.1.0}/tests/test_sampler.py +0 -0
  84. {macpm-3.0.2 → macpm-3.1.0}/tests/test_sampler_macos.py +0 -0
  85. {macpm-3.0.2 → macpm-3.1.0}/tests/test_sensors.py +0 -0
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.0 — 2026-11-15
4
+
5
+ ### Changed
6
+
7
+ - Views 1 and 2 are painted by blessed, sharing the ANSI palette and border
8
+ helpers of views 3-5. dashing (and the 0.1/0.2 compatibility layer around
9
+ it) is gone: the layout tree lives in `macpm/widgets.py` and
10
+ `macpm/blessed_engine.py` paints it. `install_requires` now lists
11
+ `blessed>=1.20` explicitly.
12
+ - The Linux process view ranks `/proc/<pid>/stat` by CPU ticks and builds rows
13
+ only for the busiest 60 processes; names come from `cmdline` argv[0] and the
14
+ PID column fits seven digits.
15
+
16
+ ### Added
17
+
18
+ - View 2 shows a "GPU usage" hint and one bordered mini gauge per GPU on
19
+ multi-GPU hosts (two per line), with a horizontal bar, `G3 48% P2 70W` and
20
+ the same rolling three-second maximum as the GPU view.
21
+ - The GPU view gained `MEM`/`P` (P-state) columns and shows the rolling
22
+ three-second maximum next to the instantaneous bar (`0% ↑48%`). `ENC`/`DEC`
23
+ are only shown on single-GPU hosts.
24
+ - Linux view 4 keeps the per-process traffic table (`ss -tanie`, TCP only) and
25
+ adds a "root/sudo for all" hint when running without root; listeners are
26
+ deduplicated by displayed address (`*:22` once).
27
+ - The first sample runs immediately instead of waiting one refresh interval;
28
+ GPU identity/process data is warmed in the background.
29
+
30
+ ### Fixed
31
+
32
+ - Charts scroll in from the right edge (newest sample on the right) and the
33
+ painter clears stale cells, so shrinking bars no longer leave a horizontal
34
+ streak.
35
+ - GPU model names and multi-card ownership: `_VendorProcessSampler` forwards
36
+ `model` and `gpus` to `ProcessRow`.
37
+ - Linux `ss` parsing reads `ino:` from the socket header line (iproute2), so
38
+ per-process traffic is no longer empty even as root.
39
+ - Wide PIDs and listener duplicates no longer break the network table.
40
+ - Resizing the terminal debounces for 0.35s and then redraws fully; the
41
+ startup "collecting" text is gone.
42
+
3
43
  ## 3.0.2 — 2026-11-15
4
44
 
5
45
  ### Fixed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macpm
3
- Version: 3.0.2
3
+ Version: 3.1.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
@@ -23,7 +23,7 @@ Classifier: Topic :: System :: Monitoring
23
23
  Requires-Python: >=3.9
24
24
  Description-Content-Type: text/markdown
25
25
  License-File: LICENSE
26
- Requires-Dist: dashing<0.2,>=0.1
26
+ Requires-Dist: blessed>=1.20
27
27
  Requires-Dist: psutil>=5.9
28
28
  Requires-Dist: humanize>=4.0
29
29
  Dynamic: author
@@ -314,7 +314,7 @@ shows it as a `MODEL` column.
314
314
 
315
315
  A single-GPU machine keeps the older layout: card summary on top, process table
316
316
  below. Every view's footer starts with the app name and version
317
- (`macpm v3.0.2 · q quit …`).
317
+ (`macpm v3.1.0 · q quit …`).
318
318
 
319
319
  ```text
320
320
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -328,7 +328,7 @@ below. Every view's footer starts with the app name and version
328
328
  │ └ 222 Xorg 2.0G │
329
329
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
330
330
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
331
- └ macpm v3.0.2 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
331
+ └ macpm v3.1.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
332
332
  ```
333
333
 
334
334
  | Platform | What fills each row |
@@ -272,7 +272,7 @@ shows it as a `MODEL` column.
272
272
 
273
273
  A single-GPU machine keeps the older layout: card summary on top, process table
274
274
  below. Every view's footer starts with the app name and version
275
- (`macpm v3.0.2 · q quit …`).
275
+ (`macpm v3.1.0 · q quit …`).
276
276
 
277
277
  ```text
278
278
  ┌ GPU INFO ────────────────────────────────────────────────────────────────────────────────┐
@@ -286,7 +286,7 @@ below. Every view's footer starts with the app name and version
286
286
  │ └ 222 Xorg 2.0G │
287
287
  │ 2 AMD GPU (amdgpu) ▉▉▉▉▏▏ 60% 1100/1750 12.0W ▉▉▉▉▏▏▏▏▏▏ 3.0G/8.0G 46°C │
288
288
  │ 3 AMD GPU (amdgpu) ▉▉▉▉▉▏ 85% 1200/1750 12.0W ▉▉▉▉▉▏▏▏▏▏ 4.0G/8.0G 49°C │
289
- └ macpm v3.0.2 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
289
+ └ macpm v3.1.0 · q quit 1-5 view s sort ↑/↓ page Space pause ←/→ colour ────────────────┘
290
290
  ```
291
291
 
292
292
  | Platform | What fills each row |
@@ -7,10 +7,10 @@ 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.0.2` in:
10
+ - Version is `3.1.0` in:
11
11
  - `setup.py`
12
12
  - `macpm/__init__.py`
13
- - `macpm/macpm.py` (`version = 'macpm v3.0.2'`)
13
+ - `macpm/macpm.py` (`version = 'macpm v3.1.0'`)
14
14
  - `CHANGELOG.md` has the 3.0.2 entry.
15
15
 
16
16
  ## 2. Test from source
@@ -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.0.2-py3-none-any.whl
41
+ /tmp/macpm-wheel-test/bin/pip install dist/macpm-3.1.0-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.0.2.tar.gz dist/macpm-3.0.2-py3-none-any.whl
81
+ dist/macpm-3.1.0.tar.gz dist/macpm-3.1.0-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.0.2
87
+ python3 -m pip install --upgrade macpm==3.1.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.0.2: dashing 0.2 colour compatibility"
97
- git tag -a v3.0.2 -m "macpm 3.0.2"
96
+ git commit -m "Release macpm 3.1.0: blessed views 1/2, GPU view"
97
+ git tag -a v3.1.0 -m "macpm 3.0.2"
98
98
  git push origin main
99
- git push origin v3.0.2
99
+ git push origin v3.1.0
100
100
  ```
101
101
 
102
102
  The `Release` workflow builds the sdist/wheel, checks metadata and attaches
@@ -120,7 +120,7 @@ PYTHON=python3 packaging/build.sh
120
120
  This produces:
121
121
 
122
122
  ```text
123
- dist/macpm-3.0.2-macos-arm64.tar.gz
123
+ dist/macpm-3.1.0-macos-arm64.tar.gz
124
124
  ```
125
125
 
126
126
  Attach it to the GitHub release. The binaries are ad-hoc signed, not
@@ -1,3 +1,3 @@
1
1
  """macpm: rootless performance monitor for Apple Silicon."""
2
2
 
3
- __version__ = "3.0.2"
3
+ __version__ = "3.1.0"
@@ -0,0 +1,228 @@
1
+ """Blessed renderer for the view 1/2 widget tree.
2
+
3
+ ``DefaultView`` builds a tree of ``VSplit``/``HSplit``/``HGauge``/``HChart``/
4
+ ``SensorPanel`` nodes (see :mod:`macpm.widgets`); this module paints it with
5
+ blessed/ANSI so views 1/2 share the palette and border helpers of views 3-5.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from .tui import RESET_FG, _border, _bottom, _fit, _pad
11
+
12
+ _VBARS = "▁▂▃▄▅▆▇█"
13
+
14
+
15
+ def _hbar(percent: float, width: int) -> str:
16
+ percent = 0.0 if percent is None else max(0.0, min(100.0, float(percent)))
17
+ filled = int(round(width * percent / 100.0))
18
+ return "▉" * filled + "▏" * max(0, width - filled)
19
+
20
+
21
+ def _bordered(tile) -> bool:
22
+ # Widgets record the choice in ``border``; fall back to ``border_color``
23
+ # for simple objects (tests, external callers).
24
+ border = getattr(tile, "border", None)
25
+ if border is not None:
26
+ return bool(border)
27
+ return getattr(tile, "border_color", None) is not None
28
+
29
+
30
+ def _write(out: list, term, row: int, column: int, text: str, color: str) -> None:
31
+ # Always write, including spaces: the terminal keeps stale cells when a
32
+ # bar shrinks, which looked like a horizontal streak at the chart top.
33
+ out.append(term.move(row, column) + color + text + RESET_FG)
34
+
35
+
36
+ def _box(tile, row, col, width, height, out, term, color) -> None:
37
+ title = getattr(tile, "title", "") or ""
38
+ line = _fit(f" {title} ", max(0, width - 2)) if title else ""
39
+ out.append(term.move(row, col) + color + _border(width, line) + RESET_FG)
40
+ if height > 1:
41
+ out.append(
42
+ term.move(row + height - 1, col) + color + _bottom(width, "") + RESET_FG
43
+ )
44
+ for offset in range(1, max(1, height - 1)):
45
+ out.append(term.move(row + offset, col) + color + "│" + RESET_FG)
46
+ out.append(
47
+ term.move(row + offset, col + width - 1) + color + "│" + RESET_FG
48
+ )
49
+
50
+
51
+ def _heights(tile, total: int) -> list:
52
+ items = len(tile.items)
53
+ if not items:
54
+ return []
55
+ if type(tile).__name__ == "FillVSplit":
56
+ base, extra = divmod(total, items)
57
+ heights = [base] * items
58
+ if items > 1 and extra:
59
+ share, remainder = divmod(extra, items - 1)
60
+ for index in range(1, items):
61
+ heights[index] += share
62
+ if index - 1 < remainder:
63
+ heights[index] += 1
64
+ return heights
65
+ minimums = [getattr(item, "min_height", 0) for item in tile.items]
66
+ maximums = [getattr(item, "max_height", 0) for item in tile.items]
67
+ reserved = sum(minimums)
68
+ if reserved and total > reserved or any(maximums):
69
+ heights = list(minimums)
70
+ remaining = max(0, total - reserved)
71
+ fills = [
72
+ index for index, item in enumerate(tile.items)
73
+ if getattr(item, "fill", False)
74
+ ]
75
+ if fills and remaining:
76
+ share, extra = divmod(remaining, len(fills))
77
+ for index in fills:
78
+ heights[index] += share
79
+ for index in fills[-extra:] if extra else []:
80
+ heights[index] += 1
81
+ remaining = 0
82
+ while remaining:
83
+ candidates = [
84
+ index for index, height in enumerate(heights)
85
+ if not maximums[index] or height < maximums[index]
86
+ ]
87
+ if not candidates:
88
+ break
89
+ for index in candidates:
90
+ if not remaining:
91
+ break
92
+ heights[index] += 1
93
+ remaining -= 1
94
+ if sum(heights) == total:
95
+ return heights
96
+ base, extra = divmod(total, items)
97
+ heights = [base] * items
98
+ # Give the spare rows to the last children first: the GPU gauges sit at
99
+ # the bottom of the processor box and need three rows for a border + bar.
100
+ for index in range(items - 1, items - 1 - extra, -1):
101
+ heights[index] += 1
102
+ return heights
103
+
104
+
105
+ def _widths(tile, total: int) -> list:
106
+ items = len(tile.items)
107
+ base = total // items
108
+ widths = [base] * items
109
+ widths[-1] += total - base * items
110
+ return widths
111
+
112
+
113
+ def _chart_values(tile, width: int) -> list:
114
+ """The visible window: the newest ``width`` samples, oldest first."""
115
+ points = list(getattr(tile, "datapoints", []))
116
+ return points[-width:] if width > 0 else []
117
+
118
+
119
+ def _chart(tile, row, col, width, height, out, term, color) -> None:
120
+ points = _chart_values(tile, width)
121
+ # Newest sample sits at the right edge; older ones scroll out to the left.
122
+ offset = width - len(points)
123
+ for line in range(height):
124
+ chars = []
125
+ for x in range(width):
126
+ value = points[x - offset] if x >= offset else 0.0
127
+ filled = max(0.0, min(100.0, float(value))) / 100.0 * height
128
+ level = filled - (height - 1 - line)
129
+ if level >= 1:
130
+ chars.append("█")
131
+ elif level > 0:
132
+ chars.append(_VBARS[min(7, max(0, int(level * 8) - 1))])
133
+ else:
134
+ chars.append(" ")
135
+ _write(out, term, row + line, col, "".join(chars), color)
136
+
137
+
138
+ def _sensor(tile, row, col, width, height, out, term, color) -> None:
139
+ lines = list(getattr(tile, "lines", []) or [])
140
+ levels = getattr(tile, "levels", None)
141
+ if levels and len(lines) < height:
142
+ lines.append(tile._fan_bars(max(0, width - 1)))
143
+ for offset in range(height):
144
+ text = lines[offset] if offset < len(lines) else ""
145
+ _write(out, term, row + offset, col, _pad(_fit(text, width), width), color)
146
+
147
+
148
+ def paint(tile, row, col, width, height, out, term, color) -> None:
149
+ if width <= 0 or height <= 0:
150
+ return
151
+ bordered = _bordered(tile) and width >= 3 and height >= 3
152
+ if bordered:
153
+ _box(tile, row, col, width, height, out, term, color)
154
+ row, col, width, height = row + 1, col + 1, width - 2, height - 2
155
+
156
+ name = type(tile).__name__
157
+ items = getattr(tile, "items", [])
158
+ if items:
159
+ if name in ("VSplit", "FillVSplit"):
160
+ y = row
161
+ for item, child_height in zip(items, _heights(tile, height)):
162
+ paint(item, y, col, width, child_height, out, term, color)
163
+ y += child_height
164
+ else:
165
+ x = col
166
+ for item, child_width in zip(items, _widths(tile, width)):
167
+ paint(item, row, x, child_width, height, out, term, color)
168
+ x += child_width
169
+ return
170
+
171
+ if name == "HGauge":
172
+ start = 0
173
+ title = getattr(tile, "title", "") or ""
174
+ if title and not bordered:
175
+ _write(out, term, row, col, _pad(_fit(title, width), width), color)
176
+ start = 1
177
+ if getattr(tile, "plain", False):
178
+ return
179
+ value = getattr(tile, "value", 0)
180
+ for line in range(start, height):
181
+ _write(out, term, row + line, col, _hbar(value, width), color)
182
+ elif name == "VGauge":
183
+ start = 0
184
+ title = getattr(tile, "title", "") or ""
185
+ if title and not bordered:
186
+ _write(out, term, row, col, _pad(_fit(title, width), width), color)
187
+ start = 1
188
+ if getattr(tile, "plain", False):
189
+ return
190
+ value = getattr(tile, "value", 0)
191
+ inner = max(0, height - start)
192
+ filled = inner * max(0.0, min(100.0, float(value))) / 100.0
193
+ # A vertical bar, not full-width stripes: the height follows the value
194
+ # like the original per-core gauges. A partial row uses the block
195
+ # gradient so a 1-2 row box still shows 20% or 70%.
196
+ margin = 1 if width >= 5 else 0
197
+ bar_width = max(1, width - 2 * margin)
198
+ bar_col = col + margin
199
+ for index in range(inner):
200
+ line = start + index
201
+ level = filled - (inner - 1 - index)
202
+ if level >= 1:
203
+ char = "█"
204
+ elif level > 0:
205
+ char = _VBARS[min(7, max(0, int(level * 8) - 1))]
206
+ else:
207
+ char = " "
208
+ _write(out, term, row + line, bar_col, char * bar_width, color)
209
+ elif name == "HChart":
210
+ start = 0
211
+ title = getattr(tile, "title", "") or ""
212
+ if title and not bordered:
213
+ _write(out, term, row, col, _pad(_fit(title, width), width), color)
214
+ start = 1
215
+ _chart(tile, row + start, col, width, height - start, out, term, color)
216
+ elif name == "SensorPanel":
217
+ _sensor(tile, row, col, width, height, out, term, color)
218
+ else:
219
+ title = getattr(tile, "title", "") or ""
220
+ if title:
221
+ _write(out, term, row, col, _fit(title, width), color)
222
+
223
+
224
+ def render_tiles(tile, term, color) -> None:
225
+ """Paint ``tile`` over the full terminal."""
226
+ out: list = []
227
+ paint(tile, 0, 0, term.width, max(1, term.height - 1), out, term, color)
228
+ print("".join(out), end="", flush=True)
@@ -44,15 +44,19 @@ _FOOTER_PAUSED = footer("q quit 1-5 view s sort ↑/↓ page Space resume
44
44
  # space; the trailing columns are dropped as the terminal narrows.
45
45
  _CARD_COLUMNS = (
46
46
  ("idx", "#", 3),
47
- ("busy", "BUSY", 11),
47
+ ("busy", "BUSY", 18),
48
48
  ("clock", "CLOCK", 9),
49
49
  ("power", "POWER", 7),
50
50
  ("vram", "VRAM", 22),
51
51
  ("temp", "TEMP", 5),
52
+ ("mem", "MEM", 4),
53
+ ("enc", "ENC", 4),
54
+ ("dec", "DEC", 4),
55
+ ("pstate", "P", 3),
52
56
  )
53
57
  _CARD_HEADERS = {key: header for key, header, _ in _CARD_COLUMNS}
54
58
  _CARD_HEADERS["name"] = "NAME"
55
- _CARD_MIN_NAME = 10
59
+ _CARD_MIN_NAME = 18
56
60
 
57
61
 
58
62
  @dataclass
@@ -67,6 +71,11 @@ class GpuDetails:
67
71
  mem_used_mb: Optional[float] = None
68
72
  mem_total_mb: Optional[float] = None
69
73
  temp_c: Optional[float] = None
74
+ busy_recent: Optional[float] = None
75
+ mem_util_pct: Optional[float] = None
76
+ enc_pct: Optional[float] = None
77
+ dec_pct: Optional[float] = None
78
+ pstate: str = ""
70
79
  note: str = ""
71
80
 
72
81
  @property
@@ -128,6 +137,11 @@ def _details(
128
137
  mem_used_mb=_as_float(gpu.get("mem_used_mb")),
129
138
  mem_total_mb=_as_float(gpu.get("mem_total_mb")),
130
139
  temp_c=temperature,
140
+ busy_recent=_as_float(gpu.get("busy_recent")),
141
+ mem_util_pct=_as_float(gpu.get("mem_util_pct")),
142
+ enc_pct=_as_float(gpu.get("enc_pct")),
143
+ dec_pct=_as_float(gpu.get("dec_pct")),
144
+ pstate=str(gpu.get("pstate") or ""),
131
145
  note=note,
132
146
  )
133
147
 
@@ -248,6 +262,8 @@ class _VendorProcessSampler:
248
262
  gpu_card=record.get("card"),
249
263
  gpu_mem_mb=mem_mb,
250
264
  util_known=util is not None,
265
+ model=record.get("model") or None,
266
+ gpu_list=record.get("gpus") or None,
251
267
  )
252
268
  )
253
269
  return rows
@@ -365,10 +381,17 @@ class GpuView:
365
381
 
366
382
  # -- card table --------------------------------------------------------
367
383
 
368
- def _card_layout(self, inner: int) -> tuple:
384
+ def _card_layout(self, inner: int, multi: bool = False) -> tuple:
369
385
  widths = {key: width for key, _, width in _CARD_COLUMNS}
370
- columns = ["idx", "name", "busy", "clock", "power", "vram", "temp"]
371
- for key in ("temp", "vram", "clock", "power", "busy"):
386
+ columns = ["idx", "name", "busy", "clock", "power", "vram", "temp",
387
+ "mem", "enc", "dec", "pstate"]
388
+ if multi:
389
+ # Encode/decode engines only make sense when a single card is the
390
+ # whole story; on an 8-GPU host they are just noise.
391
+ columns.remove("enc")
392
+ columns.remove("dec")
393
+ for key in ("pstate", "dec", "enc", "mem", "temp", "vram", "clock",
394
+ "power", "busy"):
372
395
  fixed = sum(widths[column] for column in columns if column != "name")
373
396
  fixed += len(columns) - 1
374
397
  if inner - fixed >= _CARD_MIN_NAME:
@@ -387,9 +410,11 @@ class GpuView:
387
410
 
388
411
  def _card_cells(self, card: GpuDetails) -> dict:
389
412
  if card.busy_pct is None:
390
- busy = _pad("n/a", 11, right=True)
413
+ busy = _pad("n/a", 18, right=True)
391
414
  else:
392
415
  busy = _bar(card.busy_pct, 6) + f" {card.busy_pct:>3.0f}%"
416
+ if card.busy_recent is not None and card.busy_recent > card.busy_pct + 1:
417
+ busy += f" \N{UPWARDS ARROW}{card.busy_recent:.0f}%"
393
418
  if card.freq_mhz is None:
394
419
  clock = "n/a"
395
420
  elif card.max_freq_mhz:
@@ -405,14 +430,21 @@ class GpuView:
405
430
  vram = "unified"
406
431
  else:
407
432
  vram = "n/a"
433
+ def pct(value):
434
+ return "n/a" if value is None else f"{value:.0f}%"
435
+
408
436
  return {
409
437
  "idx": str(card.index),
410
- "name": card.name,
438
+ "name": card.name[len("NVIDIA "):] if card.name.startswith("NVIDIA ") else card.name,
411
439
  "busy": busy,
412
440
  "clock": clock,
413
441
  "power": "n/a" if card.power_w is None else f"{card.power_w:.1f}W",
414
442
  "vram": vram,
415
443
  "temp": "n/a" if card.temp_c is None else f"{card.temp_c:.0f}\N{DEGREE SIGN}C",
444
+ "mem": pct(card.mem_util_pct),
445
+ "enc": pct(card.enc_pct),
446
+ "dec": pct(card.dec_pct),
447
+ "pstate": card.pstate or "n/a",
416
448
  }
417
449
 
418
450
  def _card_row(self, card: GpuDetails, columns: list, widths: dict) -> str:
@@ -424,7 +456,7 @@ class GpuView:
424
456
 
425
457
  def _cards_box(self, cards: list, width: int, rows: int) -> list:
426
458
  inner = max(0, width - 4)
427
- columns, widths = self._card_layout(inner)
459
+ columns, widths = self._card_layout(inner, multi=len(cards) > 1)
428
460
  total_power = sum(card.power_w for card in cards if card.power_w)
429
461
  parts = []
430
462
  if total_power >= 10:
@@ -700,7 +732,7 @@ class GpuView:
700
732
 
701
733
  def _multi_body(self, cards, rows, width, height, top, inner, accent) -> list:
702
734
  content_height = max(1, height - top - 3)
703
- columns, widths = self._card_layout(inner)
735
+ columns, widths = self._card_layout(inner, multi=len(cards) > 1)
704
736
  per_card = self._per_card_rows(rows)
705
737
 
706
738
  body = []