Signed-off-by: Amit Kucheria amit.kucheria@linaro.org --- README | 7 +++++-- idlestat.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/README b/README index 3a8eb49..24485c5 100644 --- a/README +++ b/README @@ -28,14 +28,17 @@ Requirements 1. It must be run as root in order to access /sys/kernel/debug. 2. It requires tracing to be enabled in the kernel
+Help +---- +./idlestat -h will show all the options + Example Usage -------------
-./idlestat -d -o myoutput -t 10 +./idlestat -o /tmp/myoutput -t 10
where,
--d : dump the states at the end -o : output file to store the traces -t : the duration in seconds
diff --git a/idlestat.c b/idlestat.c index c4a405a..849b6dd 100644 --- a/idlestat.c +++ b/idlestat.c @@ -946,8 +946,12 @@ struct cpuidle_cstates *physical_cluster_data(struct cpu_physical *s_phy) static void help(const char *cmd) { fprintf(stderr, - "%s [-m|--dump] [-t <seconds>] -o|--output-file <file>\n", + "\nUsage:\n%s -o|--output-file <file> [-m|--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)); }
static void version(const char *cmd) @@ -1017,12 +1021,13 @@ int getoptions(int argc, char *argv[], struct idledebug_options *options) break; case ':': /* missing option argument */ fprintf(stderr, "%s: option `-%c' requires an argument\n", - argv[0], optopt); + basename(argv[0]), optopt); return -1; case '?': /* invalid option */ default: fprintf(stderr, "%s: Unknown option `-%c'.\n", - argv[0], optopt); + basename(argv[0]), optopt); + help(argv[0]); return -1; } }