diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-28 09:18:17 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-28 09:18:17 +0100 |
| commit | 11c4c745c7ed5477c74abe7de3458924a0567a3a (patch) | |
| tree | 1d5d5a522f4bd05fc60f37c87618c9c438bd4299 /desktop/modules/perf/Perf.qml | |
| parent | ad0989dda8dc6420d16aaaa6aa40c47917145342 (diff) | |
| download | quickshell-11c4c745c7ed5477c74abe7de3458924a0567a3a.tar.gz quickshell-11c4c745c7ed5477c74abe7de3458924a0567a3a.zip | |
perf: sum VRAM in a shell script instead of in QML
A process holding thousands of DRM fds makes the fdinfo scan a few
hundred KB. Parsing that in QML every 2s drove Qt's unmanaged-heap
counter to underflow, after which the V4 engine ran a GC on every
allocation and the shell sat at 100% CPU.
vram.sh does the scan and the per-client-id sum in awk and prints one
number, or nothing when no xe client is found, which the panel draws as
a dash. Perf.js loses vram() and its test; test_vram.sh carries the same
cases against the script, which takes a file argument instead of
scanning so the test can feed it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/perf/Perf.qml')
| -rw-r--r-- | desktop/modules/perf/Perf.qml | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/desktop/modules/perf/Perf.qml b/desktop/modules/perf/Perf.qml index 9ebfe45..d165110 100644 --- a/desktop/modules/perf/Perf.qml +++ b/desktop/modules/perf/Perf.qml @@ -187,11 +187,11 @@ Singleton { // ponytail: a shell glob over every fd on the system, ~14ms every 2s, // always; gate it on the panel again if that shows up. Only the user's own processes are readable, so a // system service's GPU use is not counted, as in conky. + // Summed in vram.sh, so JS gets one number, never the scan itself. Process { id: vramProc - command: ["sh", "-c", "grep -sH -e '^drm-driver' -e '^drm-client-id' " - + "-e '^drm-resident-vram0' /proc/[0-9]*/fdinfo/* 2>/dev/null"] - stdout: StdioCollector { onStreamFinished: root.vram = P.vram(text) } + command: ["sh", `${Quickshell.shellDir}/modules/perf/vram.sh`] + stdout: StdioCollector { onStreamFinished: root.vram = text.trim() === "" ? null : Number(text) } } // --- network ------------------------------------------------------------ |
