With the first implementation of cgroups (v2) support, the pathname of the cgroup and some configuration values were stored and shown (option 'X') for each process. Redesign cgroups support by showing the hierarchical structure of the cgroups themselves with their metrics and (optionally) the processes that belong to each cgroup.
The meaning of key/option 'G' and 'X' has been swapped.
Key/option 'X' is used now to suppress showing terminated processes.
Key/option 'G' is used now to show a hierarchical structure of cgroups and related metrics.
With the keys/options 2 till 7 the level depth of the cgroups can be chosen (7 is default).
Key/option 8 also shows related active processes, except the kernel processes (usually in the root cgroup).
Key/option 9 shows all active processes.
With key/option 'a' (toggle) all cgroups and processes are shown instead of only the active cgroups and processes. A cgroup is considered inactive when no processes are assigned to that cgroup nor to the cgroups underneath.
With key/option 'C' the output is sorted on CPU consumption.
With key/option 'M' the output is sorted on memory consumption.
Per cgroup, the number of assigned processes is shown (NPROCS) as well as the number of processes assigned to the cgroups underneath (PBELOW).
For systems with cgroups version 2 support, cgroups metrics and the accompanying PID list are written in a compressed way to the raw file.
When reading raw files, cgroup metrics and PID list are decompressed and additional structures are build again to be able to handle and sort cgroups information again.
Label 'CGR' has been introduced to print cgroup-related information.
Parsable output: one line (marked 'C') is printed per cgroup to show the metrics and one line (marked 'P') is printed to show a list of PIDs related to the cgroup.
JSON output: all metrics are printed per cgroup as a dictionary with a specific key to show the list of PIDs.
With the first implementation of cgroups (v2) support, the pathname of the cgroup and some configuration values were stored and shown (option 'X') for each process. Redesign cgroups support by showing the hierarchical structure of the cgroups themselves with their metrics and (optionally) the processes that belong to each cgroup.