From 1a5a9f27bca04e40734211699e81590cd2e136ca Mon Sep 17 00:00:00 2001 From: tomasmatus Date: Mon, 21 Oct 2024 12:44:27 +0200 Subject: [PATCH] Show cumulative CPU use in pod fixes: #1336 --- src/Containers.jsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Containers.jsx b/src/Containers.jsx index caeadab9b..192b5c3af 100644 --- a/src/Containers.jsx +++ b/src/Containers.jsx @@ -495,7 +495,7 @@ class Containers extends React.Component { } // As podman does not provide per pod memory/cpu statistics we do the following: - // - don't add up CPU usage, instead display the highest found CPU usage of the containers in a pod + // - add up CPU usage to display total CPU use of all containers in the pod // - add up memory usage so it displays the total memory of the pod. let cpu = 0; let mem = 0; @@ -505,16 +505,15 @@ class Containers extends React.Component { continue; if (containerStats.CPU != undefined) { - const val = containerStats.CPU === 0 ? containerStats.CPU : containerStats.CPU.toFixed(2); - if (val > cpu) - cpu = val; + cpu += containerStats.CPU; } - if (containerStats.MemUsage != undefined) + if (containerStats.MemUsage != undefined) { mem += containerStats.MemUsage; + } } return { - cpu, + cpu: cpu.toFixed(2), mem, }; }