warn_cgroup_only_sections_under_non_cgroup

Function warn_cgroup_only_sections_under_non_cgroup 

Source
pub fn warn_cgroup_only_sections_under_non_cgroup(
    sections: &[Section],
    group_by: GroupBy,
)
Expand description

Emit a stderr warning when an explicit --sections filter names a cgroup-only section while --group-by is not GroupBy::Cgroup. Without the warning, the section would silently render zero rows (its outer-gate suppresses it), leaving the operator wondering whether their snapshot lacked the data or their flag was misconfigured.

Only fires when the filter is explicitly populated — the default-empty case (“render every section that has data”) is already self-correcting and emits no warning. Non-cgroup sections in the same explicit filter are not flagged; only the cgroup-only entries are called out.

Diagnostic shape per cgroup-only entry: one line of the form section 'X' requires --group-by cgroup; omitted under --group-by Y. The text is pinned by format_cgroup_only_section_warning so a wording drift surfaces in unit tests rather than at the operator’s terminal.