summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2019-11-18 20:31:50 +0100
committerJohn Kacur <jkacur@redhat.com>2019-11-18 20:31:50 +0100
commitc5aa9a877b146846da21e5d63597a2a09a3c96d7 (patch)
tree8d637aa5d9a273cffcb49ddf24d959dccd25de5f
parent90449d993fc9973381f1c37fbda37c39a43ab503 (diff)
parente782ceaafce358c0067eb6405c3412d5e899d4fc (diff)
downloadrt-tests-unstable/devel/latest-devel.tar.gz
Merge branch 'unstable/devel/latest' into unstable/devel/latest-develunstable/devel/latest-devel
-rw-r--r--Makefile4
-rw-r--r--src/cyclictest/cyclictest.c4
-rwxr-xr-xsrc/queuelat/determine_maximum_mpps.sh15
-rw-r--r--src/ssdd/ssdd.810
-rw-r--r--src/ssdd/ssdd.c45
5 files changed, 57 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index b573408..6eee3d8 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,6 @@ DESTDIR ?=
prefix ?= /usr/local
bindir ?= $(prefix)/bin
mandir ?= $(prefix)/share/man
-srcdir ?= $(prefix)/src
CFLAGS ?= -Wall -Wno-nonnull
CPPFLAGS += -D_GNU_SOURCE -Isrc/include
@@ -177,8 +176,7 @@ rebuild:
.PHONY: install
install: all install_hwlatdetect
- mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man4"
- mkdir -p "$(DESTDIR)$(srcdir)" "$(DESTDIR)$(mandir)/man8"
+ mkdir -p "$(DESTDIR)$(bindir)" "$(DESTDIR)$(mandir)/man8"
cp $(TARGETS) "$(DESTDIR)$(bindir)"
install src/queuelat/get_cpuinfo_mhz.sh "$(DESTDIR)$(bindir)"
install src/queuelat/determine_maximum_mpps.sh "${DESTDIR}${bindir}"
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 6be0525..bca028f 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -802,7 +802,7 @@ static void *timerthread(void *param)
ret = clock_gettime(par->clock, &now);
if (ret != 0) {
if (ret != EINTR)
- warn("clock_getttime() failed. errno: %d\n",
+ warn("clock_gettime() failed. errno: %d\n",
errno);
goto out;
}
@@ -964,7 +964,7 @@ static void display_help(int error)
" but will not drain your battery so quickly\n"
"-m --mlockall lock current and future memory allocations\n"
"-M --refresh_on_max delay updating the screen until a new max\n"
- " latency is hit. Userful for low bandwidth.\n"
+ " latency is hit. Useful for low bandwidth.\n"
"-N --nsecs print results in ns instead of us (default us)\n"
"-o RED --oscope=RED oscilloscope mode, reduce verbose output by RED\n"
"-p PRIO --priority=PRIO priority of highest prio thread\n"
diff --git a/src/queuelat/determine_maximum_mpps.sh b/src/queuelat/determine_maximum_mpps.sh
index cd45454..3acd6ba 100755
--- a/src/queuelat/determine_maximum_mpps.sh
+++ b/src/queuelat/determine_maximum_mpps.sh
@@ -18,7 +18,7 @@ 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
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ ! -z "$exceeded" ]; then
@@ -34,7 +34,7 @@ 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
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ -z "$exceeded" ]; then
@@ -51,7 +51,7 @@ 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
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ ! -z "$exceeded" ]; then
@@ -68,7 +68,7 @@ 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
+ $PREAMBLE queuelat -m $MAXLAT -c $CYCLES_PER_PACKET -f `sh get_cpuinfo_mhz.sh` -p "$mpps" -t 30 > $OUTFILE
exceeded=`grep exceeded $OUTFILE`
if [ -z "$exceeded" ]; then
@@ -87,13 +87,14 @@ 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
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
break
fi
echo "run $i success"
@@ -109,7 +110,7 @@ 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
+ $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
diff --git a/src/ssdd/ssdd.8 b/src/ssdd/ssdd.8
index 4463848..99f3014 100644
--- a/src/ssdd/ssdd.8
+++ b/src/ssdd/ssdd.8
@@ -3,7 +3,7 @@
ssdd \- have a tracer do a bunch of PTRACE_SINGLESTEPs
.SH SYNOPSIS
.B ssdd
-.RI "[nforks] [niters]"
+.RI "<options>"
.SH DESCRIPTION
Have a tracer do a bunch of PTRACE_SINGLESTEPs against
a tracee as fast as possible. Create several of these
@@ -12,15 +12,19 @@ interfere with each other.
The tracer waits on each PTRACE_SINGLESTEP with a waitpid(2)
and checks that waitpid's return values for correctness.
.SH OPTIONS
-.B nforks
+.B \-f, \-\-forks
number of tracer/tracee pairs to fork off.
Default is 10.
.br
.TP
-.B niters
+.B \-i, \-\-iters
number of PTRACE_SINGLESTEP iterations to
do before declaring success, for each tracer/
tracee pair set up. Default is 10,000.
+.br
+.TP
+.B \-h, \-\-help
+Display usage
.SH AUTHOR
ssdd was written by Joe Korty <joe.korty@concurrent-rt.com>
diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index 2c3a779..080ed17 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
+#include <getopt.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
@@ -65,6 +66,17 @@ static const char *get_state_name(int state)
static int got_sigchld;
+enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP };
+
+static void usage()
+{
+ printf("ssdd <options>\n");
+ printf("\t-f --forks=<number of forks>\n");
+ printf("\t-i --iters=<number of iterations>\n");
+ printf("\t-h --help\n");
+ exit(0);
+}
+
static int do_wait(pid_t *wait_pid, int *ret_sig)
{
int status, child_status;
@@ -276,13 +288,34 @@ int main(int argc, char **argv)
setbuf(stdout, NULL);
- argc--, argv++;
- if (argc) {
- nforks = atoi(*argv);
- argc--, argv++;
- if (argc)
- nsteps = atoi(*argv);
+ for (;;) {
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"forks", required_argument, NULL, OPT_NFORKS},
+ {"iters", required_argument, NULL, OPT_NITERS},
+ {"help", no_argument, NULL, OPT_HELP},
+ {NULL, 0, NULL, 0},
+ };
+ int c = getopt_long(argc, argv, "f:i:h", long_options, &option_index);
+ if (c == -1)
+ break;
+ switch(c) {
+ case 'f':
+ case OPT_NFORKS:
+ nforks = atoi(optarg);
+ break;
+ case 'i':
+ case OPT_NITERS:
+ nsteps = atoi(optarg);
+ break;
+ case 'h':
+ case OPT_HELP:
+ usage();
+ break;
+ }
}
+
printf("#main : %d\n", getpid());
printf("#forks: %d\n", nforks);
printf("#steps: %d\n", nsteps);