summaryrefslogtreecommitdiffstats
path: root/desktop/modules/perf/Perf.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-28 09:18:17 +0100
committerDanilo M. <danix@danix.xyz>2026-10-28 09:18:17 +0100
commit11c4c745c7ed5477c74abe7de3458924a0567a3a (patch)
tree1d5d5a522f4bd05fc60f37c87618c9c438bd4299 /desktop/modules/perf/Perf.js
parentad0989dda8dc6420d16aaaa6aa40c47917145342 (diff)
downloadquickshell-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.js')
-rw-r--r--desktop/modules/perf/Perf.js24
1 files changed, 0 insertions, 24 deletions
diff --git a/desktop/modules/perf/Perf.js b/desktop/modules/perf/Perf.js
index 03fd484..d067d3b 100644
--- a/desktop/modules/perf/Perf.js
+++ b/desktop/modules/perf/Perf.js
@@ -16,8 +16,6 @@
// or numbers and returns values. A reading that cannot be made is null, and
// the panel draws null as a dash.
-const UNITS = { "": 1, B: 1, KiB: 1024, MiB: 1024 ** 2, GiB: 1024 ** 3 };
-
// A public IP older than this is not shown: by then the fetch has failed
// for hours, and an address that may no longer be ours is worse than a dash.
const STALE = 4 * 3600;
@@ -86,28 +84,6 @@ function du(text) {
return { total: rows[0].bytes, items: rows.slice(1) };
}
-// VRAM in bytes from the fdinfo scan: drm-resident-vram0 of every xe fd,
-// counted once per drm-client-id because a client holds several fds.
-function vram(text) {
- const fds = {};
- for (const line of text.split("\n")) {
- const m = /^([^:]*):(drm-[\w-]+):\s*(.*)$/.exec(line);
- if (!m) continue;
- (fds[m[1]] = fds[m[1]] || {})[m[2]] = m[3];
- }
- const seen = {};
- let total = null;
- for (const path in fds) {
- const fd = fds[path];
- const id = fd["drm-client-id"];
- const n = /^(\d+)\s*(\w*)/.exec(fd["drm-resident-vram0"] || "");
- if (fd["drm-driver"] !== "xe" || !id || !n || seen[id]) continue;
- seen[id] = true;
- total = (total || 0) + Number(n[1]) * (UNITS[n[2]] || 1);
- }
- return total;
-}
-
// Bytes per second between two counter readings. A counter that went
// backwards (interface reset) gives null rather than a negative spike.
function rate(prev, cur, secs) {