systemusage: fix cpu calculation

Fixes #79
This commit is contained in:
2 * r + 2 * t 2025-06-20 00:25:00 +10:00
parent 98eb7c1679
commit b80b531e88

View file

@ -70,7 +70,7 @@ Singleton {
if (data) { if (data) {
const stats = data.slice(1).map(n => parseInt(n, 10)); const stats = data.slice(1).map(n => parseInt(n, 10));
const total = stats.reduce((a, b) => a + b, 0); const total = stats.reduce((a, b) => a + b, 0);
const idle = stats[3]; const idle = stats[3] + (stats[4] ?? 0);
const totalDiff = total - root.lastCpuTotal; const totalDiff = total - root.lastCpuTotal;
const idleDiff = idle - root.lastCpuIdle; const idleDiff = idle - root.lastCpuIdle;