cgtop: add % as key to toggle time/percentage

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-04-02 14:55:36 -04:00
parent 1e913bcba3
commit 2bfc1edad8
2 changed files with 13 additions and 1 deletions

View File

@ -249,6 +249,13 @@
load, respectively.</para></listitem>
</varlistentry>
<varlistentry>
<term>%</term>
<listitem><para>Toggle between showing CPU time as
time or percentage.</para></listitem>
</varlistentry>
<varlistentry>
<term>+</term>
<term>-</term>

View File

@ -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;