Skip to contentSkip to conversation

rt-tests: Miscellaneous fixes

PATCH In review John Kacur 3 participants 14 messages Jan 23, 2020 – Jan 28, 2020 Kbuild

lore
Share & tools
lore

John Kacur

author
#0 lore raw

cover rt-tests: Miscellaneous fixes

Most of the fixes here are just clean-ups to make sure that online help or usage message match the man pages according to the current options.

Some fixes to the queuelat scripts determine_maximum_mpps.sh and get_cpuinfo_mhz.sh are perhaps notable though, as people were having trouble using them.

getcpuinfo_mhz.sh now only gets one value as was originally intended, and it gets the highest value available. The fixes to quoting in determine_maximum_mpps.sh should make the program work correctly now - and take longer though.

John Kacur (9):
rt-tests: queuelat: Assume queuelat is in the path
rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline
rt-tests: pi_stress: Add short options to usage message
rt-tests: pi_stress: Sync man page with help
rt-tests: queuelat: get_cpuinfo_mhz.sh highest value
rt-tests: determine_maximum_mpps.sh: Fix quoting and other shell issue
rt-tests: ptsematest: Update man page and add -h option
rt-tests: queuelat: Fixes to man page and display_help
rt-tests: svsematest: Display help with an error message for -h

 Makefile                               |  1 +
 src/pi_tests/pi_stress.8               |  9 ++--
 src/pi_tests/pi_stress.c               | 34 ++++++------
 src/ptsematest/ptsematest.8            |  3 ++
 src/ptsematest/ptsematest.c            | 10 ++--
 src/queuelat/determine_maximum_mpps.sh | 75 +++++++++++++-------------
 src/queuelat/get_cpuinfo_mhz.sh        |  5 +-
 src/queuelat/queuelat.8                |  4 +-
 src/queuelat/queuelat.c                | 22 ++++----
 src/sched_deadline/cyclicdeadline.8    | 53 ++++++++++++++++++
 src/svsematest/svsematest.c            |  3 +-
 11 files changed, 141 insertions(+), 78 deletions(-)
 create mode 100644 src/sched_deadline/cyclicdeadline.8
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 1/9 rt-tests: queuelat: Assume queuelat is in the path

The script determine_maximum_mpps.sh in queuelat hard codes the path to queuelat. Assume that it is in the path.

---
 src/queuelat/determine_maximum_mpps.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/queuelat/determine_maximum_mpps.sh +1 -1
index 52d54c0f9065..f6cf1dea27cf 100755
@@ -90,7 +90,7 @@ while [ $queuelat_failure == 1 ]; do
 	echo "$mpps Mpps"
 
 	for i in `seq 1 10`; do 
-		$PREAMBLE ./queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+		$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
 		exceeded=`grep exceeded $OUTFILE`
 
 		if [ ! -z "$exceeded" ]; then
Signature · 1 line
2.20.1
author
#2 lore raw

PATCH 2/9 rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline

In reply to John Kacur

- Add a simple manpage for cyclicdeadline
- Install it from the Makefile

---
 Makefile                            |  1 +
 src/sched_deadline/cyclicdeadline.8 | 53 +++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 src/sched_deadline/cyclicdeadline.8
Makefile +1 -0
index 552b3fe885cc..e2142ba3f4e9 100644
@@ -193,6 +193,7 @@ install: all install_hwlatdetect
 	gzip -c src/queuelat/queuelat.8 >"$(DESTDIR)$(mandir)/man8/queuelat.8.gz"
 	gzip -c src/sched_deadline/deadline_test.8 >"$(DESTDIR)$(mandir)/man8/deadline_test.8.gz"
 	gzip -c src/ssdd/ssdd.8 >"$(DESTDIR)$(mandir)/man8/ssdd.8.gz"
+	gzip -c src/sched_deadline/cyclicdeadline.8 >"$(DESTDIR)$(mandir)/man8/cyclicdeadline.8.gz"
 
 .PHONY: install_hwlatdetect
 install_hwlatdetect: hwlatdetect
src/sched_deadline/cyclicdeadline.8 new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.20.1
#3 lore raw

