Linux-rt-users Archive on lore.kernel.org
 help / color / Atom feed
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 13/18] rt-migrate-test: Streamline usage and man page
Date: Wed,  7 Oct 2020 10:56:48 +0200
Message-ID: <20201007085653.11961-14-dwagner@suse.de> (raw)
In-Reply-To: <20201007085653.11961-1-dwagner@suse.de>

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/rt-migrate-test/rt-migrate-test.8 | 41 +++++++-------
 src/rt-migrate-test/rt-migrate-test.c | 82 +++++++++++++--------------
 2 files changed, 59 insertions(+), 64 deletions(-)

diff --git a/src/rt-migrate-test/rt-migrate-test.8 b/src/rt-migrate-test/rt-migrate-test.8
index b9c07f1ed80a..5bbacb5333b8 100644
--- a/src/rt-migrate-test/rt-migrate-test.8
+++ b/src/rt-migrate-test/rt-migrate-test.8
@@ -1,11 +1,11 @@
 .\"
-.TH RT-MIGRATE-TEST 8 "April 21, 2016"
+.TH RT-MIGRATE-TEST 8 "September 18, 2020"
 .\" Please adjust this date whenever editing this manpage
 .SH NAME
 rt-migrate-test \- real-time task migration program
 .SH SYNOPSIS
-.B rt-migrate-test 
-.RI "[\-ceh] [\-p prio] [\-r time] [\-s time] [\-m time] [\-l loops] [nr_tasks]
+.LP
+rt-migrate-test [-c|--check] [-D|--duration TIME] [-e|--equal] [-h|--help] [-l|--loops LOOPS] [-m|--maxerr TIME] [-p|--prio PRIO] [-r|--run-time TIME] [-s|--sleep-time TIME] [NR_TASKS]
 .SH DESCRIPTION
 Test real-time multiprocessor scheduling of tasks to ensure the highest priority tasks are running on all available CPUs
 .SH OPTIONS
@@ -15,44 +15,43 @@ This program follows the usual GNU command line syntax, with long options starti
 In the summary of options, a value in brackets (), indicates a default value
 .br
 .TP
+.B \-c, \-\-check
+Stop if lower prio task is quicker than higher (off)
+.TP
 .B \-D, \-\-duration=TIME
 Specify a length for the test run.
 .br
 Append 'm', 'h', or 'd' to specify minutes, hours or days.
 .TP
-.B \-p, \-\-prio=prio
-base priority to start RT tasks with (2)
+.B \-e, \-\-equal
+Use equal prio for #CPU-1 tasks (requires > 2 CPUS)
 .br
 .TP
-.B \-r, \-\-run\-time=time
-Run time (ms) to busy loop the threads (20)
+.B \-h, \-\-help
+Display usage
 .br
 .TP
-.B \-s, \-\-sleep\-time=time
-Sleep time (ms) between intervals (100)
+.B \-l \-\-loops=LOOPS
+Number of iterations to run (50)
 .br
 .TP
-.B \-m, \-\-maxerr=time
+.B \-m, \-\-maxerr=TIME
 Max allowed error (microsecs)
 .br
 .TP
-.B \-l \-\-loops=loops
-Number of iterations to run (50)
-.br
-.TP
-.B \-e
-Use equal prio for #CPU-1 tasks (requires > 2 CPUS)
+.B \-p, \-\-prio=PRIO
+base priority to start RT tasks with (2)
 .br
 .TP
-.B \-c, \-\-check
-Stop if lower prio task is quicker than higher (off)
+.B \-r, \-\-run\-time=TIME
+Run time (ms) to busy loop the threads (20)
 .br
 .TP
-.B \-h, \-\-help
-Display usage
+.B \-s, \-\-sleep\-time=TIME
+Sleep time (ms) between intervals (100)
 .br
 .TP
-.B [nr\-tasks]
+.B [NR_TASKS]
 number of tasks to run (number of cpus + 1)
 .br
 .SH AUTHOR
diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index 4863238edeb4..68824606faf1 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -146,71 +146,67 @@ static void print_progress_bar(int percent)
 	fflush(stderr);
 }
 
