Add mixed-vendor GPU summary and fix startup heap corruption

Collect AMD amdgpu sysfs and optional NVIDIA nvidia-smi stats in the
background, auto-detecting supported adapters in PCI order and rotating
additional pairs alongside CPU/RAM. Explicit PCI selection and off mode
remain supported; missing metrics render as N/A.

Initialize the bitmap-only canvas locally instead of the ABI-dependent
libg15render initializer: the installed TTF-enabled renderer wrote an
8-byte FreeType pointer past the smaller bitmap-only allocation, corrupting
the heap before GPU threads started. Add collector, rendering and full-main
regression tests.
This commit is contained in:
Mikhail Yevchenko committed 2026-09-07 17:06:32 +00:00
1 parent 076641c867
commit 7c06a8089d
12 files changed
+1417 -4

No files matched your search

+32
View File
@@ -28,6 +28,14 @@ additional statistics where the relevant system sensors are available.
.SH "OPTIONS"
g15stats understands the following options:
.TP
.BI "\-gpu, --gpu " "auto|off|dddd:bb:ss.f"
Select the GPU summary columns. Default auto collects all PCI addresses
bound to amdgpu or nvidia at startup, including mixed vendors; off disables collection and retains
the original layout. A PCI address selects one card explicitly.
No supported card in auto mode leaves the original layout intact; an explicit
missing card shows N/A. Restart after hotplug to rediscover devices.
Intel, nouveau and radeon are not supported.
.br
.P
.HP
@@ -72,6 +80,30 @@ Recalculate the CPU count for systems supporting CPU hotplug.
L2 selects the previous screen; L3 selects the next screen.
L4 selects an alternative view where available; L5 changes the bottom bar.
.SH "NOTES"
Each GPU column shows vendor/index and PCI bus:slot.function, UTL percent,
U used VRAM, T total VRAM, and TEM in C.
Used and total occupy separate rows with explicit MiB/GiB units (TiB/PiB
if needed), rounded to one decimal. On AMD APUs VRAM can mean only the reserved
carveout. With one GPU the summary retains its 4/5 indicators and shortened
graphs. With two GPUs both columns appear together beside compact CPU percent,
R used system RAM, T total system RAM and SWP percent (plus GPU count in five-row
mode). RAM has explicit units too. More than two cycle in PCI-sorted pairs every
five seconds from startup; all cards continue collecting. NV1/AMD2-style indices
are one-based selected-inventory positions, not NVIDIA ordinals; startup diagnostics
map them to full PCI addresses. The 64-card bound fails explicitly on overflow.
The bottom bar and other screens are unchanged. See README for pixel coordinates.
.PP
AMD reads device-local sysfs/hwmon metrics. NVIDIA optionally uses
/usr/bin/nvidia-smi with no shell or SDK dependency. Independent AMD workers and
one batched NVIDIA worker wait two seconds between queries. All NVIDIA cards
share one PCI-keyed query with a 750ms deadline;
timeouts kill the child, and an unreaped child prevents additional launches.
The child is also killed on parent death. Data older than five seconds and
unavailable metrics show N/A, never fabricated zero. Display refresh remains
controlled by the refresh option. Worker shutdown has one shared one-second
join/reap budget; a stuck kernel read can outlive it until process exit.
No GPU settings are written.
.PP
Normal operation requires a running g15daemon. This package does not install
or enable a g15stats service. Run the client as an ordinary user.
The help options exit before connecting to g15daemon.