From 11c4c745c7ed5477c74abe7de3458924a0567a3a Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 28 Oct 2026 09:18:17 +0100 Subject: 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 --- desktop/modules/perf/Perf.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'desktop/modules/perf/Perf.qml') 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 ------------------------------------------------------------ -- cgit v1.2.3