Only show latest sample now that we have lots of cores.

This commit is contained in:
Bill Thiede 2021-06-13 18:00:18 -07:00
parent 0aa7613ace
commit 3f92e9dc10

View File

@ -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::<VecDeque<f32>>())
.collect::<Vec<VecDeque<f32>>>();
@ -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)))
}
}