mirror of
https://github.com/ClementTsang/bottom
synced 2025-02-16 13:18:28 +00:00
change: Make proc widget unit consistent with disk (#443)
In particular, use non-binary prefixes for disk and memory usage in a process. Ideally everything is configurable by the user, but this is fine for now IMO until I can get around to doing in-app config.
This commit is contained in:
parent
eb6a737d34
commit
476aaff45c
2 changed files with 11 additions and 7 deletions
|
@ -43,6 +43,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- [#437](https://github.com/ClementTsang/bottom/pull/437): Add linear interpolation step in drawing step to pr event missing entries on the right side of charts.
|
||||
|
||||
- [#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.
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- [#416](https://github.com/ClementTsang/bottom/pull/416): Fixes grouped vs ungrouped modes in the processes widget having inconsistent spacing.
|
||||
|
|
|
@ -588,10 +588,10 @@ pub fn convert_process_data(
|
|||
existing_converted_process_data.keys().copied().collect();
|
||||
|
||||
for process in ¤t_data.process_harvest {
|
||||
let converted_rps = get_binary_bytes(process.read_bytes_per_sec);
|
||||
let converted_wps = get_binary_bytes(process.write_bytes_per_sec);
|
||||
let converted_total_read = get_binary_bytes(process.total_read_bytes);
|
||||
let converted_total_write = get_binary_bytes(process.total_write_bytes);
|
||||
let converted_rps = get_decimal_bytes(process.read_bytes_per_sec);
|
||||
let converted_wps = get_decimal_bytes(process.write_bytes_per_sec);
|
||||
let converted_total_read = get_decimal_bytes(process.total_read_bytes);
|
||||
let converted_total_write = get_decimal_bytes(process.total_write_bytes);
|
||||
|
||||
let read_per_sec = format!("{:.*}{}/s", 0, converted_rps.0, converted_rps.1);
|
||||
let write_per_sec = format!("{:.*}{}/s", 0, converted_wps.0, converted_wps.1);
|
||||
|
@ -601,6 +601,8 @@ pub fn convert_process_data(
|
|||
0, converted_total_write.0, converted_total_write.1
|
||||
);
|
||||
|
||||
let mem_usage_str = get_decimal_bytes(process.mem_usage_bytes);
|
||||
|
||||
let user = {
|
||||
#[cfg(target_family = "unix")]
|
||||
{
|
||||
|
@ -626,7 +628,7 @@ pub fn convert_process_data(
|
|||
process_entry.cpu_percent_usage = process.cpu_usage_percent;
|
||||
process_entry.mem_percent_usage = process.mem_usage_percent;
|
||||
process_entry.mem_usage_bytes = process.mem_usage_bytes;
|
||||
process_entry.mem_usage_str = get_binary_bytes(process.mem_usage_bytes);
|
||||
process_entry.mem_usage_str = mem_usage_str;
|
||||
process_entry.group_pids = vec![process.pid];
|
||||
process_entry.read_per_sec = read_per_sec;
|
||||
process_entry.write_per_sec = write_per_sec;
|
||||
|
@ -652,7 +654,7 @@ pub fn convert_process_data(
|
|||
cpu_percent_usage: process.cpu_usage_percent,
|
||||
mem_percent_usage: process.mem_usage_percent,
|
||||
mem_usage_bytes: process.mem_usage_bytes,
|
||||
mem_usage_str: get_binary_bytes(process.mem_usage_bytes),
|
||||
mem_usage_str,
|
||||
group_pids: vec![process.pid],
|
||||
read_per_sec,
|
||||
write_per_sec,
|
||||
|
@ -682,7 +684,7 @@ pub fn convert_process_data(
|
|||
cpu_percent_usage: process.cpu_usage_percent,
|
||||
mem_percent_usage: process.mem_usage_percent,
|
||||
mem_usage_bytes: process.mem_usage_bytes,
|
||||
mem_usage_str: get_binary_bytes(process.mem_usage_bytes),
|
||||
mem_usage_str,
|
||||
group_pids: vec![process.pid],
|
||||
read_per_sec,
|
||||
write_per_sec,
|
||||
|
|
Loading…
Add table
Reference in a new issue