Re: [PATCH 2/9] rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline

Hi John,

Quoted 15 lines · John Kacur

- Add a simple manpage for cyclicdeadline
- Install it from the Makefile

---
 Makefile                            |  1 +
 src/sched_deadline/cyclicdeadline.8 | 53 +++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 src/sched_deadline/cyclicdeadline.8
Makefile +0 -0
index 552b3fe885cc..e2142ba3f4e9 100644

Makefile install: all install_hwlatdetect · line 196

Quoted 4 lines
Makefile +1 -0
@@ -193,6 +193,7 @@ install: all install_hwlatdetect
 	gzip -c src/queuelat/queuelat.8 >"$(DESTDIR)$(mandir)/man8/queuelat.8.gz"
 	gzip -c src/sched_deadline/deadline_test.8 >"$(DESTDIR)$(mandir)/man8/deadline_test.8.gz"
 	gzip -c src/ssdd/ssdd.8 >"$(DESTDIR)$(mandir)/man8/ssdd.8.gz"
+	gzip -c src/sched_deadline/cyclicdeadline.8 >"$(DESTDIR)$(mandir)/man8/cyclicdeadline.8.gz"

I'm just wondering about this. Why are the man pages compressed in the Makefile? Actually most package management systems compress the man pages themselves. Users may want to use bz2 or something else.

In fact, I have a patch on top of rt-tests v1.6 in Gentoo which removes the compression, because portage complains about it.

Thanks,
Kurt

author
#4 lore raw

Re: [PATCH 2/9] rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline

Quoted 27 lines · Kurt Kanzenbach

Hi John,

Quoted 15 lines · John Kacur

- Add a simple manpage for cyclicdeadline
- Install it from the Makefile

---
 Makefile                            |  1 +
 src/sched_deadline/cyclicdeadline.8 | 53 +++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 src/sched_deadline/cyclicdeadline.8
Makefile +0 -0
index 552b3fe885cc..e2142ba3f4e9 100644

Makefile install: all install_hwlatdetect · line 196

Quoted 4 lines
Makefile +1 -0
@@ -193,6 +193,7 @@ install: all install_hwlatdetect
 	gzip -c src/queuelat/queuelat.8 >"$(DESTDIR)$(mandir)/man8/queuelat.8.gz"
 	gzip -c src/sched_deadline/deadline_test.8 >"$(DESTDIR)$(mandir)/man8/deadline_test.8.gz"
 	gzip -c src/ssdd/ssdd.8 >"$(DESTDIR)$(mandir)/man8/ssdd.8.gz"
+	gzip -c src/sched_deadline/cyclicdeadline.8 >"$(DESTDIR)$(mandir)/man8/cyclicdeadline.8.gz"

I'm just wondering about this. Why are the man pages compressed in the Makefile? Actually most package management systems compress the man pages themselves. Users may want to use bz2 or something else.

Quoted 6 lines

In fact, I have a patch on top of rt-tests v1.6 in Gentoo which removes the compression, because portage complains about it.

Thanks,
Kurt

I think it's because man pages are generally installed as .gz files on most distros. Although the Makefile is designed to work well with package management systems, it should also work correctly stand alone.

If you want to submit a patch that would optionally use a different kind of compression or otherwise handle things without breaking the current defaults, I would likely accept it.

John

#5 lore raw

Re: [PATCH 2/9] rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline

Hi John,

Quoted 12 lines · John Kacur
Quoted 10 lines · Kurt Kanzenbach

I'm just wondering about this. Why are the man pages compressed in the Makefile? Actually most package management systems compress the man pages themselves. Users may want to use bz2 or something else.

In fact, I have a patch on top of rt-tests v1.6 in Gentoo which removes the compression, because portage complains about it.

Thanks,
Kurt

Quoted 7 lines

I think it's because man pages are generally installed as .gz files on most distros. Although the Makefile is designed to work well with package management systems, it should also work correctly stand alone.

If you want to submit a patch that would optionally use a different kind of compression or otherwise handle things without breaking the current defaults, I would likely accept it.

Sounds good. I'll come up with a patch and keeping the existing defaults.

Thanks,
Kurt

