From 7fcfb7ee2f0c2562c0e102915cacbc3ec2c4b8f8 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 30 Aug 2015 16:15:08 +0200 Subject: cgtop: allow toggling of --recursive= and -k at runtime --- man/systemd-cgtop.xml | 15 +++++++++++++++ src/cgtop/cgtop.c | 18 ++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/man/systemd-cgtop.xml b/man/systemd-cgtop.xml index 7f54b0b982..fe17165544 100644 --- a/man/systemd-cgtop.xml +++ b/man/systemd-cgtop.xml @@ -277,6 +277,21 @@ respectively. + + k + + Toggle between including or excluding kernel + threads in control group task counts. + + + + r + + Toggle between recursively including or + excluding tasks in child control groups in control group task + counts. + + diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index 040e42ea4b..0791c5a2d0 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -895,6 +895,20 @@ int main(int argc, char *argv[]) { arg_cpu_type = arg_cpu_type == CPU_TIME ? CPU_PERCENT : CPU_TIME; break; + case 'k': + arg_kernel_threads = !arg_kernel_threads; + fprintf(stdout, "\nCounting kernel threads: %s.", yes_no(arg_kernel_threads)); + fflush(stdout); + sleep(1); + break; + + case 'r': + arg_recursive = !arg_recursive; + fprintf(stdout, "\nRecursive task counting: %s", yes_no(arg_recursive)); + fflush(stdout); + sleep(1); + break; + case '+': if (arg_delay < USEC_PER_SEC) arg_delay += USEC_PER_MSEC*250; @@ -923,8 +937,8 @@ int main(int argc, char *argv[]) { case 'h': fprintf(stdout, "\t<" ON "p" OFF "> By path; <" ON "t" OFF "> By tasks; <" ON "c" OFF "> By CPU; <" ON "m" OFF "> By memory; <" ON "i" OFF "> By I/O\n" - "\t<" ON "+" OFF "> Increase delay; <" ON "-" OFF "> Decrease delay; <" ON "%%" OFF "> Toggle time\n" - "\t<" ON "q" OFF "> Quit; <" ON "SPACE" OFF "> Refresh"); + "\t<" ON "+" OFF "> Inc. delay; <" ON "-" OFF "> Dec. delay; <" ON "%%" OFF "> Toggle time; <" ON "SPACE" OFF "> Refresh\n" + "\t<" ON "k" OFF "> Count kernel threads; <" ON "r" OFF "> Count recursively; <" ON "q" OFF "> Quit"); fflush(stdout); sleep(3); break; -- cgit v1.2.3-54-g00ecf