-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("%s %1.2f\n", p, VERSION);
+	printf("rt-migrate-test %1.2f\n", VERSION);
 	printf("Usage:\n"
-	       "%s <options> nr_tasks\n\n"
-	       "-p prio --prio  prio        base priority to start RT tasks with (2)\n"
-	       "-r time --run-time time     Run time (ms) to busy loop the threads (20)\n"
-	       "-s time --sleep-time time   Sleep time (ms) between intervals (100)\n"
-	       "-m time --maxerr time       Max allowed error (microsecs)\n"
-	       "-l loops --loops loops      Number of iterations to run (50)\n"
-	       "-D       --duration=TIME    specify a length for the test run.\n"
-	       "                            Append 'm', 'h', or 'd' to specify minutes, hours or days.\n"
-	       "-e                          Use equal prio for #CPU-1 tasks (requires > 2 CPUS)\n"
-	       "-c    --check               Stop if lower prio task is quicker than higher (off)\n"
-	       "-h    --help\n"
-	       "  () above are defaults \n",
-		p);
-	exit(0);
+	       "rt-migrate-test <options> [NR_TASKS]\n\n"
+	       "-c       --check           Stop if lower prio task is quicker than higher (off)\n"
+	       "-D TIME  --duration=TIME   Specify a length for the test run.\n"
+	       "                           Append 'm', 'h', or 'd' to specify minutes, hours or\n"
+	       "                           days.\n"
+	       "-e       --equal           Use equal prio for #CPU-1 tasks (requires > 2 CPUS)\n"
+	       "-h       --help            Print this help message\n"
+	       "-l LOOPS --loops=LOOPS     Number of iterations to run (50)\n"
+	       "-m TIME  --maxerr=TIME     Max allowed error (microsecs)\n"
+	       "-p PRIO  --prio=PRIO       base priority to start RT tasks with (2)\n"
+	       "-r TIME  --run-time=TIME   Run time (ms) to busy loop the threads (20)\n"
+	       "-s TIME  --sleep-time=TIME Sleep time (ms) between intervals (100)\n\n"
+	       "  () above are defaults \n"
+	       );
+	exit(error);
 }
 
-static void parse_options (int argc, char *argv[])
+static void parse_options(int argc, char *argv[])
 {
 	for (;;) {
 		int option_index = 0;
 		/** Options for getopt */
 		static struct option long_options[] = {
-			{"prio", required_argument, NULL, 'p'},
-			{"run-time", required_argument, NULL, 'r'},
-			{"sleep-time", required_argument, NULL, 's'},
-			{"maxerr", required_argument, NULL, 'm'},
-			{"loops", required_argument, NULL, 'l'},
-			{"duration", required_argument, NULL, 'D'},
-			{"check", no_argument, NULL, 'c'},
-			{"help", no_argument, NULL, '?'},
+			{"check",	no_argument,		NULL, 'c'},
+			{"duration",	required_argument,	NULL, 'D'},
+			{"equal",	no_argument,		NULL, 'e'},
+			{"help",	no_argument,		NULL, 'h'},
+			{"loops",	required_argument,	NULL, 'l'},
+			{"maxerr",	required_argument,	NULL, 'm'},
+			{"prio",	required_argument,	NULL, 'p'},
+			{"run-time",	required_argument,	NULL, 'r'},
+			{"sleep-time",	required_argument,	NULL, 's'},
 			{NULL, 0, NULL, 0}
 		};
-		int c = getopt_long (argc, argv, "p:r:s:m:l:D:ech",
+		int c = getopt_long(argc, argv, "cD:ehl:m:p:r:s:",
 			long_options, &option_index);
 		if (c == -1)
 			break;
 		switch (c) {
-		case 'p': prio_start = atoi(optarg); break;
-		case 'r':
-			run_interval = atoi(optarg);
-			break;
-		case 's': interval = atoi(optarg); break;
-		case 'l': nr_runs = atoi(optarg); break;
+		case 'c': check = 1; break;
 		case 'D': duration = parse_time_string(optarg); break;
-		case 'm': max_err = usec2nano(atoi(optarg)); break;
 		case 'e': equal = 1; break;
-		case 'c': check = 1; break;
 		case '?':
 		case 'h':
-			usage(argv);
+			usage(0);
 			break;
+		case 'l': nr_runs = atoi(optarg); break;
+		case 'm': max_err = usec2nano(atoi(optarg)); break;
+		case 'p': prio_start = atoi(optarg); break;
+		case 'r':
+			run_interval = atoi(optarg);
+			break;
+		case 's': interval = atoi(optarg); break;
+		default:
+			usage(1);
 		}
 	}
-
 }
 
 static unsigned long long get_time(void)
-- 
2.28.0


  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 ` Daniel Wagner [this message]
2020-10-23 18:47   ` [rt-tests v2 13/18] rt-migrate-test: " 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=20201007085653.11961-14-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