author
#6 lore raw

PATCH 3/9 rt-tests: pi_stress: Add short options to usage message

In reply to John Kacur

Add short options to usage message. Note, the options all ready exist, they simply were not documented in the usage message.

---
 src/pi_tests/pi_stress.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)
src/pi_tests/pi_stress.c +15 -19
index 7fa98dfb9ad4..0ed844c636cd 100644
@@ -1008,29 +1008,25 @@ void *high_priority(void *arg)
 
 void usage(void)
 {
-	printf("usage: pi_stress <options>\n");
-	printf("    options:\n");
-	printf("\t--verbose\t- lots of output\n");
-	printf("\t--quiet\t\t- suppress running output\n");
-	printf
-	    ("\t--duration=<n>\t- length of the test run in seconds [infinite]\n");
-	printf("\t\t\t  Append 'm', 'h', or 'd' to specify minutes, hours or days.\n");
-	printf("\t--groups=<n>\t- set the number of inversion groups [%d]\n",
+	printf("usage: pi_stress <options>\n\n");
+	printf("-v\t--verbose\t- lots of output\n");
+	printf("-q\t--quiet\t\t- suppress running output\n");
+	printf ("-D TIME\t--duration=TIME\n\t\t\t- length of test run in seconds (default is infinite)\n");
+	printf("\t\t\t  Append 'm', 'h', or 'd'\n\t\t\t  to specify minutes, hours or days.\n");
+	printf("-g\t--groups=<n>\t- set the number of inversion groups [%d]\n",
 	       ngroups);
-	printf
-	    ("\t--inversions=<n>- number of inversions per group [infinite]\n");
-	printf("\t--rr\t\t- use SCHED_RR for test threads [SCHED_FIFO]\n");
-	printf("\t--sched\t\t- scheduling options per thread type:\n");
+	printf ("-i INVERSIONS\t\t--inversions=INVERSIONS\n\t\t\t  number of inversions per group (default is infinite)\n");
+	printf("-r\t--rr\t\t- use SCHED_RR for test threads [SCHED_FIFO]\n");
+	printf("-s SCHED_OPTS\t--sched\t\t- scheduling options per thread type:\n");
 	printf("\t\tid=[high|med|low]\t\t\t- select thread\n");
 	printf("\t\t,policy=[fifo,rr],priority=<n>\t\t- SCHED_FIFO or SCHED_RR\n");
 	printf("\t\t,policy=deadline,runtime=<n>,deadline=<n>,period=<n>\t- SCHED_DEADLINE\n");
-	printf("\t--prompt\t- prompt before starting the test\n");
-	printf
-	    ("\t--uniprocessor\t- force all threads to run on one processor\n");
-	printf("\t--mlockall\t- lock current and future memory\n");
-	printf("\t--debug\t\t- turn on debug prints\n");
-	printf("\t--version\t- print version number on output\n");
-	printf("\t--help\t\t- print this message\n");
+	printf("-p\t--prompt\t- prompt before starting the test\n");
+	printf ("-u\t--uniprocessor\t- force all threads to run on one processor\n");
+	printf("-m\t--mlockall\t- lock current and future memory\n");
+	printf("-d\t--debug\t\t- turn on debug prints\n");
+	printf("-V\t--version\t- print version number on output\n");
+	printf("-h\t--help\t\t- print this message\n");
 }
 
 /* block all signals (called from main) */
Signature · 1 line
2.20.1
author
#7 lore raw

PATCH 4/9 rt-tests: pi_stress: Sync man page with help

In reply to John Kacur

Sync the man page with help.
Specifically, remove the signal option which is not supported and document the sched option

---
 src/pi_tests/pi_stress.8 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
src/pi_tests/pi_stress.8 +5 -4
index 475d3c34f135..5e2af6189ca1 100644
@@ -21,7 +21,8 @@ pi_stress \- a stress test for POSIX Priority Inheritance mutexes
 .IR groups
 .RB [ \-d|\-\-debug ]
 .RB [ \-v|\-\-verbose ]
-.RB [ \-s|\-\-signal ]
+.RB [ \-s|\-\-sched
+.IR sched_opts ]
 .RB [ \-r|\-\-rr ]
 .RB [ \-p|\-\-prompt ]
 .RB [ \-m|\-\-mlockall ]
@@ -63,12 +64,12 @@ Specify a length for the test run.
 Append 'm', 'h', or 'd' to specify minutes, hours or days.
 .IP \-v|\-\-verbose
 Run with verbose messages
-.IP \-s|\-\-signal
-Terminate on receipt of SIGTERM (Ctrl-C). Default is to terminate on
-any keypress.
 .IP \-r|\-\-rr
 Run inversion group threads as SCHED_RR (round-robin). The default is
 to run the inversion threads as SCHED_FIFO.
+.IP \-s|\-\-sched
+scheduling options per thread type:
+id=[high|med|low],policy=[fifo,rr],priority=<n>,policy=deadline,runtime=<n>,deadline=<n>,period=<n>
 .IP \-p|\-\-prompt
 Prompt before actually starting the stress test
 .IP \-u|\-\-uniprocessor
Signature · 1 line
2.20.1
author
#8 lore raw

PATCH 5/9 rt-tests: queuelat: get_cpuinfo_mhz.sh highest value

In reply to John Kacur

get_cpuinfo_mhz.sh greps for the Mhz from the /proc/cpuinfo file It assumes that for multiple cpus the value will be the same, and intends to return one value using uniq as a filter.

Typically the reported Mhz values can all be slightly different though It would probably be good enough to simply take the first match as a heuristic, but to be safe, take the highest number.

Also replace the legacy backticks with the modern $(...) construct, and quote the $mhz variable.

---
 src/queuelat/get_cpuinfo_mhz.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
src/queuelat/get_cpuinfo_mhz.sh +2 -3
index eafdd9577424..14a2c12c478f 100755
@@ -3,6 +3,5 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (C) 2018 Marcelo Tosatti <[email protected]>
 
-mhz=`cat /proc/cpuinfo  | grep "cpu MHz" | uniq | cut -f 3 -d " "`
-echo $mhz
-
+mhz=$(grep "cpu MHz" /proc/cpuinfo | cut -f 3 -d " " | sort -rn | head -n1)
+echo "$mhz"
Signature · 1 line
2.20.1
author
#9 lore raw

PATCH 6/9 rt-tests: determine_maximum_mpps.sh: Fix quoting and other shell issue

In reply to John Kacur

Fix a number of issues in the script determine_maximum_mpps.sh such as
1. Convert legacy backticks to $(...) notation
2. Double quote where necessary to prevent globbing
3. Double quote where necessary to prevent word splitting.

Note: these fixes are more than just cosmetic, they are needed for the script to work correctly.

---
 src/queuelat/determine_maximum_mpps.sh | 75 +++++++++++++-------------
 1 file changed, 38 insertions(+), 37 deletions(-)
src/queuelat/determine_maximum_mpps.sh +38 -37
index f6cf1dea27cf..f785147f1bbd 100755
@@ -17,65 +17,65 @@ echo "Determining maximum mpps the machine can handle"
 echo "Will take a few minutes to determine mpps value"
 echo "And 10 minutes run to confirm the final mpps value is stable"
 
-for mpps in `seq 3 3 50`; do
-	echo testing $mpps Mpps
+for mpps in $(seq 3 3 50); do
+	echo testing "$mpps" Mpps
 
-	OUTFILE=`mktemp`
-	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+	OUTFILE=$(mktemp)
+	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(sh get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
 
-	exceeded=`grep exceeded $OUTFILE`
+	exceeded=$(grep exceeded "$OUTFILE")
 	if [ ! -z "$exceeded" ]; then
-		echo mpps failed: $mpps
+		echo mpps failed: "$mpps"
 		break;
 	fi
 	echo success
 done
-echo first loop mpps: $mpps
+echo first loop mpps: "$mpps"
 
 first_mpps=$(($mpps - 1))
-for mpps in `seq $first_mpps -1 3`; do
-	echo testing $mpps Mpps
+for mpps in $(seq $first_mpps -1 3); do
+	echo testing "$mpps" Mpps
 
-	OUTFILE=`mktemp`
-	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+	OUTFILE=$(mktemp)
+	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(sh get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
 
-	exceeded=`grep exceeded $OUTFILE`
+	exceeded=$(grep exceeded "$OUTFILE")
 	if [ -z "$exceeded" ]; then
-		echo mpps success $mpps
+		echo mpps success "$mpps"
 		break;
 	fi
 	echo failure
 done
 
-second_mpps=`echo "$mpps + 0.3" | bc`
-echo second loop mpps: $mpps
+second_mpps=$(echo "$mpps + 0.3" | bc)
+echo second loop mpps: "$mpps"
 
-for mpps in `seq $second_mpps 0.3 $first_mpps`; do
-	echo testing $mpps Mpps
+for mpps in $(seq "$second_mpps" 0.3 $first_mpps); do
+	echo testing "$mpps" Mpps
 
-	OUTFILE=`mktemp`
-	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+	OUTFILE=$(mktemp)
+	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(sh get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
 
-	exceeded=`grep exceeded $OUTFILE`
+	exceeded=$(grep exceeded "$OUTFILE")
 	if [ ! -z "$exceeded" ]; then
-		echo mpps failure $mpps
+		echo mpps failure "$mpps"
 		break;
 	fi
 	echo success
 done
 
-echo third loop mpps: $mpps
-third_mpps=`echo "$mpps -0.1" | bc`
+echo third loop mpps: "$mpps"
+third_mpps=$(echo "$mpps -0.1" | bc)
 
-for mpps in `seq $third_mpps -0.1 3`; do
-	echo testing $mpps Mpps
+for mpps in $(seq "$third_mpps" -0.1 3); do
+	echo testing "$mpps" Mpps
 
-	OUTFILE=`mktemp`
-	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
+	OUTFILE=$(mktemp)
+	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(sh get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
 
-	exceeded=`grep exceeded $OUTFILE`
+	exceeded=$(grep exceeded "$OUTFILE")
 	if [ -z "$exceeded" ]; then
-		echo mpps success $mpps
+		echo mpps success "$mpps"
 		break;
 	fi
 	echo failure
@@ -89,14 +89,14 @@ while [ $queuelat_failure == 1 ]; do
 	echo -n "Starting 10 runs of 30 seconds with "
 	echo "$mpps Mpps"
 
-	for i in `seq 1 10`; do 
-		$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
-		exceeded=`grep exceeded $OUTFILE`
+	for i in $(seq 1 10); do
+		$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(get_cpuinfo_mhz.sh)" -p "$mpps" -t 30 > "$OUTFILE"
+		exceeded=$(grep exceeded "$OUTFILE")
 
 		if [ ! -z "$exceeded" ]; then
 			echo "mpps failure (run $i) $mpps"
 			export queuelat_failure=1
-			mpps=`echo $mpps - 0.1 | bc`
+			mpps=$(echo "$mpps" - 0.1 | bc)
 			export mpps
 			break
 		fi
@@ -113,19 +113,20 @@ while [ $queuelat_failure == 1 ]; do
 	echo -n "Starting 10 minutes run with "
 	echo "$mpps Mpps"
 
-	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `get_cpuinfo_mhz.sh` -p "$mpps" -t 600 > $OUTFILE
-	exceeded=`grep exceeded $OUTFILE`
+	$PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f "$(get_cpuinfo_mhz.sh)" -p "$mpps" -t 600 > "$OUTFILE"
+	exceeded=$(grep exceeded "$OUTFILE")
 
 	if [ ! -z "$exceeded" ]; then
 		echo "mpps failure (run $i) $mpps"
 		export queuelat_failure=1
-		export mpps=`echo $mpps - 0.1 | bc`
+		mpps=$(echo "$mpps" - 0.1 | bc)
+		export mpps
 		continue
 	fi
 	echo "run $i success"
 done
 
-echo Final mpps is: $mpps
+echo Final mpps is: "$mpps"
 
 unset queuelat_failure
 unset mpps
Signature · 1 line
2.20.1
author
#10 lore raw

PATCH 7/9 rt-tests: ptsematest: Update man page and add -h option

In reply to John Kacur

- Update the man page with the -s or --smp option
- Reorder the program help to match the man page
- Make the -h option work correctly

---
 src/ptsematest/ptsematest.8 |  3 +++
 src/ptsematest/ptsematest.c | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
src/ptsematest/ptsematest.8 +3 -0
index 4bb1434babf4..8f76bca4b6a8 100644
@@ -35,6 +35,9 @@ Set the number of loops. The default is 0 (endless). This option is useful for a
 .B \-p, \-\-prio=PRIO
 Set the priority of the process.
 .TP
+.B \-s, \-\-smp
+SMP testing: options -a -t and same priority
+.TP
 .B \-t, \-\-threads[=NUM]
 Set the number of test threads (default is 1, if this option is not given). If NUM is specified, create NUM test threads. If NUM is not specified, NUM is set to the number of available CPUs.
 .SH "EXAMPLES"
src/ptsematest/ptsematest.c +6 -4
index 78fa444c5578..485c991ec173 100644
@@ -154,10 +154,10 @@ static void display_help(void)
 	"                           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"
-	"-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"
+	"-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"
@@ -202,7 +202,7 @@ static void process_options (int argc, char *argv[])
 			{"help", no_argument, NULL, '?'},
 			{NULL, 0, NULL, 0}
 		};
-		int c = getopt_long (argc, argv, "a::b:d:i:l:D:p:St::",
+		int c = getopt_long (argc, argv, "a::b:d:i:l:D:p:St::h",
 			long_options, &option_index);
 		if (c == -1)
 			break;
@@ -245,6 +245,8 @@ static void process_options (int argc, char *argv[])
 			else
 				num_threads = max_cpus;
 			break;
+		case 'h':
+			display_help();
 		case '?': error = 1; break;
 		}
 	}
@@ -275,7 +277,7 @@ static void process_options (int argc, char *argv[])
 		sameprio = 1;
 
 	if (error)
-		display_help ();
+		display_help();
 }
 
 
Signature · 1 line
2.20.1
author
#11 lore raw

PATCH 8/9 rt-tests: queuelat: Fixes to man page and display_help

In reply to John Kacur

- Make sure that help is displayed and not just the message "Unknown option" when the options are incorrect.
- Add -q to the man page and to the print_help()

---
 src/queuelat/queuelat.8 |  4 +++-
 src/queuelat/queuelat.c | 22 +++++++++++++---------
 2 files changed, 16 insertions(+), 10 deletions(-)
src/queuelat/queuelat.8 +3 -1
index d68beb98bff7..f67a0bb7556e 100644
@@ -52,7 +52,9 @@ TSC frequency in MHz.
 .TP
 .B \-t timeout
 Timeout in seconds to quit the program.
-
+.TP
+.B \-q min_queue_len_to_print_trace
+Minimum queue length to print in the trace
 
 .SH AUTHOR
 queuelat was written by Marcelo Tosatti <[email protected]>
src/queuelat/queuelat.c +13 -9
index 98346f346f82..7e5e35768a8b 100644
@@ -571,6 +571,7 @@ void print_help(void)
 	printf("-p million-packet-per-sec (million packets per second) (float)\n");
 	printf("-f tsc-freq-mhz (TSC frequency in MHz) (float)\n");
 	printf("-t timeout (timeout, in seconds) (int)\n");
+	printf("-q min_queue_len_to_print_trace (int)\n");
 }
 
 int main(int argc, char **argv)
@@ -616,22 +617,25 @@ int main(int argc, char **argv)
 			return 0;
 		case '?':
 			if (optopt == 'm' || optopt == 'c' || optopt == 'p' ||
-			    optopt == 'f' || optopt == 't' || optopt == 'q')
+			    optopt == 'f' || optopt == 't' || optopt == 'q') {
 				printf ("Option -%c requires an argument.\n", optopt);
-			else if (isprint (optopt))
+			} else if (isprint (optopt)) {
 				printf ("Unknown option `-%c'.\n", optopt);
-			else
-				printf ( "Unknown option character `\\x%x'.\n",
-
-optopt);
+				print_help();
+				return 1;
+			} else {
+				printf ( "Unknown option character `\\x%x'.\n", optopt);
+				print_help();
 				return 1;
-			default:
-				abort ();
+			}
+			break;
+		default:
+			abort ();
 		}
 
 	if (mvalue == NULL || cvalue == NULL || pvalue == NULL ||
 	    fvalue == NULL) {
-		printf("options -m, -c, -p and -f required.\n");
+		printf("options -m, -c, -p and -f are required.\n");
 		printf("usage: %s -m maxlatency -c cycles_per_packet -p mpps(million-packet-per-sec) -f tsc_freq_mhz [-t timeout (in secs)] [-q min_queue_len_to_print_trace]\n", argv[0]);
 		return 1;
 	}
