Add CPU usage percentage to the Load tooltip

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
RD WebDesign
2025-10-06 18:55:04 -03:00
parent 4f11435291
commit 507fde4edf

View File

@@ -344,15 +344,17 @@ function updateSystemInfo() {
); );
$("#cpu").prop( $("#cpu").prop(
"title", "title",
"Load averages for the past 1, 5, and 15 minutes\non a system with " + "CPU usage: " +
system.cpu["%cpu"].toFixed(1) +
"%\nLoad averages for the past 1, 5, and 15 minutes\non a system with " +
system.cpu.nprocs + system.cpu.nprocs +
" core" + " core" +
(system.cpu.nprocs > 1 ? "s" : "") + (system.cpu.nprocs > 1 ? "s" : "") +
" running " + " running " +
system.procs + system.procs +
" processes " + " processes" +
(system.cpu.load.raw[0] > system.cpu.nprocs (system.cpu.load.raw[0] > system.cpu.nprocs
? " (load is higher than the number of cores)" ? "\n(load is higher than the number of cores)"
: "") : "")
); );
$("#sysinfo-cpu").text( $("#sysinfo-cpu").text(