mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 13:45:12 +02:00
First implementation of cache memory display, copied from RAM and swap implementations. placed cache as second in the list as it is more similar to the RAM than any other item in the list
This commit is contained in:
parent
ba94509bef
commit
dbed44198b
@ -239,6 +239,8 @@ fn main() -> Result<()> {
|
|||||||
if app.used_widgets.use_mem {
|
if app.used_widgets.use_mem {
|
||||||
app.converted_data.mem_data =
|
app.converted_data.mem_data =
|
||||||
convert_mem_data_points(&app.data_collection);
|
convert_mem_data_points(&app.data_collection);
|
||||||
|
app.converted_data.cache_data =
|
||||||
|
convert_cache_data_points(&app.data_collection);
|
||||||
app.converted_data.swap_data =
|
app.converted_data.swap_data =
|
||||||
convert_swap_data_points(&app.data_collection);
|
convert_swap_data_points(&app.data_collection);
|
||||||
#[cfg(feature = "zfs")]
|
#[cfg(feature = "zfs")]
|
||||||
@ -251,10 +253,11 @@ fn main() -> Result<()> {
|
|||||||
app.converted_data.gpu_data =
|
app.converted_data.gpu_data =
|
||||||
convert_gpu_data(&app.data_collection);
|
convert_gpu_data(&app.data_collection);
|
||||||
}
|
}
|
||||||
let (memory_labels, swap_labels) =
|
let (memory_labels, cache_labels, swap_labels) =
|
||||||
convert_mem_labels(&app.data_collection);
|
convert_mem_labels(&app.data_collection);
|
||||||
|
|
||||||
app.converted_data.mem_labels = memory_labels;
|
app.converted_data.mem_labels = memory_labels;
|
||||||
|
app.converted_data.cache_labels = cache_labels;
|
||||||
app.converted_data.swap_labels = swap_labels;
|
app.converted_data.swap_labels = swap_labels;
|
||||||
#[cfg(feature = "zfs")]
|
#[cfg(feature = "zfs")]
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,7 @@ pub struct CanvasColours {
|
|||||||
pub currently_selected_text_style: Style,
|
pub currently_selected_text_style: Style,
|
||||||
pub table_header_style: Style,
|
pub table_header_style: Style,
|
||||||
pub ram_style: Style,
|
pub ram_style: Style,
|
||||||
|
pub cache_style: Style,
|
||||||
pub swap_style: Style,
|
pub swap_style: Style,
|
||||||
pub arc_style: Style,
|
pub arc_style: Style,
|
||||||
pub gpu_colour_styles: Vec<Style>,
|
pub gpu_colour_styles: Vec<Style>,
|
||||||
@ -54,6 +55,7 @@ impl Default for CanvasColours {
|
|||||||
.bg(currently_selected_bg_colour),
|
.bg(currently_selected_bg_colour),
|
||||||
table_header_style: Style::default().fg(HIGHLIGHT_COLOUR),
|
table_header_style: Style::default().fg(HIGHLIGHT_COLOUR),
|
||||||
ram_style: Style::default().fg(FIRST_COLOUR),
|
ram_style: Style::default().fg(FIRST_COLOUR),
|
||||||
|
cache_style: Style::default().fg(FOURTH_COLOUR),
|
||||||
swap_style: Style::default().fg(SECOND_COLOUR),
|
swap_style: Style::default().fg(SECOND_COLOUR),
|
||||||
arc_style: Style::default().fg(THIRD_COLOUR),
|
arc_style: Style::default().fg(THIRD_COLOUR),
|
||||||
gpu_colour_styles: vec![
|
gpu_colour_styles: vec![
|
||||||
|
@ -56,6 +56,14 @@ impl Painter {
|
|||||||
name: Some(mem_label.into()),
|
name: Some(mem_label.into()),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if let Some((label_percent, label_frac)) = &app_state.converted_data.cache_labels {
|
||||||
|
let cache_label = format!("CACHE:{}{}", label_percent, label_frac);
|
||||||
|
points.push(GraphData {
|
||||||
|
points: &app_state.converted_data.cache_data,
|
||||||
|
style: self.colours.cache_style,
|
||||||
|
name: Some(cache_label.into()),
|
||||||
|
});
|
||||||
|
}
|
||||||
if let Some((label_percent, label_frac)) = &app_state.converted_data.swap_labels {
|
if let Some((label_percent, label_frac)) = &app_state.converted_data.swap_labels {
|
||||||
let swap_label = format!("SWP:{}{}", label_percent, label_frac);
|
let swap_label = format!("SWP:{}{}", label_percent, label_frac);
|
||||||
points.push(GraphData {
|
points.push(GraphData {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user