diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-05-21 14:02:49 -0400 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-05-21 14:03:00 -0400 |
commit | dcaef7ebc40dcd703d9392bc6a07fe01c789b899 (patch) | |
tree | 8b3add0ea9d1c6cdc658d82f3fe2195d333f437d /src | |
parent | f3ca98fe3061793eb022c404b3997e3863534af3 (diff) |
bug: fix incorrect parsing for process i/o calc
Cause was checking the wrong indices for values. I thought I
had taken in a vector of strings that were just byte values,
but they actually contained the labels... oops.
Diffstat (limited to 'src')
-rw-r--r-- | src/app/data_harvester/processes.rs | 10 |
1 files changed, 6 insertions, 4 deletions
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<String> { fn get_linux_process_io_usage(io_stats: &[&str]) -> (u64, u64) { // Represents read_bytes and write_bytes ( - io_stats[4].parse::<u64>().unwrap_or(0), - io_stats[5].parse::<u64>().unwrap_or(0), + io_stats[9].parse::<u64>().unwrap_or(0), + io_stats[11].parse::<u64>().unwrap_or(0), ) } @@ -240,12 +240,14 @@ fn convert_ps<S: core::hash::BuildHasher>( 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; |