feat: multiple graphs

This commit is contained in:
electria 2026-08-15 18:16:16 -07:00
commit 98b7a8d201
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs
4 changed files with 82 additions and 16 deletions

18
src/sysinfo_snapshot.rs Normal file
View file

@ -0,0 +1,18 @@
#[derive(Clone, Debug)]
pub struct SysinfoSnapshot {
pub cpu_total: f32,
pub cpus: Vec<(String, f32)>,
}
impl From<&sysinfo::System> for SysinfoSnapshot {
fn from(value: &sysinfo::System) -> Self {
Self {
cpu_total: value.global_cpu_usage(),
cpus: value
.cpus()
.iter()
.map(|cpu| (cpu.name().into(), cpu.cpu_usage()))
.collect(),
}
}
}