diff --git a/CHANGELOG.md b/CHANGELOG.md index 59006b02..76d05cb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#443](https://github.com/ClementTsang/bottom/pull/443): Make process widget consistent with disk widget in using decimal prefixes (kilo, mega, etc.) for memory usage and writes/reads. +- [#449](https://github.com/ClementTsang/bottom/pull/449): Add decimal place to actual memory usage in process widget for values greater or equal to 1GiB. + ## Bug Fixes - [#416](https://github.com/ClementTsang/bottom/pull/416): Fixes grouped vs ungrouped modes in the processes widget having inconsistent spacing. diff --git a/src/data_conversion.rs b/src/data_conversion.rs index 871e2126..185aa811 100644 --- a/src/data_conversion.rs +++ b/src/data_conversion.rs @@ -617,7 +617,7 @@ pub fn convert_process_data( process.total_write_bytes, ); - let mem_usage_str = get_decimal_bytes(process.mem_usage_bytes); + let mem_usage_str = get_binary_bytes(process.mem_usage_bytes); let user = { #[cfg(target_family = "unix")] @@ -1236,7 +1236,11 @@ pub fn stringify_process_data( (format!("{:.1}%", process.cpu_percent_usage), None), ( if mem_enabled { - format!("{:.0}{}", process.mem_usage_str.0, process.mem_usage_str.1) + if process.mem_usage_bytes <= GIBI_LIMIT { + format!("{:.0}{}", process.mem_usage_str.0, process.mem_usage_str.1) + } else { + format!("{:.1}{}", process.mem_usage_str.0, process.mem_usage_str.1) + } } else { format!("{:.1}%", process.mem_percent_usage) }, diff --git a/src/lib.rs b/src/lib.rs index 00c579e5..6a287f96 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -320,7 +320,7 @@ pub fn handle_force_redraws(app: &mut App) { app.cpu_state.force_update = None; } - // FIXME: [OPT] Prefer reassignment over new vecs? + // FIXME: [OPT] Prefer reassignment over new vectors? if app.mem_state.force_update.is_some() { app.canvas_data.mem_data = convert_mem_data_points(&app.data_collection, app.is_frozen); app.canvas_data.swap_data = convert_swap_data_points(&app.data_collection, app.is_frozen);