All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Daniel Wagner <dwagner@suse.de>
Cc: Clark Williams <williams@redhat.com>, linux-rt-users@vger.kernel.org
Subject: Re: [rt-tests v2 11/18] ptsematest: Streamline usage output and man page
Date: Fri, 23 Oct 2020 14:25:31 -0400 (EDT)	[thread overview]
Message-ID: <db60ad9f-85b3-0e4-68c6-6df2b1150e8@redhat.com> (raw)
In-Reply-To: <20201007085653.11961-12-dwagner@suse.de>



On Wed, 7 Oct 2020, Daniel Wagner wrote:

> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/ptsematest/ptsematest.8 |  5 ++-
>  src/ptsematest/ptsematest.c | 76 +++++++++++++++++++------------------
>  2 files changed, 44 insertions(+), 37 deletions(-)
> 
> diff --git a/src/ptsematest/ptsematest.8 b/src/ptsematest/ptsematest.8
> index 5ee7d694d50d..05a0cdfd3657 100644
> --- a/src/ptsematest/ptsematest.8
> +++ b/src/ptsematest/ptsematest.8
> @@ -4,7 +4,7 @@
>  \fBptsematest\fR \- Start two threads and measure the latency of interprocess communication with POSIX mutex.
>  .SH "SYNOPSIS"
>  .LP
> -ptsematest [-a|--affinity [PROC]] [-b|--breaktrace USEC] [-d|--distance DIST] [-D|--duration TIME][-i|--interval INTV] [-l|--loops LOOPS] [-p|--prio PRIO] [-S|--smp] [-t|--threads [NUM]]
> +ptsematest [-a|--affinity [PROC]] [-b|--breaktrace USEC] [-d|--distance DIST] [-D|--duration TIME] [-h|--help] [-i|--interval INTV] [-l|--loops LOOPS] [-p|--prio PRIO] [-S|--smp] [-t|--threads [NUM]]
>  .br
>  .SH "DESCRIPTION"
>  .LP
> @@ -26,6 +26,9 @@ Specify a length for the test run.
>  .br
>  Append 'm', 'h', or 'd' to specify minutes, hours or days.
>  .TP
> +.B \-h, \-\-help
> +Print help message.
> +.TP
>  .B \-i, \-\-interval=INTV
>  Set the base interval of the thread(s) in microseconds (default is 1000 us). This sets the interval of the first thread. See also -d.
>  .TP
> diff --git a/src/ptsematest/ptsematest.c b/src/ptsematest/ptsematest.c
> index de8ea2fe1b0c..02919e3f5eef 100644
> --- a/src/ptsematest/ptsematest.c
> +++ b/src/ptsematest/ptsematest.c
> @@ -141,29 +141,31 @@ void *semathread(void *param)
>  }
>  
>  
> -static void display_help(void)
> +static void display_help(int error)
>  {
>  	printf("ptsematest V %1.2f\n", VERSION);
> -	puts("Usage: ptsematest <options>");
> -	puts("Function: test POSIX threads mutex latency");
> -	puts(
> -	"Options:\n"
> -	"-a [NUM] --affinity        run thread #N on processor #N, if possible\n"
> -	"                           with NUM pin all threads to the processor NUM\n"
> -	"-b USEC  --breaktrace=USEC send break trace command when latency > USEC\n"
> -	"-d DIST  --distance=DIST   distance of thread intervals in us default=500\n"
> -	"-D       --duration=TIME   specify a length for the test run.\n"
> -	"                           Append 'm', 'h', or 'd' to specify minutes, hours or days.\n"
> -	"-i INTV  --interval=INTV   base interval of thread in us default=1000\n"
> -	"-l LOOPS --loops=LOOPS     number of loops: default=0(endless)\n"
> -	"-p PRIO  --prio=PRIO       priority\n"
> -	"-S       --smp             SMP testing: options -a -t and same priority\n"
> -        "                           of all threads\n"
> -	"-t       --threads         one thread per available processor\n"
> -	"-t [NUM] --threads=NUM     number of threads:\n"
> -	"                           without NUM, threads = max_cpus\n"
> -	"                           without -t default = 1\n");
> -	exit(1);
> +	printf("Usage:\n"
> +	       "ptsematest <options>\n\n"
> +	       "Function: test POSIX threads mutex latency\n\n"
> +	       "Available options:\n"
> +	       "-a [NUM] --affinity        run thread #N on processor #N, if possible\n"
> +	       "                           with NUM pin all threads to the processor NUM\n"
> +	       "-b USEC  --breaktrace=USEC send break trace command when latency > USEC\n"
> +	       "-d DIST  --distance=DIST   distance of thread intervals in us default=500\n"
> +	       "-D       --duration=TIME   specify a length for the test run.\n"
> +	       "                           Append 'm', 'h', or 'd' to specify minutes, hours or\n"
> +	       "                           days.\n"
> +	       "-i INTV  --interval=INTV   base interval of thread in us default=1000\n"
> +	       "-l LOOPS --loops=LOOPS     number of loops: default=0(endless)\n"
> +	       "-p PRIO  --prio=PRIO       priority\n"
> +	       "-S       --smp             SMP testing: options -a -t and same priority\n"
> +	       "                           of all threads\n"
> +	       "-t       --threads         one thread per available processor\n"
> +	       "-t [NUM] --threads=NUM     number of threads:\n"
> +	       "                           without NUM, threads = max_cpus\n"
> +	       "                           without -t default = 1\n"
> +	       );
> +	exit(0);
>  }
>  
>  
> @@ -188,16 +190,16 @@ static void process_options (int argc, char *argv[])
>  		int option_index = 0;
>  		/** Options for getopt */
>  		static struct option long_options[] = {
> -			{"affinity", optional_argument, NULL, 'a'},
> -			{"breaktrace", required_argument, NULL, 'b'},
> -			{"distance", required_argument, NULL, 'd'},
> -			{"interval", required_argument, NULL, 'i'},
> -			{"loops", required_argument, NULL, 'l'},
> -			{"duration", required_argument, NULL, 'D'},
> -			{"priority", required_argument, NULL, 'p'},
> -			{"smp", no_argument, NULL, 'S'},
> -			{"threads", optional_argument, NULL, 't'},
> -			{"help", no_argument, NULL, '?'},
> +			{"affinity",	optional_argument,	NULL, 'a'},
> +			{"breaktrace",	required_argument,	NULL, 'b'},
> +			{"distance",	required_argument,	NULL, 'd'},
> +			{"duration",	required_argument,	NULL, 'D'},
> +			{"help",	no_argument,		NULL, 'h'},
> +			{"interval",	required_argument,	NULL, 'i'},
> +			{"loops",	required_argument,	NULL, 'l'},
> +			{"priority",	required_argument,	NULL, 'p'},
> +			{"smp",		no_argument,		NULL, 'S'},
> +			{"threads",	optional_argument,	NULL, 't'},
>  			{NULL, 0, NULL, 0}
>  		};
>  		int c = getopt_long (argc, argv, "a::b:d:i:l:D:p:St::h",
> @@ -222,9 +224,11 @@ static void process_options (int argc, char *argv[])
>  			break;
>  		case 'b': tracelimit = atoi(optarg); break;
>  		case 'd': distance = atoi(optarg); break;
> +		case 'D': duration = parse_time_string(optarg); break;
>  		case 'i': interval = atoi(optarg); break;
> +		case '?':
> +		case 'h': display_help(0); break;
>  		case 'l': max_cycles = atoi(optarg); break;
> -		case 'D': duration = parse_time_string(optarg); break;
>  		case 'p': priority = atoi(optarg); break;
>  		case 'S':
>  			smp = 1;
> @@ -243,9 +247,9 @@ static void process_options (int argc, char *argv[])
>  			else
>  				num_threads = max_cpus;
>  			break;
> -		case 'h':
> -			display_help();
> -		case '?': error = 1; break;
> +		default:
> +			display_help(1);
> +			break;
>  		}
>  	}
>  
> @@ -275,7 +279,7 @@ static void process_options (int argc, char *argv[])
>  		sameprio = 1;
>  
>  	if (error)
> -		display_help();
> +		display_help(error);
>  }
>  
>  
> -- 
> 2.28.0
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

  reply	other threads:[~2020-10-23 18:25 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07  8:56 [rt-tests v2 00/18] Streamline command line Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 01/18] rt-util: Move parse_cpumask from cyclictest Daniel Wagner
