Message ID | 20201007085653.11961-4-dwagner@suse.de |
---|---|
State | Superseded |
Headers | show |
Series | Streamline command line | expand |
On Wed, 7 Oct 2020, Daniel Wagner wrote: > Signed-off-by: Daniel Wagner <dwagner@suse.de> > --- > src/sched_deadline/cyclicdeadline.8 | 24 ++++++++--------- > src/sched_deadline/cyclicdeadline.c | 41 +++++++++++++++-------------- > 2 files changed, 33 insertions(+), 32 deletions(-) > > diff --git a/src/sched_deadline/cyclicdeadline.8 b/src/sched_deadline/cyclicdeadline.8 > index 91766fb391c4..6df7faf445f9 100644 > --- a/src/sched_deadline/cyclicdeadline.8 > +++ b/src/sched_deadline/cyclicdeadline.8 > @@ -17,7 +17,7 @@ cyclicdeadline \- This program is used to test the deadline scheduler (SCHED_DEA > .PP > .SH SYNOPSIS > .B cyclicdeadline > -.RI "[-ha] [-c cpulist] [-i interval] [-s step] [-t nr_threads] [-D duration] > +.RI "[-ha] [-c CPUSET] [-D TIME] [-i INTV] [-s STEP] [-t NUM]" > .PP > .SH DESCRIPTION > .B cyclicdeadline > @@ -25,28 +25,28 @@ is a cyclictest style program for testing the deadline scheduler > .PP > .SH OPTIONS > .TP > -.B \-h > -Show this help menu > -.TP > .B \-a > Use all CPUs > .TP > -.B \-c cpulist > +.B \-c CPUSET > Comma / hypen separated list of CPUs to run deadline tasks on > .TP > -.B \-i interval > +.B \-D TIME > +Specify a length for the test to run > +Append 'm', 'h', or 'd' to specify minutes, hours, or days > +.TP > +.B \-h > +Show this help menu > +.TP > +.B \-i INTV > The shortest deadline for the tasks in us. (default 1000us) > .TP > -.B \-s step > +.B \-s STEP > The amount to increase the deadline for each task in us. (default 500us) > .TP > -.B \-t nr_threads > +.B \-t NUM > The number of threads to run as deadline (default 1) > -.TP > -.B \-D time > -Specify a length for the test to run > .br > -Append 'm', 'h', or 'd' to specify minutes, hours, or days > .SH AUTHOR > cyclicdeadline was written by Steven Rostedt <rostedt@goodmis.org> > .PP > diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c > index a08e28e73c42..310880805553 100644 > --- a/src/sched_deadline/cyclicdeadline.c > +++ b/src/sched_deadline/cyclicdeadline.c > @@ -630,26 +630,25 @@ static void teardown(void) > destroy_cpuset(CPUSET_LOCAL, 1); > } > > -static void usage(char **argv) > +static void usage(int error) > { > - char *arg = argv[0]; > - char *p = arg+strlen(arg); > - > - while (p >= arg && *p != '/') > - p--; > - p++; > - > - printf("usage: %s [options]\n" > - " -h - Show this help menu\n" > - " -a - Use all CPUs\n" > - " -c cpulist - Comma/hyphen separated list of CPUs to run deadline tasks on\n" > - " -i interval(us) - The shortest deadline for the tasks (default 1000us)\n" > - " -s step(us) - The amount to increase the deadline for each task (default 500us)\n" > - " -t threads - The number of threads to run as deadline (default 1)\n" > - " -D time - Specify a length for the test run\n" > - " Append 'm', 'h', or 'd' to specify minutes, hours or days\n" > - "\n", p); > - exit(-1); > + printf("cyclicdeadline V %1.2f\n", VERSION); > + printf("Usage:\n" > + "cyclicdeadline <options>\n\n" > + "-a Use all CPUs\n" > + "-c CPUSET Comma/hyphen separated list of CPUs to run deadline\n" > + " tasks on.\n" > + "-D TIME Specify a length for the test run.\n" > + " Append 'm', 'h', or 'd' to specify minutes, hours or\n" > + " days\n" > + "-h Show this help menu.\n" > + "-i INTV The shortest deadline for the tasks in us\n" > + " (default 1000us).\n" > + "-s STEP The amount to increase the deadline for each task in us\n" > + " (default 500us).\n" > + "-t NUM The number of threads to run as deadline (default 1).\n" > + ); > + exit(error); > } > > static int fail; > @@ -1057,8 +1056,10 @@ int main (int argc, char **argv) > duration = parse_time_string(optarg); > break; > case 'h': > + usage(0); > + break; > default: > - usage(argv); > + usage(1); > } > } > > -- > 2.28.0 > > Signed-off-by: John Kacur <jkacur@redhat.com> Thanks!
diff --git a/src/sched_deadline/cyclicdeadline.8 b/src/sched_deadline/cyclicdeadline.8 index 91766fb391c4..6df7faf445f9 100644 --- a/src/sched_deadline/cyclicdeadline.8 +++ b/src/sched_deadline/cyclicdeadline.8 @@ -17,7 +17,7 @@ cyclicdeadline \- This program is used to test the deadline scheduler (SCHED_DEA .PP .SH SYNOPSIS .B cyclicdeadline -.RI "[-ha] [-c cpulist] [-i interval] [-s step] [-t nr_threads] [-D duration] +.RI "[-ha] [-c CPUSET] [-D TIME] [-i INTV] [-s STEP] [-t NUM]" .PP .SH DESCRIPTION .B cyclicdeadline @@ -25,28 +25,28 @@ is a cyclictest style program for testing the deadline scheduler .PP .SH OPTIONS .TP -.B \-h -Show this help menu -.TP .B \-a Use all CPUs .TP -.B \-c cpulist +.B \-c CPUSET Comma / hypen separated list of CPUs to run deadline tasks on .TP -.B \-i interval +.B \-D TIME +Specify a length for the test to run +Append 'm', 'h', or 'd' to specify minutes, hours, or days +.TP +.B \-h +Show this help menu +.TP +.B \-i INTV The shortest deadline for the tasks in us. (default 1000us) .TP -.B \-s step +.B \-s STEP The amount to increase the deadline for each task in us. (default 500us) .TP -.B \-t nr_threads +.B \-t NUM The number of threads to run as deadline (default 1) -.TP -.B \-D time -Specify a length for the test to run .br -Append 'm', 'h', or 'd' to specify minutes, hours, or days .SH AUTHOR cyclicdeadline was written by Steven Rostedt <rostedt@goodmis.org> .PP diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c index a08e28e73c42..310880805553 100644 --- a/src/sched_deadline/cyclicdeadline.c +++ b/src/sched_deadline/cyclicdeadline.c @@ -630,26 +630,25 @@ static void teardown(void) destroy_cpuset(CPUSET_LOCAL, 1); } -static void usage(char **argv) +static void usage(int error) { - char *arg = argv[0]; - char *p = arg+strlen(arg); - - while (p >= arg && *p != '/') - p--; - p++; - - printf("usage: %s [options]\n" - " -h - Show this help menu\n" - " -a - Use all CPUs\n" - " -c cpulist - Comma/hyphen separated list of CPUs to run deadline tasks on\n" - " -i interval(us) - The shortest deadline for the tasks (default 1000us)\n" - " -s step(us) - The amount to increase the deadline for each task (default 500us)\n" - " -t threads - The number of threads to run as deadline (default 1)\n" - " -D time - Specify a length for the test run\n" - " Append 'm', 'h', or 'd' to specify minutes, hours or days\n" - "\n", p); - exit(-1); + printf("cyclicdeadline V %1.2f\n", VERSION); + printf("Usage:\n" + "cyclicdeadline <options>\n\n" + "-a Use all CPUs\n" + "-c CPUSET Comma/hyphen separated list of CPUs to run deadline\n" + " tasks on.\n" + "-D TIME Specify a length for the test run.\n" + " Append 'm', 'h', or 'd' to specify minutes, hours or\n" + " days\n" + "-h Show this help menu.\n" + "-i INTV The shortest deadline for the tasks in us\n" + " (default 1000us).\n" + "-s STEP The amount to increase the deadline for each task in us\n" + " (default 500us).\n" + "-t NUM The number of threads to run as deadline (default 1).\n" + ); + exit(error); } static int fail; @@ -1057,8 +1056,10 @@ int main (int argc, char **argv) duration = parse_time_string(optarg); break; case 'h': + usage(0); + break; default: - usage(argv); + usage(1); } }
Signed-off-by: Daniel Wagner <dwagner@suse.de> --- src/sched_deadline/cyclicdeadline.8 | 24 ++++++++--------- src/sched_deadline/cyclicdeadline.c | 41 +++++++++++++++-------------- 2 files changed, 33 insertions(+), 32 deletions(-)