feat: memory and swap graphs

the values are in the SysinfoSnapshot verbatim,
in case they might be displayed in another way (textually)
This commit is contained in:
electria 2026-08-16 08:41:53 -07:00
commit d068d110e2
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs
2 changed files with 45 additions and 10 deletions

View file

@ -2,6 +2,11 @@
pub struct SysinfoSnapshot {
pub cpu_total: f32,
pub cpus: Vec<f32>,
pub memory: u64,
pub memory_total: u64,
pub swap: u64,
pub swap_total: u64,
}
impl From<&sysinfo::System> for SysinfoSnapshot {
@ -9,6 +14,11 @@ impl From<&sysinfo::System> for SysinfoSnapshot {
Self {
cpu_total: value.global_cpu_usage(),
cpus: value.cpus().iter().map(|cpu| cpu.cpu_usage()).collect(),
memory: value.used_memory(),
memory_total: value.total_memory(),
swap: value.used_swap(),
swap_total: value.total_swap(),
}
}
}