aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/perf/test_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/test_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/test_perf.js')
-rw-r--r--desktop/modules/perf/test_perf.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/desktop/modules/perf/test_perf.js b/desktop/modules/perf/test_perf.js
index 5f39f5d..ac5859d 100644
--- a/desktop/modules/perf/test_perf.js
+++ b/desktop/modules/perf/test_perf.js
@@ -9,7 +9,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-// Run: node desktop/island/perf/test_perf.js
+// Run: node desktop/modules/perf/test_perf.js
// Perf.js is a QML library, so its .pragma line is stripped before node
// evaluates it, as test_controls.js does for Controls.js.
@@ -19,7 +19,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, " +
- "hwmonMap, lanAddr, cpuModel, band, worst, isIPv4, parsePubip, formatPubip, " +
+ "hwmonMap, lanAddr, cpuModel, du, band, worst, isIPv4, parsePubip, formatPubip, " +
"ipCheck, due, push, bytes, speed };")();
// cpuTimes: aggregate first, then cores; idle is idle + iowait.
@@ -150,4 +150,10 @@ assert.strictEqual(P.bytes(null), "--");
assert.strictEqual(P.speed(1024 * 1024 * 1.2), "1.2M/s");
assert.strictEqual(P.speed(null), "--");
+// du: total is the directory's own (largest) line; children largest first.
+const cache = P.du("5\t/c/b\n9\t/c/a b\n20\t/c\n");
+assert.strictEqual(cache.total, 20);
+assert.deepStrictEqual(cache.items, [{ name: "a b", bytes: 9 }, { name: "b", bytes: 5 }]);
+assert.strictEqual(P.du(""), null);
+
console.log("test_perf: ok");