The CPU utilization was displayed incorrectly, because the cached CPU
utilization was mistaken to be the number of utilized CPUs. Instead the
cached CPU utilization is the proportion of utilized CPUs. This handles
the presentation of CPU utilization accordingly.

Signed-off-by: Dominik Rusovac <[email protected]>
---
 src/pages/page_dashboard.rs | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/pages/page_dashboard.rs b/src/pages/page_dashboard.rs
index f637c63..93e0f83 100644
--- a/src/pages/page_dashboard.rs
+++ b/src/pages/page_dashboard.rs
@@ -109,11 +109,7 @@ impl PvePageDashboard {
                     }
                 }
 
-                let cpu_percentage = if maxcpu == 0 {
-                    0.0
-                } else {
-                    (cpu as f32) / (maxcpu as f32)
-                };
+                let cpu_percentage = cpu * 100.0;
 
                 let mem_percentage = if maxmem <= 0.0 {
                     0.0
@@ -125,9 +121,9 @@ impl PvePageDashboard {
 
                 tiles.push(
                     icon_list_tile(Fa::new("cpu"), tr!("CPU"), (), 
()).with_child(list_tile_usage(
-                        format!("{:.2}", cpu),
+                        format!("{cpu_percentage:.2}%"),
                         maxcpu.to_string(),
-                        cpu_percentage,
+                        cpu as f32,
                     )),
                 );
 
-- 
2.47.3




Reply via email to