summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-02 14:55:36 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-02 15:01:44 -0400
commit2bfc1edad87fbad005f79f9040af8efbbe1ca6a0 (patch)
tree84afcb407174e416b55e6ff566beba6e86848985
parent1e913bcba3b7361d5090e3cb55098c8cdac0748a (diff)
cgtop: add % as key to toggle time/percentage
-rw-r--r--man/systemd-cgtop.xml7
-rw-r--r--src/cgtop/cgtop.c7
2 files changed, 13 insertions, 1 deletions
diff --git a/man/systemd-cgtop.xml b/man/systemd-cgtop.xml
index c5bb48986..e76517223 100644
--- a/man/systemd-cgtop.xml
+++ b/man/systemd-cgtop.xml
@@ -250,6 +250,13 @@
</varlistentry>
<varlistentry>
+ <term>%</term>
+
+ <listitem><para>Toggle between showing CPU time as
+ time or percentage.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>+</term>
<term>-</term>
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 38f4c3050..30167349f 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -793,6 +793,10 @@ int main(int argc, char *argv[]) {
arg_order = ORDER_IO;
break;
+ case '%':
+ arg_cpu_type = arg_cpu_type == CPU_TIME ? CPU_PERCENT : CPU_TIME;
+ break;
+
case '+':
if (arg_delay < USEC_PER_SEC)
arg_delay += USEC_PER_MSEC*250;
@@ -821,7 +825,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 "Q" OFF "> Quit; <" ON "+" OFF "> Increase delay; <" ON "-" OFF "> Decrease delay; <" ON "SPACE" OFF "> Refresh");
+ "\t<" ON "+" OFF "> Increase delay; <" ON "-" OFF "> Decrease delay; <" ON "%%" OFF "> Toggle time\n"
+ "\t<" ON "Q" OFF "> Quit; <" ON "SPACE" OFF "> Refresh");
fflush(stdout);
sleep(3);
break;