Switch back to round

This commit is contained in:
ClementTsang 2019-12-17 02:11:40 -05:00
parent e4be2436c3
commit d5bc7810e9
2 changed files with 3 additions and 3 deletions

View File

@ -193,7 +193,7 @@ pub fn draw_data<B: backend::Backend>(terminal: &mut Terminal<B>, app_state: &mu
.labels(&["0%", "100%"]); .labels(&["0%", "100%"]);
let mem_name = "RAM:".to_string() let mem_name = "RAM:".to_string()
+ &format!("{:3}%", (canvas_data.mem_data.last().unwrap_or(&(0_f64, 0_f64)).1.floor() as u64)) + &format!("{:3}%", (canvas_data.mem_data.last().unwrap_or(&(0_f64, 0_f64)).1.round() as u64))
+ &format!( + &format!(
" {:.1}GB/{:.1}GB", " {:.1}GB/{:.1}GB",
canvas_data.mem_values.first().unwrap_or(&(0, 0)).0 as f64 / 1024.0, canvas_data.mem_values.first().unwrap_or(&(0, 0)).0 as f64 / 1024.0,
@ -211,7 +211,7 @@ pub fn draw_data<B: backend::Backend>(terminal: &mut Terminal<B>, app_state: &mu
if let Some(last_canvas_result) = (&canvas_data.swap_data).last() { if let Some(last_canvas_result) = (&canvas_data.swap_data).last() {
if last_canvas_result.1 >= 0.0 { if last_canvas_result.1 >= 0.0 {
swap_name = "SWP:".to_string() swap_name = "SWP:".to_string()
+ &format!("{:3}%", (canvas_data.swap_data.last().unwrap_or(&(0_f64, 0_f64)).1.floor() as u64)) + &format!("{:3}%", (canvas_data.swap_data.last().unwrap_or(&(0_f64, 0_f64)).1.round() as u64))
+ &format!( + &format!(
" {:.1}GB/{:.1}GB", " {:.1}GB/{:.1}GB",
canvas_data.mem_values[1].0 as f64 / 1024.0, canvas_data.mem_values[1].0 as f64 / 1024.0,

View File

@ -211,7 +211,7 @@ fn convert_mem_data(mem_data: &[data_collection::mem::MemData]) -> Vec<(f64, f64
if data.mem_total_in_mb == 0 { if data.mem_total_in_mb == 0 {
-1000.0 -1000.0
} else { } else {
data.mem_used_in_mb as f64 / data.mem_total_in_mb as f64 * 100_f64 (data.mem_used_in_mb as f64 * 100_f64) / data.mem_total_in_mb as f64
}, },
); );