summaryrefslogtreecommitdiff
path: root/src/cgtop
diff options
context:
space:
mode:
authorMichal Koutný <mkoutny@suse.com>2022-11-29 13:23:51 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-11-30 09:40:56 +0900
commit862be54d572c8563a43796d36807f3e4df5a58c2 (patch)
tree4a1cde822e2a66aefe861e5a65c4ce37af3f6a6b /src/cgtop
parentdc4f4c6e36c7e76cdbfc27f367145c15d45c87ae (diff)
downloadsystemd-862be54d572c8563a43796d36807f3e4df5a58c2.tar.gz
cgtop: Update code comments
Diffstat (limited to 'src/cgtop')
-rw-r--r--src/cgtop/cgtop.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index cef5b654e7..5d82d656bc 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -56,10 +56,11 @@ typedef struct Group {
uint64_t io_input_bps, io_output_bps;
} Group;
+/* Counted objects, enum order matters */
typedef enum PidsCount {
- COUNT_USERSPACE_PROCESSES,
+ COUNT_USERSPACE_PROCESSES, /* least */
COUNT_ALL_PROCESSES,
- COUNT_PIDS,
+ COUNT_PIDS, /* most, requires pids controller */
} PidsCount;
static unsigned arg_depth = 3;
@@ -932,6 +933,7 @@ static int run(int argc, char *argv[]) {
if (r < 0)
return log_error_errno(r, "Failed to determine supported controllers: %m");
+ /* honor user selection unless pids controller is unavailable */
possible_count = (mask & CGROUP_MASK_PIDS) ? COUNT_PIDS : COUNT_ALL_PROCESSES;
arg_count = MIN(possible_count, arg_count);