aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/perf/Perf.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-16 09:50:42 +0200
committerDanilo M. <danix@danix.xyz>2026-10-16 09:50:42 +0200
commitecf306d043b62c1646a95027b4e2144be7c69178 (patch)
treea6671d804040f7563ebee9c2e05c6e344918ceef /desktop/modules/perf/Perf.js
parentdc8c94052e491f7cb1d1f8095afbcee574510d42 (diff)
downloadquickshell-ecf306d043b62c1646a95027b4e2144be7c69178.tar.gz
quickshell-ecf306d043b62c1646a95027b4e2144be7c69178.zip
feat(perf): the performance page moves to the drawer, with ~/.cache
The island's performance icon and panel are gone: the drawer page covers them. With only one host left, the panel drops its three-column grid for one card per row at a larger size, since the page scrolls; temperatures get a card of their own as tiles. The files move from island/perf to modules/perf. A cache card ports conky's: ~/.cache and its five largest children, measured with du each time the page opens (28ms over 2 GiB here) rather than read from conky's 15-minute sampler file. The largest is yellow, red past half the total, as conky had it. The warning dot now shows only on the drawer tile. 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.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/desktop/modules/perf/Perf.js b/desktop/modules/perf/Perf.js
index b853f50..d84c694 100644
--- a/desktop/modules/perf/Perf.js
+++ b/desktop/modules/perf/Perf.js
@@ -72,6 +72,20 @@ function df(text) {
return out;
}
+// `du -B1 -d1 <dir>`: {total, items} with items largest first by basename,
+// or null when du printed nothing. du prints the directory itself last, and
+// it is also the largest line, so the total is the maximum.
+function du(text) {
+ const rows = [];
+ for (const line of text.split("\n")) {
+ const m = /^(\d+)\t(.*)$/.exec(line);
+ if (m) rows.push({ name: m[2].replace(/.*\//, ""), bytes: Number(m[1]) });
+ }
+ if (!rows.length) return null;
+ rows.sort((x, y) => y.bytes - x.bytes);
+ 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) {