From 3f92e9dc10ce3c7ba1b6ddf1433f2b33973e0689 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 13 Jun 2021 18:00:18 -0700 Subject: [PATCH] Only show latest sample now that we have lots of cores. --- src/widgets/cpu.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/widgets/cpu.rs b/src/widgets/cpu.rs index 5aafc01..6b6ec82 100644 --- a/src/widgets/cpu.rs +++ b/src/widgets/cpu.rs @@ -64,7 +64,7 @@ impl CpuWidget { pub fn new() -> Self { let last_stats = Self::read_status().unwrap(); - let num_samples = 6; + let num_samples = 1; let history = (0..last_stats.len()) .map(|_| (0..num_samples).map(|_| 0.).collect::>()) .collect::>>(); @@ -116,7 +116,8 @@ impl CpuWidget { .collect() }) .collect(); - Some(format!("CPU|{}", graphs.join("|"))) + let joiner = if self.history[0].len() > 1 { "|" } else { "" }; + Some(format!("CPU|{}", graphs.join(joiner))) } }