diff --git a/CHANGELOG.md b/CHANGELOG.md index 8de06531..bff01ec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Make highlighted CPU persist even if widget is not selected - this should help make it easier to know what CPU you are looking at even if you aren't currently on the CPU widget. +### Bug Fixes + +- Fixed a bug where bottom would incorrectly read the wrong values to calculate the read/write columns for processes in Linux. + ## [0.4.3] - 2020-05-15 ### Other diff --git a/src/app/data_harvester/processes.rs b/src/app/data_harvester/processes.rs index 19a05f5d..bfb820ac 100644 --- a/src/app/data_harvester/processes.rs +++ b/src/app/data_harvester/processes.rs @@ -138,8 +138,8 @@ fn get_process_io(path: &PathBuf) -> std::io::Result { fn get_linux_process_io_usage(io_stats: &[&str]) -> (u64, u64) { // Represents read_bytes and write_bytes ( - io_stats[4].parse::().unwrap_or(0), - io_stats[5].parse::().unwrap_or(0), + io_stats[9].parse::().unwrap_or(0), + io_stats[11].parse::().unwrap_or(0), ) } @@ -240,12 +240,14 @@ fn convert_ps( let read_bytes_per_sec = if time_difference_in_secs == 0 { 0 } else { - (total_write_bytes - new_pid_stat.total_write_bytes) / time_difference_in_secs + total_read_bytes.saturating_sub(new_pid_stat.total_read_bytes) + / time_difference_in_secs }; let write_bytes_per_sec = if time_difference_in_secs == 0 { 0 } else { - (total_read_bytes - new_pid_stat.total_read_bytes) / time_difference_in_secs + total_write_bytes.saturating_sub(new_pid_stat.total_write_bytes) + / time_difference_in_secs }; new_pid_stat.total_read_bytes = total_read_bytes;