Skip to content

Commit

Permalink
feat(memory): add memory history to the overview UI
Browse files Browse the repository at this point in the history
  • Loading branch information
graelo committed Feb 17, 2024
1 parent c34332c commit a4b1b3e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,27 @@ impl<'a> App<'a> {
/* max */ self.soc_info.max_package_w as f32,
))
.push(metrics.consumption.package_w);

//
// Memory usage.
//

self.history
.entry("ram_usage_bytes".to_string())
.or_insert(signal::Signal::with_capacity(
HISTORY_CAPACITY,
/* max */ metrics.memory.ram_total as f32,
))
.push(metrics.memory.ram_used as f32);

// In practice, the max value isn't used as it changes over time.
self.history
.entry("swap_usage_bytes".to_string())
.or_insert(signal::Signal::with_capacity(
HISTORY_CAPACITY,
/* max */ metrics.memory.swap_total as f32,
))
.push(metrics.memory.swap_used as f32);
}

fn color(code: u8) -> ratatui::style::Color {
Expand Down

0 comments on commit a4b1b3e

Please sign in to comment.