Signature · 1 line
2.20.1
author
#12 lore raw

PATCH 9/9 rt-tests: svsematest: Display help with an error message for -h

In reply to John Kacur

Display help without an error message if the user uses the -h option

---
 src/svsematest/svsematest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/svsematest/svsematest.c +2 -1
index 7c15393fe1be..023a303fd7df 100644
@@ -281,7 +281,7 @@ static void process_options (int argc, char *argv[])
 			{"help", no_argument, NULL, '?'},
 			{NULL, 0, NULL, 0}
 		};
-		int c = getopt_long (argc, argv, "a::b:d:f::i:l:D:p:St::",
+		int c = getopt_long (argc, argv, "a::b:d:f::i:l:D:p:St::h",
 			long_options, &option_index);
 		if (c == -1)
 			break;
@@ -335,6 +335,7 @@ static void process_options (int argc, char *argv[])
 			else
 				num_threads = max_cpus;
 			break;
+		case 'h': error = 1; break;
 		case '?': error = 1; break;
 		}
 	}
Signature · 1 line
2.20.1
#13 lore raw
In reply to John Kacur

John,

Thanks for this! I suspect we now need an 8.3 bz for updating the rt-tests package to the latest upstream version.

Clark

Quoted 40 lines · On Thu, 23 Jan 2020 21:50:20 +0100 John Kacur <[email protected]> wrote:

