diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2020-05-19 17:58:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 17:58:17 -0400 |
commit | cf1d41c83af56884611984c7a7b15a59b7a5df8a (patch) | |
tree | 113050ec5e8ac674fe4a6bdfe2b3105ebe48516c | |
parent | e2e1ac300618a06d8cc3f5216cd79ffed39eb913 (diff) |
feature: add back states to unmerged processes
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/canvas/widgets/process_table.rs | 43 | ||||
-rw-r--r-- | src/data_conversion.rs | 1 |
4 files changed, 33 insertions, 16 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 15a42af2..df6d3b0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Features -- TODO: ~~[#114](https://github.com/ClementTsang/bottom/pull/114): Process state per process (originally in 0.4.0, moved to later).~~ +- [#114](https://github.com/ClementTsang/bottom/pull/114): Show process state per process (originally in 0.4.0, moved to later). This only + shows if the processes are not merged together; I couldn't think of a nice way to show it when grouped together, unfortunately. ### Changes @@ -300,7 +300,7 @@ As yet _another_ process/system visualization and management application, bottom - Display temperatures from sensors -- Display information regarding processes, like CPU, memory, and I/O usage +- Display information regarding processes, like CPU, memory, I/O usage, and process state - Process management (process killing _is_ all you need, right?) diff --git a/src/canvas/widgets/process_table.rs b/src/canvas/widgets/process_table.rs index f0154e28..721d34b0 100644 --- a/src/canvas/widgets/process_table.rs +++ b/src/canvas/widgets/process_table.rs @@ -146,7 +146,7 @@ impl ProcessTableWidget for Painter { let wps = "W/s".to_string(); let total_read = "Read".to_string(); let total_write = "Write".to_string(); - // let process_state = "State".to_string(); + let process_state = "State".to_string(); let direction_val = if proc_widget_state.process_sorting_reverse { "▼".to_string() @@ -161,17 +161,30 @@ impl ProcessTableWidget for Painter { ProcessSorting::NAME => name += &direction_val, }; - let process_headers = [ - pid_or_name, - name, - cpu, - mem, - rps, - wps, - total_read, - total_write, - // process_state, - ]; + let process_headers = if proc_widget_state.is_grouped { + vec![ + pid_or_name, + name, + cpu, + mem, + rps, + wps, + total_read, + total_write, + ] + } else { + vec![ + pid_or_name, + name, + cpu, + mem, + rps, + wps, + total_read, + total_write, + process_state, + ] + }; let process_headers_lens: Vec<usize> = process_headers .iter() .map(|entry| entry.len()) @@ -179,7 +192,11 @@ impl ProcessTableWidget for Painter { // Calculate widths let width = f64::from(draw_loc.width); - let width_ratios = [0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.15, 0.15]; + let width_ratios = if proc_widget_state.is_grouped { + vec![0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.15, 0.15] + } else { + vec![0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] + }; let variable_intrinsic_results = get_variable_intrinsic_widths( width as u16, &width_ratios, diff --git a/src/data_conversion.rs b/src/data_conversion.rs index 66038e67..5081d04f 100644 --- a/src/data_conversion.rs +++ b/src/data_conversion.rs @@ -383,7 +383,6 @@ pub fn convert_process_data( (*entry).write_per_sec += process.write_bytes_per_sec; (*entry).total_read += process.total_read_bytes; (*entry).total_write += process.total_write_bytes; - (*entry).process_state.push(process.process_state_char); let converted_rps = get_exact_byte_values(process.read_bytes_per_sec, false); let converted_wps = get_exact_byte_values(process.write_bytes_per_sec, false); |