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:
parent
374cbd546d
commit
d068d110e2
2 changed files with 45 additions and 10 deletions
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue