Add the options to select c-states, p-states and wakeup output.
--idle, -c : show c-states --frequency, -p : show p-states --wakeup, -w : show wakeup sources
Signed-off-by: Daniel Lezcano daniel.lezcano@linaro.org --- idlestat.c | 33 ++++++++++++++++++++++++++------- idlestat.h | 4 ++++ 2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/idlestat.c b/idlestat.c index d369867..da1e14b 100644 --- a/idlestat.c +++ b/idlestat.c @@ -1113,6 +1113,9 @@ int getoptions(int argc, char *argv[], struct program_options *options) { "duration", required_argument, NULL, 't' }, { "version", no_argument, NULL, 'V' }, { "verbose", no_argument, NULL, 'v' }, + { "idle", no_argument, NULL, 'c' }, + { "frequency", no_argument, NULL, 'p' }, + { "wakeup", no_argument, NULL, 'w' }, { 0, 0, 0, 0 } }; int c; @@ -1125,7 +1128,7 @@ int getoptions(int argc, char *argv[], struct program_options *options)
int optindex = 0;
- c = getopt_long(argc, argv, ":df:h:t:Vv", + c = getopt_long(argc, argv, ":df:h:t:cpwVv", long_options, &optindex); if (c == -1) break; @@ -1141,6 +1144,15 @@ int getoptions(int argc, char *argv[], struct program_options *options) case 't': options->duration = atoi(optarg); break; + case 'c': + options->display |= IDLE_DISPLAY; + break; + case 'p': + options->display |= FREQUENCY_DISPLAY; + break; + case 'w': + options->display |= WAKEUP_DISPLAY; + break; case 'V': version(argv[0]); exit(0); @@ -1180,6 +1192,9 @@ int getoptions(int argc, char *argv[], struct program_options *options) } }
+ if (options->display == 0) + options->display = IDLE_DISPLAY; + return optind; }
@@ -1429,13 +1444,17 @@ int main(int argc, char *argv[], char *const envp[]) */ if (0 == establish_idledata_to_topo(datas)) {
- display_cstates_header(); - dump_cpu_topo_info(display_cstates, 0); - display_cstates_footer(); + if (options.display & IDLE_DISPLAY) { + display_cstates_header(); + dump_cpu_topo_info(display_cstates, 0); + display_cstates_footer(); + }
- display_pstates_header(); - dump_cpu_topo_info(display_pstates, 1); - display_pstates_footer(); + if (options.display & FREQUENCY_DISPLAY) { + display_pstates_header(); + dump_cpu_topo_info(display_pstates, 1); + display_pstates_footer(); + } }
release_cpu_topo_cstates(); diff --git a/idlestat.h b/idlestat.h index 31df587..1d5f961 100644 --- a/idlestat.h +++ b/idlestat.h @@ -129,10 +129,14 @@ enum formats { struct program_options { int mode; int format; + int display; unsigned int duration; char *filename; int verbose; };
+#define IDLE_DISPLAY 0x1 +#define FREQUENCY_DISPLAY 0x2 +#define WAKEUP_DISPLAY 0x4
#endif