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/test_perf.js | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'desktop/modules/perf/test_perf.js') diff --git a/desktop/modules/perf/test_perf.js b/desktop/modules/perf/test_perf.js index b7d9dbb..7c108a8 100644 --- a/desktop/modules/perf/test_perf.js +++ b/desktop/modules/perf/test_perf.js @@ -18,7 +18,7 @@ const assert = require("assert"); const src = fs.readFileSync(__dirname + "/Perf.js", "utf8") .replace(/^\.pragma library$/m, ""); -const P = new Function(src + "\nreturn { cpuTimes, load, meminfo, df, vram, rate, " + +const P = new Function(src + "\nreturn { cpuTimes, load, meminfo, df, rate, " + "hwmonMap, lanAddr, cpuModel, du, band, worst, isIPv4, parsePubip, formatPubip, " + "ipCheck, due, push, bytes, speed, procs, sockets, netProcs };")(); @@ -62,24 +62,6 @@ assert.strictEqual(d[1].host, "192.0.2.11"); assert.strictEqual(d[1].mount, "/mnt/nfs/Library"); assert.deepStrictEqual(P.df(""), []); -// vram: summed once per xe client id, units honoured, other drivers ignored. -const fd = [ - "/proc/1/fdinfo/7:drm-driver:\txe", - "/proc/1/fdinfo/7:drm-client-id:\t38", - "/proc/1/fdinfo/7:drm-resident-vram0:\t1024 KiB", - "/proc/1/fdinfo/10:drm-driver:\txe", - "/proc/1/fdinfo/10:drm-client-id:\t38", - "/proc/1/fdinfo/10:drm-resident-vram0:\t1024 KiB", - "/proc/2/fdinfo/5:drm-driver:\txe", - "/proc/2/fdinfo/5:drm-client-id:\t40", - "/proc/2/fdinfo/5:drm-resident-vram0:\t2 MiB", - "/proc/3/fdinfo/4:drm-driver:\tamdgpu", - "/proc/3/fdinfo/4:drm-client-id:\t1", - "/proc/3/fdinfo/4:drm-resident-vram0:\t9 GiB", -].join("\n"); -assert.strictEqual(P.vram(fd), 1024 * 1024 + 2 * 1024 * 1024); -assert.strictEqual(P.vram(""), null); - // rate: bytes per second; a counter that went backwards is null. assert.strictEqual(P.rate(1000, 3000, 2), 1000); assert.strictEqual(P.rate(3000, 1000, 1), null); -- cgit v1.2.3