Most of the fixes here are just clean-ups to make sure that online help or usage message match the man pages according to the current options.

Some fixes to the queuelat scripts determine_maximum_mpps.sh and get_cpuinfo_mhz.sh are perhaps notable though, as people were having trouble using them.

getcpuinfo_mhz.sh now only gets one value as was originally intended, and it gets the highest value available. The fixes to quoting in determine_maximum_mpps.sh should make the program work correctly now - and take longer though.

John Kacur (9):
rt-tests: queuelat: Assume queuelat is in the path
rt-tests: cyclicdeadline: Add a simple manpage for cyclicdeadline
rt-tests: pi_stress: Add short options to usage message
rt-tests: pi_stress: Sync man page with help
rt-tests: queuelat: get_cpuinfo_mhz.sh highest value
rt-tests: determine_maximum_mpps.sh: Fix quoting and other shell issue
rt-tests: ptsematest: Update man page and add -h option
rt-tests: queuelat: Fixes to man page and display_help
rt-tests: svsematest: Display help with an error message for -h

 Makefile                               |  1 +
 src/pi_tests/pi_stress.8               |  9 ++--
 src/pi_tests/pi_stress.c               | 34 ++++++------
 src/ptsematest/ptsematest.8            |  3 ++
 src/ptsematest/ptsematest.c            | 10 ++--
 src/queuelat/determine_maximum_mpps.sh | 75 +++++++++++++-------------
 src/queuelat/get_cpuinfo_mhz.sh        |  5 +-
 src/queuelat/queuelat.8                |  4 +-
 src/queuelat/queuelat.c                | 22 ++++----
 src/sched_deadline/cyclicdeadline.8    | 53 ++++++++++++++++++
 src/svsematest/svsematest.c            |  3 +-
 11 files changed, 141 insertions(+), 78 deletions(-)
 create mode 100644 src/sched_deadline/cyclicdeadline.8
Signature · 1 line
2.20.1
Signature · 2 lines
The United States Coast Guard
Ruining Natural Selection since 1790