aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/island/perf/Perf.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/island/perf/Perf.js')
-rw-r--r--desktop/island/perf/Perf.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/desktop/island/perf/Perf.js b/desktop/island/perf/Perf.js
index d23d900..b853f50 100644
--- a/desktop/island/perf/Perf.js
+++ b/desktop/island/perf/Perf.js
@@ -23,7 +23,9 @@ const UNITS = { "": 1, B: 1, KiB: 1024, MiB: 1024 ** 2, GiB: 1024 ** 3 };
const STALE = 4 * 3600;
// One {total, idle} per cpu line of /proc/stat; index 0 is the aggregate,
-// then the cores in file order. idle counts iowait, as conky did.
+// then the cores in file order. idle counts iowait, as conky did. Only the
+// first eight fields are summed: guest and guest_nice are already inside
+// user and nice, and adding them again overstates load while VMs run.
function cpuTimes(stat) {
const out = [];
for (const line of stat.split("\n")) {
@@ -31,7 +33,7 @@ function cpuTimes(stat) {
if (!m) continue;
const v = m[1].trim().split(/\s+/).map(Number);
if (v.length < 5) continue;
- out.push({ total: v.reduce((a, b) => a + b, 0), idle: v[3] + v[4] });
+ out.push({ total: v.slice(0, 8).reduce((a, b) => a + b, 0), idle: v[3] + v[4] });
}
return out;
}