redbear-power: show process state counts in Process panel header
[R:N S:N Z:N T:N] breakdown similar to htop's task summary, computed from the displayed process list.
This commit is contained in:
@@ -1169,8 +1169,21 @@ pub fn render_process_panel<'a>(app: &'a App, focused: bool) -> Paragraph<'a> {
|
||||
} else {
|
||||
"\u{25BC}"
|
||||
};
|
||||
let mut running = 0u32;
|
||||
let mut sleeping = 0u32;
|
||||
let mut zombie = 0u32;
|
||||
let mut stopped = 0u32;
|
||||
for p in &proc.processes {
|
||||
match p.state {
|
||||
'R' => running += 1,
|
||||
'Z' => zombie += 1,
|
||||
'T' | 't' => stopped += 1,
|
||||
_ => sleeping += 1,
|
||||
}
|
||||
}
|
||||
let state_summary = format!("R:{running} S:{sleeping} Z:{zombie} T:{stopped}");
|
||||
lines.push(Line::from(format!(
|
||||
"Showing top {} of {} process(es); total RSS: {}; sort: {} {}{}{} (press 'o' to cycle, 'y' for tree, 'F' to filter)",
|
||||
"Showing top {} of {} process(es) [{state_summary}]; total RSS: {}; sort: {} {}{}{} (press 'o' to cycle, 'y' for tree, 'F' to filter)",
|
||||
proc.count(),
|
||||
proc.total_count,
|
||||
crate::process::ProcessInfo::format_memory_kb(proc.total_memory_kb),
|
||||
|
||||
Reference in New Issue
Block a user