feat: multiple graphs
This commit is contained in:
parent
20f68eaa60
commit
98b7a8d201
4 changed files with 82 additions and 16 deletions
18
src/sysinfo_snapshot.rs
Normal file
18
src/sysinfo_snapshot.rs
Normal 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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue