in below/view/src/cgroup_tabs.rs [78:130]
fn output_cgroup(
&self,
cgroup: &CgroupModel,
state: &CgroupState,
filter_out_set: &Option<HashSet<String>>,
output: &mut Vec<(StyledString, String)>,
offset: Option<usize>,
) {
let mut cgroup_stack = vec![cgroup];
while let Some(cgroup) = cgroup_stack.pop() {
if let Some(set) = &filter_out_set {
if set.contains(&cgroup.data.full_path) {
continue;
}
}
let collapsed = state
.collapsed_cgroups
.borrow()
.contains(&cgroup.data.full_path);
let row = self.get_line(&cgroup.data, collapsed, offset, cgroup.recreate_flag);
// Each row is (label, value), where label is visible and value is used
// as identifier to correlate the row with its state in global data.
if cgroup.recreate_flag {
output.push((row, format!("[RECREATED] {}", &cgroup.data.full_path)));
} else {
output.push((row, cgroup.data.full_path.clone()));
}
if collapsed {
continue;
}
let mut children = Vec::from_iter(&cgroup.children);
if let Some(sort_order) = state.sort_order.as_ref() {
sort_queriables(&mut children, &sort_order.to_owned().into(), state.reverse);
}
// Stop at next level (one below <root>)
if state.collapse_all_top_level_cgroup {
for child_cgroup in &children {
state
.collapsed_cgroups
.borrow_mut()
.insert(child_cgroup.data.full_path.clone());
}
}
// Push children in reverse order so the first one will be pop first
while let Some(child) = children.pop() {
cgroup_stack.push(child);
}
}
}