From: Daniel Wagner <dwagner@suse.de> To: Clark Williams <williams@redhat.com>, John Kacur <jkacur@redhat.com> Cc: linux-rt-users@vger.kernel.org, Daniel Wagner <dwagner@suse.de> Subject: [rt-tests v2 17/18] svsematest: Streamline usage and man page Date: Wed, 7 Oct 2020 10:56:52 +0200 Message-ID: <20201007085653.11961-18-dwagner@suse.de> (raw) In-Reply-To: <20201007085653.11961-1-dwagner@suse.de> Signed-off-by: Daniel Wagner <dwagner@suse.de> --- src/svsematest/svsematest.8 | 6 +-- src/svsematest/svsematest.c | 83 +++++++++++++++++++------------------ 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/src/svsematest/svsematest.8 b/src/svsematest/svsematest.8 index 98322c105803..5fcb96149bdd 100644 --- a/src/svsematest/svsematest.8 +++ b/src/svsematest/svsematest.8 @@ -4,15 +4,15 @@ \fBsvsematest\fR \- Start two threads or fork two processes and measure the latency of SYSV semaphores .SH "SYNTAX" .LP -svsematest [-a|-a PROC] [-b USEC] [-d DIST] [-f] [-i INTV] [-l loops] [-p PRIO] [-t|-t NUM] +svsematest [-a|--affinity NUM] [-b|--breaktrace USEC] [-d|--distance DIST] [-D|--duration TIME] [-f|--fork [OPT]] [-i|--interval INTV] [-l|--loops LOOPS] [-p|--prio PRIO] [-S|--smp] [-t|--threads [NUM]] .br .SH "DESCRIPTION" .LP The program \fBsvsematest\fR starts two threads or, optionally, forks two processes that are synchronized via SYSV semaphores and measures the latency between releasing a semaphore on one side and getting it on the other side. .SH "OPTIONS" .TP -.B \-a, \-\-affinity[=PROC] -Run on processor number PROC. If PROC is not specified, run on current processor. +.B \-a, \-\-affinity[=NUM] +Run on processor number NUM. If PROC is not specified, run on current processor. .TP .B \-b, \-\-breaktrace=USEC Send break trace command when latency > USEC. This is a debugging option to control the latency tracer in the realtime preemption patch. diff --git a/src/svsematest/svsematest.c b/src/svsematest/svsematest.c index 607b397bf39e..7412168bd98a 100644 --- a/src/svsematest/svsematest.c +++ b/src/svsematest/svsematest.c @@ -218,33 +218,34 @@ union semun { }; -static void display_help(void) +static void display_help(int error) { printf("svsematest V %1.2f\n", VERSION); - puts("Usage: svsematest <options>"); - puts("Function: test SYSV semaphore 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" - "-f --fork fork new processes instead of creating threads\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" - "-D --duration=TIME specify a length for the test run.\n" - " Append 'm', 'h', or 'd' to specify minutes, hours or days.\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" + "svsematest <options>\n\n" + "Function: test SYSV semaphore latency\n\n" + "Avaiable 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" + "-f [OPT] --fork[=OPT] fork new processes instead of creating threads\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(error); } - static int setaffinity = AFFINITY_UNSPECIFIED; static int affinity; static int priority; @@ -256,7 +257,7 @@ static int distance = 500; static int smp; static int sameprio; -static void process_options (int argc, char *argv[]) +static void process_options(int argc, char *argv[]) { int error = 0; int max_cpus = sysconf(_SC_NPROCESSORS_CONF); @@ -266,20 +267,20 @@ 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'}, - {"fork", optional_argument, NULL, 'f'}, - {"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'}, + {"fork", optional_argument, NULL, 'f'}, + {"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:f::i:l:D:p:St::h", + int c = getopt_long (argc, argv, "a::b:d:D:f::hi:l:p:St::", long_options, &option_index); if (c == -1) break; @@ -301,6 +302,7 @@ static void process_options (int argc, char *argv[]) break; case 'b': thistracelimit = atoi(optarg); break; case 'd': distance = atoi(optarg); break; + case 'D': duration = parse_time_string(optarg); break; case 'f': if (optarg != NULL) { wasforked = 1; @@ -312,9 +314,9 @@ static void process_options (int argc, char *argv[]) } else mustfork = 1; break; + case 'h': display_help(0); break; case 'i': interval = atoi(optarg); 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; @@ -333,8 +335,9 @@ static void process_options (int argc, char *argv[]) else num_threads = max_cpus; break; - case 'h': error = 1; break; - case '?': error = 1; break; + default: + display_help(1); + break; } } @@ -365,7 +368,7 @@ static void process_options (int argc, char *argv[]) tracelimit = thistracelimit; } if (error) - display_help (); + display_help(error); } -- 2.28.0
next prev parent reply index Thread overview: 42+ 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 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 ` Daniel Wagner [this message] 2020-10-23 18:59 ` [rt-tests v2 17/18] svsematest: " 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=20201007085653.11961-18-dwagner@suse.de \ --to=dwagner@suse.de \ --cc=jkacur@redhat.com \ --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
Linux-rt-users Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-rt-users/0 linux-rt-users/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-rt-users linux-rt-users/ https://lore.kernel.org/linux-rt-users \ linux-rt-users@vger.kernel.org public-inbox-index linux-rt-users Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rt-users AGPL code for this site: git clone https://public-inbox.org/public-inbox.git