Conversation
Adds $sys_gpu to the sidebar: GPU utilization 0-100% on Apple Silicon, read rootless from the IORegistry (PerformanceStatistics on the AGX accelerator) through a small bundled C helper that uses only public IOKit/CoreFoundation APIs — no sudo and no powermetrics required. - bin/gpu-util.c: recursive property search for PerformanceStatistics, then reads "Device Utilization %" from the nested dict. Matching by property instead of the chip-specific class name (AGXAcceleratorG14X, …) keeps it working across GPU generations. ~9-330ms per read. - scripts/metrics.sh: sys_gpu collector with the usual never-empty "--" fallback (also covers Linux until native reads land in v0.2). - scripts/poll.sh: collects and pushes sys_gpu alongside sys_cpu. - config/sidebar.toml.snippet: metrics regrouped into [gpu cpu mem] and [batt net disk] rows. Co-authored-by: dudu <dudu@users.noreply.github.com>
- herdr >= 0.8 workspace list carries no workspace_id field; derive the
id from active_tab_id ("w3:t1" -> "w3") with label fallback. Without
this the poller logged 'no workspaces found' forever and never pushed.
- include sys_gpu in the collected tokens, never-empty guard, and the
report-metadata push (the collector existed but was never wired into
push_all).
Co-authored-by: dudu <dudu@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
$sys_gpusidebar token: GPU utilization 0-100% on Apple Silicon, read rootless from the IORegistry through a small bundled C helper — no sudo, nopowermetrics, no private framework linkage.How
bin/gpu-util.c(~90 lines): recursiveIORegistryEntrySearchCFPropertyfor the accelerator'sPerformanceStatisticsproperty, then readsDevice Utilization %from the nested dict. Uses only public IOKit/CoreFoundation APIs.AGXAcceleratorG14Xchange per GPU generation; the property search survives new SoCs unchanged.scripts/metrics.sh:sys_gpu()collector with the usual never-empty--fallback (also covers Linux until native reads land in v0.2).scripts/poll.sh: collects and pushessys_gpualongsidesys_cpu.config/sidebar.toml.snippet: metric rows regrouped to[gpu cpu mem]and[batt net disk].Why rootless matters
powermetricsneeds root, which forces a background poller into either a sudoers entry or a root daemon. The IORegistry path needs neither: verified againstioregoutput on an M2 Max (values track within sampling jitter), ~9ms per read in the common case, worst case ~330ms — fine at the default 5s cadence.Notes
clangrebuilds it when available.