1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 09:26:03 +00:00

fix(computes): a host's CPU chart counts I/O wait as idle, and its memory in GiB

The CPU in use was the share of time not idle, with I/O wait counted as
busy: a host that only waited for its disks showed 100% CPU in use. Time
waiting for I/O is idle now: no CPU runs then.

The memory chart divided by 1024³ and labelled the values GB; it says
GiB now.
This commit is contained in:
catborise 2026-11-13 16:14:29 +03:00
parent 1f6cc15ddf
commit 81d183f802
4 changed files with 15 additions and 5 deletions

View file

@ -9,11 +9,12 @@ var cpuChart = lineChart(document.getElementById("cpuChart"), "%", [state.datase
return span ? text + ' (' + state.dataset.averageOver + ' ' + span + ' s)' : text;
},
});
var memChart = lineChart(document.getElementById("memChart"), "GB", [state.dataset.usage]);
var memChart = lineChart(document.getElementById("memChart"), "GiB", [state.dataset.usage]);
var cpuNow = document.getElementById("cpu_now");
var memNow = document.getElementById("mem_now");
var lastUpdate = "–";
// bytes in GiB (1024³), one decimal
function gb(bytes) {
return Math.round(bytes / 107374182.4) / 10;
}
@ -41,7 +42,7 @@ pollWhileVisible(5000, function () {
if (data.memdata.total) {
memChart.options.scales.y.max = gb(data.memdata.total);
addPoint(memChart, data.timeline, [gb(data.memdata.usage)]);
memNow.textContent = gb(data.memdata.usage) + " / " + gb(data.memdata.total) + " GB";
memNow.textContent = gb(data.memdata.usage) + " / " + gb(data.memdata.total) + " GiB";
} else {
addPoint(memChart, data.timeline, [null]);
}