From: Amit Kucheria amit.kucheria@linaro.org
idlestat can take a pre-created tracefile as input or create one itself. The -o option is confusing for an input file. Change it to -f in preparation for a new option to signify what the file name is to be used for.
Signed-off-by: Amit Kucheria amit.kucheria@linaro.org --- README | 4 ++-- idlestat.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/README b/README index 24485c5..1a917b4 100644 --- a/README +++ b/README @@ -35,10 +35,10 @@ Help Example Usage -------------
-./idlestat -o /tmp/myoutput -t 10 +./idlestat -f /tmp/myoutput -t 10
where,
--o : output file to store the traces +-f : output file to store the traces -t : the duration in seconds
diff --git a/idlestat.c b/idlestat.c index 233d554..5320155 100644 --- a/idlestat.c +++ b/idlestat.c @@ -948,12 +948,12 @@ struct cpuidle_cstates *physical_cluster_data(struct cpu_physical *s_phy) static void help(const char *cmd) { fprintf(stderr, - "\nUsage:\n%s -o|--output-file <file> [-z|--dump]" + "\nUsage:\n%s -f|--trace-file <file> [-z|--dump]" " [-t|--duration <seconds>] [-i|--iterations <number>]" " [-d|--debug]\n", basename(cmd)); fprintf(stderr, - "\nExample:\n%s -o /tmp/myoutput -t 30\n", basename(cmd)); + "\nExample:\n%s -f /tmp/myoutput -t 30\n", basename(cmd)); }
static void version(const char *cmd) @@ -973,9 +973,9 @@ int getoptions(int argc, char *argv[], struct program_options *options) { struct option long_options[] = { { "debug", no_argument, NULL, 'd' }, + { "trace-file", required_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "iterations", required_argument, NULL, 'i' }, - { "output-file", required_argument, NULL, 'o' }, { "duration", required_argument, NULL, 't' }, { "version", no_argument, NULL, 'V' }, { "dump", no_argument, NULL, 'z' }, @@ -990,7 +990,7 @@ int getoptions(int argc, char *argv[], struct program_options *options)
int optindex = 0;
- c = getopt_long(argc, argv, ":dhi:o:t:Vz", + c = getopt_long(argc, argv, ":df:hi:t:Vz", long_options, &optindex); if (c == -1) break; @@ -999,6 +999,9 @@ int getoptions(int argc, char *argv[], struct program_options *options) case 'd': options->debug = true; break; + case 'f': + options->filename = optarg; + break; case 'h': help(argv[0]); exit(0); @@ -1006,9 +1009,6 @@ int getoptions(int argc, char *argv[], struct program_options *options) case 'i': options->iterations = atoi(optarg); break; - case 'o': - options->filename = optarg; - break; case 't': options->duration = atoi(optarg); break; @@ -1038,7 +1038,7 @@ int getoptions(int argc, char *argv[], struct program_options *options) fprintf(stderr, "dump values must be a positive value\n");
if (NULL == options->filename) { - fprintf(stderr, "expected -o <filename>\n"); + fprintf(stderr, "expected -f <trace filename>\n"); return -1; }