2020-10-23 15:46   ` John Kacur
2020-10-26 18:34     ` Daniel Wagner
2020-10-29 15:45       ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 02/18] cyclictest: Use numa library helpers in get_available_cpus() Daniel Wagner
2020-10-23 15:55   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 03/18] cyclicdeadline: Streamline usage output and man page Daniel Wagner
2020-10-23 16:01   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 04/18] cyclicdeadline: Add long command line options Daniel Wagner
2020-10-23 16:07   ` John Kacur
2020-10-27  8:07     ` Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 05/18] deadline_test: Streamline usage output and man page Daniel Wagner
2020-10-23 16:10   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 06/18] oslat: " Daniel Wagner
2020-10-23 17:19   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 07/18] oslat: Use string parser utilies Daniel Wagner
2020-10-23 17:25   ` John Kacur
2020-10-27  8:09     ` Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 08/18] pip_stress: Add command line parser Daniel Wagner
2020-10-23 17:33   ` John Kacur
2020-10-27  8:09     ` Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 09/18] pi_stress: Streamline usage output and man page Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 10/18] pmqtest: " Daniel Wagner
2020-10-23 18:18   ` John Kacur
2020-10-23 18:23   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 11/18] ptsematest: " Daniel Wagner
2020-10-23 18:25   ` John Kacur [this message]
2021-02-10 16:08   ` Peter Xu
2021-02-10 16:25     ` Peter Xu
2021-02-10 16:30       ` Daniel Wagner
2021-02-10 16:33         ` Peter Xu
2021-02-10 16:35         ` Daniel Wagner
2021-02-10 17:00           ` Peter Xu
2021-02-10 17:24             ` Daniel Wagner
2020-10-07  8:56 ` [rt-tests v2 12/18] queuelat: Streamline usage " Daniel Wagner
2020-10-23 18:40   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 13/18] rt-migrate-test: " Daniel Wagner
2020-10-23 18:47   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 14/18] signaltest: " Daniel Wagner
2020-10-23 18:50   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 15/18] sigwaittest: " Daniel Wagner
2020-10-23 18:51   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 16/18] ssdd: " Daniel Wagner
2020-10-23 18:57   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 17/18] svsematest: " Daniel Wagner
2020-10-23 18:59   ` John Kacur
2020-10-07  8:56 ` [rt-tests v2 18/18] hackbench: " Daniel Wagner
2020-10-23 19:03   ` John Kacur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db60ad9f-85b3-0e4-68c6-6df2b1150e8@redhat.com \
    --to=jkacur@redhat.com \
    --cc=dwagner@suse.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.