aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/perf/test_perf.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/perf/test_perf.js')
-rw-r--r--desktop/modules/perf/test_perf.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/desktop/modules/perf/test_perf.js b/desktop/modules/perf/test_perf.js
index d5856e8..a1a068d 100644
--- a/desktop/modules/perf/test_perf.js
+++ b/desktop/modules/perf/test_perf.js
@@ -20,7 +20,7 @@ const src = fs.readFileSync(__dirname + "/Perf.js", "utf8")
.replace(/^\.pragma library$/m, "");
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 };")();
+ "ipCheck, due, push, bytes, speed, procs, sockets, netProcs, gpuSample, gpuLoad };")();
// cpuTimes: aggregate first, then cores; idle is idle + iowait.
const stat = [
@@ -183,4 +183,11 @@ assert.deepStrictEqual(P.netProcs([{ key: "a", name: "firefox", rx: 5000, tx: 10
[{ name: "firefox", rx: 3000, tx: 0 }]);
assert.deepStrictEqual(P.netProcs([], later, 0), []);
+
+// gpu.sh: five numbers or nothing; load per engine between two scans.
+assert.strictEqual(P.gpuSample(""), null);
+const g1 = P.gpuSample("100 0 1000 0 1000\n"), g2 = P.gpuSample("100 200 2000 900 2000");
+assert.deepStrictEqual(P.gpuLoad(g1, g2), { render: 20, compute: 90 });
+assert.deepStrictEqual(P.gpuLoad(null, g2), { render: null, compute: null });
+assert.deepStrictEqual(P.gpuLoad(g2, [100, 0, 3000, 0, 2000]), { render: 0, compute: null });
console.log("test_perf: ok");