linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/12] rt-tests: Add --duration argument to tests
@ 2019-06-05 16:06 Daniel Wagner
  2019-06-05 16:06 ` [PATCH v2 01/12] rt_numa.h: Remove unused function Daniel Wagner
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

An updated version of the --duration series.
It is also available from github:

https://github.com/igaw/rt-tests/tree/dw-devel

changes since v1:
 - '--duration' patch splitted up
 - added short option support to pi_stress
 - added build warning
 - added 32bit ARM 'support' to queuelat patch

Daniel Wagner (12):
  rt_numa.h: Remove unused function
  queuelat: Use clock syscall for ARM 32 bit
  rt-utils: Move parse_time_string()
  pi_stress: Allow short command line arguments
  pi_stress: Rename -t command line option to -D
  pmqtest: Add duration command line argument
  ptsematest: Add duration command line argument
  cyclicdeadline: Add duration command line argument
  signaltest: Add duration command line argument
  sigwaittest: Add duration command line argument
  svsematest: Add duration command line argument
  rt-migrate-test: Add duration command line argument

 src/cyclictest/cyclictest.c           | 33 --------------------------
 src/cyclictest/rt_numa.h              |  7 ------
 src/include/rt-utils.h                |  2 ++
 src/lib/rt-utils.c                    | 34 +++++++++++++++++++++++++++
 src/pi_tests/pi_stress.8              |  4 ++++
 src/pi_tests/pi_stress.c              | 12 +++++-----
 src/pmqtest/pmqtest.8                 |  5 ++++
 src/pmqtest/pmqtest.c                 | 17 ++++++++++++--
 src/ptsematest/ptsematest.8           |  5 ++++
 src/ptsematest/ptsematest.c           | 14 ++++++++++-
 src/queuelat/queuelat.c               | 31 ++++++++++++++++++++----
 src/rt-migrate-test/rt-migrate-test.8 |  5 ++++
 src/rt-migrate-test/rt-migrate-test.c | 12 +++++++++-
 src/sched_deadline/cyclicdeadline.c   | 12 +++++++++-
 src/signaltest/signaltest.8           |  5 ++++
 src/signaltest/signaltest.c           | 14 ++++++++++-
 src/sigwaittest/sigwaittest.8         |  5 ++++
 src/sigwaittest/sigwaittest.c         | 15 +++++++++++-
 src/svsematest/svsematest.8           |  5 ++++
 src/svsematest/svsematest.c           | 15 +++++++++++-
 20 files changed, 193 insertions(+), 59 deletions(-)

-- 
2.20.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 01/12] rt_numa.h: Remove unused function
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-13 13:48   ` John Kacur
  2019-06-05 16:06 ` [PATCH v2 02/12] queuelat: Use clock syscall for ARM 32 bit Daniel Wagner
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

From: Daniel Wagner <daniel.wagner@siemens.com>

GCC on a BeagleBoneBlack complains:

In file included from src/cyclictest/cyclictest.c:39:0:
src/cyclictest/rt_numa.h:253:13: warning: ‘numa_on_and_available’ defined but not used [-Wunused-function]
 static void numa_on_and_available()
             ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
---
 src/cyclictest/rt_numa.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
index e8cd7f481baa..e0f4b2e9d8b2 100644
--- a/src/cyclictest/rt_numa.h
+++ b/src/cyclictest/rt_numa.h
@@ -249,13 +249,6 @@ static inline void rt_bitmask_free(struct bitmask *mask)
 	free(mask);
 }
 
-
-static void numa_on_and_available()
-{
-	if (numa) /* NUMA is not defined here */
-		fatal("numa mode and numa functions not available.\n");
-}
-
 #endif	/* NUMA */
 
 /*
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 02/12] queuelat: Use clock syscall for ARM 32 bit
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
  2019-06-05 16:06 ` [PATCH v2 01/12] rt_numa.h: Remove unused function Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-13 13:51   ` John Kacur
  2019-06-05 16:06 ` [PATCH v2 03/12] rt-utils: Move parse_time_string() Daniel Wagner
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

CPUs such as Cortex-M8 don't have a rdtsc instruction. Fallback using
a syscall.

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
 src/queuelat/queuelat.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
index 3b291f168768..a5525e41776a 100644
--- a/src/queuelat/queuelat.c
+++ b/src/queuelat/queuelat.c
@@ -7,6 +7,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <signal.h>
+#include <time.h>
 
 #define NSEC_PER_SEC 1000000000
 
@@ -249,6 +250,8 @@ typedef unsigned long long cycles_t;
 typedef unsigned long long usecs_t;
 typedef unsigned long long u64;
 
+#if defined __x86_64__ || defined __i386__
+
 #ifdef __x86_64__
 #define DECLARE_ARGS(val, low, high)    unsigned low, high
 #define EAX_EDX_VAL(val, low, high)     ((low) | ((u64)(high) << 32))
@@ -270,7 +273,25 @@ static inline unsigned long long __rdtscll(void)
         return EAX_EDX_VAL(val, low, high);
 }
 
-#define rdtscll(val) do { (val) = __rdtscll(); } while (0)
+#define gettick(val) do { (val) = __rdtscll(); } while (0)
+
+#elif defined __arm__
+
+static inline unsigned long long __clock_gettime(void)
+{
+	struct timespec now;
+	int ret;
+
+	ret = clock_gettime(CLOCK_MONOTONIC, &now);
+	if (ret < 0)
+		return 0;
+
+	return now.tv_nsec;
+}
+
+#define gettick(val) do { (val) = __clock_gettime(); } while (0)
+
+#endif
 
 static void init_buckets(void)
 {
@@ -348,9 +369,9 @@ static void run_n(int n)
 
 	memmove(dest, src, n);
 	for (i = 0; i < loops; i++) {
-		rdtscll(b);
+		gettick(b);
 		memmove(dest, src, n);
-		rdtscll(a);
+		gettick(a);
 		delta = (a - b) * cycles_to_ns;
 		account(delta);
 	}
@@ -446,9 +467,9 @@ void main_loop(void)
 		int ret;
 		int nr_packets_fill;
 
-		rdtscll(b);
+		gettick(b);
 		memmove(dest, src, default_n);
-		rdtscll(a);
+		gettick(a);
 		delta = (a - b) * cycles_to_ns;
 		account(delta);
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 03/12] rt-utils: Move parse_time_string()
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
  2019-06-05 16:06 ` [PATCH v2 01/12] rt_numa.h: Remove unused function Daniel Wagner
  2019-06-05 16:06 ` [PATCH v2 02/12] queuelat: Use clock syscall for ARM 32 bit Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-13 13:57   ` John Kacur
  2019-06-05 16:06 ` [PATCH v2 04/12] pi_stress: Allow short command line arguments Daniel Wagner
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

Move parse_time_string() to rt-utils.c so we can re use it.

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
 src/cyclictest/cyclictest.c | 33 ---------------------------------
 src/include/rt-utils.h      |  2 ++
 src/lib/rt-utils.c          | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index ed59edefbf97..03d56e4f520c 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -406,39 +406,6 @@ static void enable_trace_mark(void)
 	open_tracemark_fd();
 }
 
-/*
- * parse an input value as a base10 value followed by an optional
- * suffix. The input value is presumed to be in seconds, unless
- * followed by a modifier suffix: m=minutes, h=hours, d=days
- *
- * the return value is a value in seconds
- */
-static int parse_time_string(char *val)
-{
-	char *end;
-	int t = strtol(val, &end, 10);
-	if (end) {
-		switch (*end) {
-		case 'm':
-		case 'M':
-			t *= 60;
-			break;
-
-		case 'h':
-		case 'H':
-			t *= 60*60;
-			break;
-
-		case 'd':
-		case 'D':
-			t *= 24*60*60;
-			break;
-
-		}
-	}
-	return t;
-}
-
 /*
  * Raise the soft priority limit up to prio, if that is less than or equal
  * to the hard limit
diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
index ef0f6acf4ab5..405fa7855346 100644
--- a/src/include/rt-utils.h
+++ b/src/include/rt-utils.h
@@ -24,4 +24,6 @@ uint32_t string_to_policy(const char *str);
 
 pid_t gettid(void);
 
+int parse_time_string(char *val);
+
 #endif	/* __RT_UTILS.H */
diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
index ac6878ccacf1..e1b166afcd6c 100644
--- a/src/lib/rt-utils.c
+++ b/src/lib/rt-utils.c
@@ -13,6 +13,7 @@
 #include <sched.h>
 #include <stdarg.h>
 #include <errno.h>
+#include <ctype.h>
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -320,3 +321,36 @@ pid_t gettid(void)
 {
 	return syscall(SYS_gettid);
 }
+
+/*
+ * parse an input value as a base10 value followed by an optional
+ * suffix. The input value is presumed to be in seconds, unless
+ * followed by a modifier suffix: m=minutes, h=hours, d=days
+ *
+ * the return value is a value in seconds
+ */
+int parse_time_string(char *val)
+{
+	char *end;
+	int t = strtol(val, &end, 10);
+	if (end) {
+		switch (*end) {
+		case 'm':
+		case 'M':
+			t *= 60;
+			break;
+
+		case 'h':
+		case 'H':
+			t *= 60*60;
+			break;
+
+		case 'd':
+		case 'D':
+			t *= 24*60*60;
+			break;
+
+		}
+	}
+	return t;
+}
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 04/12] pi_stress: Allow short command line arguments
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
                   ` (2 preceding siblings ...)
  2019-06-05 16:06 ` [PATCH v2 03/12] rt-utils: Move parse_time_string() Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-13 14:04   ` John Kacur
  2019-06-05 16:06 ` [PATCH v2 05/12] pi_stress: Rename -t command line option to -D Daniel Wagner
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

Add optstring to getopt_long() command line parser to support the
short options as it documented in the man page and also in the usage
help text.

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
 src/pi_tests/pi_stress.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index ac7646cd2613..543106be8e18 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -1322,9 +1322,8 @@ int process_sched_line(const char *arg)
 void process_command_line(int argc, char **argv)
 {
 	int opt;
-	while ((opt = getopt_long(argc, argv, "+", options, NULL)) != -1) {
+	while ((opt = getopt_long(argc, argv, "+ht:vqi:g:rs:pdVum", options, NULL)) != -1) {
 		switch (opt) {
-		case '?':
 		case 'h':
 			usage();
 			exit(0);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 05/12] pi_stress: Rename -t command line option to -D
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
                   ` (3 preceding siblings ...)
  2019-06-05 16:06 ` [PATCH v2 04/12] pi_stress: Allow short command line arguments Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-13 14:07   ` John Kacur
  2019-06-05 16:06 ` [PATCH v2 06/12] pmqtest: Add duration command line argument Daniel Wagner
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

Streamline the duration command line argument for all rt-tests. While
at it also add man page.

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
 src/pi_tests/pi_stress.8 |  4 ++++
 src/pi_tests/pi_stress.c | 11 ++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/pi_tests/pi_stress.8 b/src/pi_tests/pi_stress.8
index c92b4bdf5609..475d3c34f135 100644
--- a/src/pi_tests/pi_stress.8
+++ b/src/pi_tests/pi_stress.8
@@ -57,6 +57,10 @@ seconds and then terminate.
 The number of inversion groups to run. Defaults to 10.
 .IP \-d|\-\-debug
 Run in debug mode; lots of extra prints
+.IP "\-D, \-\-duration=TIME"
+Specify a length for the test run.
+.br
+Append 'm', 'h', or 'd' to specify minutes, hours or days.
 .IP \-v|\-\-verbose
 Run with verbose messages
 .IP \-s|\-\-signal
diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index 543106be8e18..1286370c474b 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -146,7 +146,7 @@ int lockall = 0;
 
 /* command line options */
 struct option options[] = {
-	{"duration", required_argument, NULL, 't'},
+	{"duration", required_argument, NULL, 'D'},
 	{"verbose", no_argument, NULL, 'v'},
 	{"quiet", no_argument, NULL, 'q'},
 	{"groups", required_argument, NULL, 'g'},
@@ -1027,7 +1027,8 @@ void usage(void)
 	printf("\t--verbose\t- lots of output\n");
 	printf("\t--quiet\t\t- suppress running output\n");
 	printf
-	    ("\t--duration=<n>- length of the test run in seconds [infinite]\n");
+	    ("\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",
 	       ngroups);
 	printf
@@ -1322,13 +1323,13 @@ int process_sched_line(const char *arg)
 void process_command_line(int argc, char **argv)
 {
 	int opt;
-	while ((opt = getopt_long(argc, argv, "+ht:vqi:g:rs:pdVum", options, NULL)) != -1) {
+	while ((opt = getopt_long(argc, argv, "+hD:vqi:g:rs:pdVum", options, NULL)) != -1) {
 		switch (opt) {
 		case 'h':
 			usage();
 			exit(0);
-		case 't':
-			duration = strtol(optarg, NULL, 10);
+		case 'D':
+			duration = parse_time_string(optarg);
 			break;
 		case 'v':
 			verbose = 1;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 06/12] pmqtest: Add duration command line argument
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
                   ` (4 preceding siblings ...)
  2019-06-05 16:06 ` [PATCH v2 05/12] pi_stress: Rename -t command line option to -D Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-13 14:10   ` John Kacur
  2019-06-05 16:06 ` [PATCH v2 07/12] ptsematest: " Daniel Wagner
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

Many of the test programs have the --loop argument for automatic
stopping. The main problem with the --loop argument is how long is
--loop 1000?

To simplify automated tests introduce a --duration argument which
allows to set the time how long a test should run. This allows the
test suite to define the execution time and also the timeout which a
normal human can understand.

For example run the test for 10 minutes and timeout at 11 minutes:

  # timeout 11m pmqtest -D 10m

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
 src/pmqtest/pmqtest.8 |  5 +++++
 src/pmqtest/pmqtest.c | 17 +++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/pmqtest/pmqtest.8 b/src/pmqtest/pmqtest.8
index 05421e01e70b..9108a939b9f7 100644
--- a/src/pmqtest/pmqtest.8
+++ b/src/pmqtest/pmqtest.8
@@ -21,6 +21,11 @@ It is useful to track down unexpected large latencies of a system.
 .B \-d, \-\-distance=DIST
 Set the distance of thread intervals in microseconds (default is 500 us). When pmqtest is called with the -t option and more than one thread is created, then this distance value is added to the interval of the threads: Interval(thread N) = Interval(thread N-1) + DIST
 .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 \-f, \-\-forcetimeout=TO
 Set an artificial delay of the send function to force timeout of the receiver, requires the -T option
 .TP
diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
index 75d5ee8185a0..054768d161a7 100644
--- a/src/pmqtest/pmqtest.c
+++ b/src/pmqtest/pmqtest.c
@@ -252,6 +252,8 @@ static void display_help(void)
 	"-f TO    --forcetimeout=TO force timeout of mq_timedreceive(), requires -T\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"
@@ -271,6 +273,7 @@ static int tracelimit;
 static int priority;
 static int num_threads = 1;
 static int max_cycles;
+static int duration;
 static int interval = 1000;
 static int distance = 500;
 static int smp;
@@ -293,6 +296,7 @@ static void process_options (int argc, char *argv[])
 			{"forcetimeout", required_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'},
@@ -300,7 +304,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:p:St::T:",
+		int c = getopt_long (argc, argv, "a::b:d:f:i:l:D:p:St::T:",
 			long_options, &option_index);
 		if (c == -1)
 			break;
@@ -325,6 +329,7 @@ static void process_options (int argc, char *argv[])
 		case 'f': forcetimeout = atoi(optarg); 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;
@@ -369,7 +374,10 @@ static void process_options (int argc, char *argv[])
 
 	if (forcetimeout && !timeout)
 		error = 1;
- 
+
+	if (duration < 0)
+		error = 1;
+
 	if (priority && smp)
 		sameprio = 1;
 
@@ -418,10 +426,15 @@ int main(int argc, char *argv[])
 	sigemptyset(&sigset);
 	sigaddset(&sigset, SIGTERM);
 	sigaddset(&sigset, SIGINT);
+	sigaddset(&sigset, SIGALRM);
 	pthread_sigmask(SIG_SETMASK, &sigset, NULL);
 
 	signal(SIGINT, sighand);
 	signal(SIGTERM, sighand);
+	signal(SIGALRM, sighand);
+
+	if (duration)
+		alarm(duration);
 
 	receiver = calloc(num_threads, sizeof(struct params));
 	sender = calloc(num_threads, sizeof(struct params));
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 07/12] ptsematest: Add duration command line argument
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
                   ` (5 preceding siblings ...)
  2019-06-05 16:06 ` [PATCH v2 06/12] pmqtest: Add duration command line argument Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-05 16:06 ` [PATCH v2 08/12] cyclicdeadline: " Daniel Wagner
  2019-06-05 16:06 ` [PATCH v2 09/12] signaltest: " Daniel Wagner
  8 siblings, 0 replies; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

Many of the test programs have the --loop argument for automatic
stopping. The main problem with the --loop argument is how long is
--loop 1000?

To simplify automated tests introduce a --duration argument which
allows to set the time how long a test should run. This allows the
test suite to define the execution time and also the timeout which a
normal human can understand.

For example run the test for 10 minutes and timeout at 11 minutes:

  # timeout 11m ptsematest -D 10m

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
 src/ptsematest/ptsematest.8 |  5 +++++
 src/ptsematest/ptsematest.c | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/ptsematest/ptsematest.8 b/src/ptsematest/ptsematest.8
index 9d835337ec27..289f3a1d7ae8 100644
--- a/src/ptsematest/ptsematest.8
+++ b/src/ptsematest/ptsematest.8
@@ -21,6 +21,11 @@ It is useful to track down unexpected large latencies of a system.
 .B \-d, \-\-distance=DIST
 Set the distance of thread intervals in microseconds (default is 500 us). When  cyclictest is called with the -t option and more than one thread is created, then this distance value is added to the interval of the threads: Interval(thread N) = Interval(thread N-1) + DIST
 .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 \-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 a31c745ec928..6bedbc81b572 100644
--- a/src/ptsematest/ptsematest.c
+++ b/src/ptsematest/ptsematest.c
@@ -173,6 +173,8 @@ static void display_help(void)
 	"-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"
 	"-p PRIO  --prio=PRIO       priority\n"
 	"-S       --smp             SMP testing: options -a -t and same priority\n"
         "                           of all threads\n"
@@ -190,6 +192,7 @@ static int tracelimit;
 static int priority;
 static int num_threads = 1;
 static int max_cycles;
+static int duration;
 static int interval = 1000;
 static int distance = 500;
 static int smp;
@@ -209,13 +212,14 @@ static void process_options (int argc, char *argv[])
 			{"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, '?'},
 			{NULL, 0, NULL, 0}
 		};
-		int c = getopt_long (argc, argv, "a::b:d:i:l:p:St::",
+		int c = getopt_long (argc, argv, "a::b:d:i:l:D:p:St::",
 			long_options, &option_index);
 		if (c == -1)
 			break;
@@ -239,6 +243,7 @@ static void process_options (int argc, char *argv[])
 		case 'd': distance = atoi(optarg); 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;
@@ -280,6 +285,9 @@ static void process_options (int argc, char *argv[])
 	if (num_threads < 1)
 		error = 1;
 
+	if (duration < 0)
+		error = 1;
+
 	if (priority && smp)
 		sameprio = 1;
 
@@ -317,6 +325,10 @@ int main(int argc, char *argv[])
 
 	signal(SIGINT, sighand);
 	signal(SIGTERM, sighand);
+	signal(SIGALRM, sighand);
+
+	if (duration)
+		alarm(duration);
 
 	receiver = calloc(num_threads, sizeof(struct params));
 	sender = calloc(num_threads, sizeof(struct params));
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 08/12] cyclicdeadline: Add duration command line argument
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
                   ` (6 preceding siblings ...)
  2019-06-05 16:06 ` [PATCH v2 07/12] ptsematest: " Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-13 14:18   ` John Kacur
  2019-06-13 14:40   ` John Kacur
  2019-06-05 16:06 ` [PATCH v2 09/12] signaltest: " Daniel Wagner
  8 siblings, 2 replies; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

Many of the test programs have the --loop argument for automatic
stopping. The main problem with the --loop argument is how long is
--loop 1000?

To simplify automated tests introduce a --duration argument which
allows to set the time how long a test should run. This allows the
test suite to define the execution time and also the timeout which a
normal human can understand.

For example run the test for 10 minutes and timeout at 11 minutes:

  # timeout 11m cyclicdeadline -D 10m

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
 src/sched_deadline/cyclicdeadline.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 6d461b27ac43..47892daf747b 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -21,6 +21,8 @@
 #include <linux/unistd.h>
 #include <linux/magic.h>
 
+#include <rt-utils.h>
+
 #ifdef __i386__
 #ifndef __NR_sched_setattr
 #define __NR_sched_setattr		351
@@ -1049,6 +1051,7 @@ int main (int argc, char **argv)
 	unsigned int interval = 1000;
 	unsigned int step = 500;
 	int percent = 60;
+	int duration = 0;
 	u64 runtime;
 	u64 start_period;
 	u64 end_period;
@@ -1062,7 +1065,7 @@ int main (int argc, char **argv)
 		exit(-1);
 	}
 
-	while ((c = getopt(argc, argv, "+hac:i:s:t:")) >= 0) {
+	while ((c = getopt(argc, argv, "+hac:i:s:t:D:")) >= 0) {
 		switch (c) {
 		case 'a':
 			all_cpus = 1;
@@ -1081,6 +1084,9 @@ int main (int argc, char **argv)
 		case 't':
 			nr_threads = atoi(optarg);
 			break;
+		case 'D':
+			duration = parse_time_string(optarg);
+			break;
 		case 'h':
 		default:
 			usage(argv);
@@ -1246,6 +1252,10 @@ int main (int argc, char **argv)
 
 	signal(SIGINT, sighand);
 	signal(SIGTERM, sighand);
+	signal(SIGALRM, sighand);
+
+	if (duration)
+		alarm(duration);
 
 	if (!fail)
 		loop(sched_data, nr_threads);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 09/12] signaltest: Add duration command line argument
  2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
                   ` (7 preceding siblings ...)
  2019-06-05 16:06 ` [PATCH v2 08/12] cyclicdeadline: " Daniel Wagner
@ 2019-06-05 16:06 ` Daniel Wagner
  2019-06-13 19:07   ` John Kacur
  8 siblings, 1 reply; 21+ messages in thread
From: Daniel Wagner @ 2019-06-05 16:06 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users, Daniel Wagner

Many of the test programs have the --loop argument for automatic
stopping. The main problem with the --loop argument is how long is
--loop 1000?

To simplify automated tests introduce a --duration argument which
allows to set the time how long a test should run. This allows the
test suite to define the execution time and also the timeout which a
normal human can understand.

For example run the test for 10 minutes and timeout at 11 minutes:

  # timeout 11m signaltest -D 10m

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
 src/signaltest/signaltest.8 |  5 +++++
 src/signaltest/signaltest.c | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/signaltest/signaltest.8 b/src/signaltest/signaltest.8
index 634d392a6da5..bd6ffe5c7a36 100644
--- a/src/signaltest/signaltest.8
+++ b/src/signaltest/signaltest.8
@@ -13,6 +13,11 @@ starting with two dashes ('\-\-').
 .B \-b, \-\-breaktrace=USEC
 Send break trace command when latency > USEC
 .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 \-l, \-\-loops=LOOPS
 Number of loops: default=0 (endless)
 .TP
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 59f979ec5ad1..a168191b7573 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -208,6 +208,8 @@ static void display_help(void)
 		"signaltest <options>\n\n"
 		"-b USEC  --breaktrace=USEC send break trace command when latency > USEC\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 of highest prio thread\n"
 		"-q       --quiet           print a summary only on exit\n"
 		"-t NUM   --threads=NUM     number of threads: default=2\n"
@@ -221,6 +223,7 @@ static void display_help(void)
 static int priority;
 static int num_threads = 2;
 static int max_cycles;
+static int duration;
 static int verbose;
 static int quiet;
 static int lockall = 0;
@@ -235,6 +238,7 @@ static void process_options (int argc, char *argv[])
 		static struct option long_options[] = {
 			{"breaktrace", required_argument, NULL, 'b'},
 			{"loops", required_argument, NULL, 'l'},
+			{"duration", required_argument, NULL, 'D'},
 			{"priority", required_argument, NULL, 'p'},
 			{"quiet", no_argument, NULL, 'q'},
 			{"threads", required_argument, NULL, 't'},
@@ -243,13 +247,14 @@ static void process_options (int argc, char *argv[])
 			{"help", no_argument, NULL, '?'},
 			{NULL, 0, NULL, 0}
 		};
-		int c = getopt_long (argc, argv, "b:c:d:i:l:np:qrsmt:v",
+		int c = getopt_long (argc, argv, "b:c:d:i:l:D:np:qrsmt:v",
 			long_options, &option_index);
 		if (c == -1)
 			break;
 		switch (c) {
 		case 'b': tracelimit = 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 'q': quiet = 1; break;
 		case 't': num_threads = atoi(optarg); break;
@@ -259,6 +264,9 @@ static void process_options (int argc, char *argv[])
 		}
 	}
 
+	if (duration < 0)
+		error = 1;
+
 	if (priority < 0 || priority > 99)
 		error = 1;
 
@@ -340,6 +348,10 @@ int main(int argc, char **argv)
 
 	signal(SIGINT, sighand);
 	signal(SIGTERM, sighand);
+	signal(SIGALRM, sighand);
+
+	if (duration)
+		alarm(duration);
 
 	par = calloc(num_threads, sizeof(struct thread_param));
 	if (!par)
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 01/12] rt_numa.h: Remove unused function
  2019-06-05 16:06 ` [PATCH v2 01/12] rt_numa.h: Remove unused function Daniel Wagner
@ 2019-06-13 13:48   ` John Kacur
  0 siblings, 0 replies; 21+ messages in thread
From: John Kacur @ 2019-06-13 13:48 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users, Daniel Wagner

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> From: Daniel Wagner <daniel.wagner@siemens.com>
> 
> GCC on a BeagleBoneBlack complains:
> 
> In file included from src/cyclictest/cyclictest.c:39:0:
> src/cyclictest/rt_numa.h:253:13: warning: ‘numa_on_and_available’ defined but not used [-Wunused-function]
>  static void numa_on_and_available()
>              ^~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
> ---
>  src/cyclictest/rt_numa.h | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
> index e8cd7f481baa..e0f4b2e9d8b2 100644
> --- a/src/cyclictest/rt_numa.h
> +++ b/src/cyclictest/rt_numa.h
> @@ -249,13 +249,6 @@ static inline void rt_bitmask_free(struct bitmask *mask)
>  	free(mask);
>  }
>  
> -
> -static void numa_on_and_available()
> -{
> -	if (numa) /* NUMA is not defined here */
> -		fatal("numa mode and numa functions not available.\n");
> -}
> -
>  #endif	/* NUMA */
>  
>  /*
> -- 

Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 02/12] queuelat: Use clock syscall for ARM 32 bit
  2019-06-05 16:06 ` [PATCH v2 02/12] queuelat: Use clock syscall for ARM 32 bit Daniel Wagner
@ 2019-06-13 13:51   ` John Kacur
  0 siblings, 0 replies; 21+ messages in thread
From: John Kacur @ 2019-06-13 13:51 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> CPUs such as Cortex-M8 don't have a rdtsc instruction. Fallback using
> a syscall.
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/queuelat/queuelat.c | 31 ++++++++++++++++++++++++++-----
>  1 file changed, 26 insertions(+), 5 deletions(-)
> 
> diff --git a/src/queuelat/queuelat.c b/src/queuelat/queuelat.c
> index 3b291f168768..a5525e41776a 100644
> --- a/src/queuelat/queuelat.c
> +++ b/src/queuelat/queuelat.c
> @@ -7,6 +7,7 @@
>  #include <stdio.h>
>  #include <unistd.h>
>  #include <signal.h>
> +#include <time.h>
>  
>  #define NSEC_PER_SEC 1000000000
>  
> @@ -249,6 +250,8 @@ typedef unsigned long long cycles_t;
>  typedef unsigned long long usecs_t;
>  typedef unsigned long long u64;
>  
> +#if defined __x86_64__ || defined __i386__
> +
>  #ifdef __x86_64__
>  #define DECLARE_ARGS(val, low, high)    unsigned low, high
>  #define EAX_EDX_VAL(val, low, high)     ((low) | ((u64)(high) << 32))
> @@ -270,7 +273,25 @@ static inline unsigned long long __rdtscll(void)
>          return EAX_EDX_VAL(val, low, high);
>  }
>  
> -#define rdtscll(val) do { (val) = __rdtscll(); } while (0)
> +#define gettick(val) do { (val) = __rdtscll(); } while (0)
> +
> +#elif defined __arm__
> +
> +static inline unsigned long long __clock_gettime(void)
> +{
> +	struct timespec now;
> +	int ret;
> +
> +	ret = clock_gettime(CLOCK_MONOTONIC, &now);
> +	if (ret < 0)
> +		return 0;
> +
> +	return now.tv_nsec;
> +}
> +
> +#define gettick(val) do { (val) = __clock_gettime(); } while (0)
> +
> +#endif
>  
>  static void init_buckets(void)
>  {
> @@ -348,9 +369,9 @@ static void run_n(int n)
>  
>  	memmove(dest, src, n);
>  	for (i = 0; i < loops; i++) {
> -		rdtscll(b);
> +		gettick(b);
>  		memmove(dest, src, n);
> -		rdtscll(a);
> +		gettick(a);
>  		delta = (a - b) * cycles_to_ns;
>  		account(delta);
>  	}
> @@ -446,9 +467,9 @@ void main_loop(void)
>  		int ret;
>  		int nr_packets_fill;
>  
> -		rdtscll(b);
> +		gettick(b);
>  		memmove(dest, src, default_n);
> -		rdtscll(a);
> +		gettick(a);
>  		delta = (a - b) * cycles_to_ns;
>  		account(delta);
>  
> -- 

Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 03/12] rt-utils: Move parse_time_string()
  2019-06-05 16:06 ` [PATCH v2 03/12] rt-utils: Move parse_time_string() Daniel Wagner
@ 2019-06-13 13:57   ` John Kacur
  0 siblings, 0 replies; 21+ messages in thread
From: John Kacur @ 2019-06-13 13:57 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> Move parse_time_string() to rt-utils.c so we can re use it.
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/cyclictest/cyclictest.c | 33 ---------------------------------
>  src/include/rt-utils.h      |  2 ++
>  src/lib/rt-utils.c          | 34 ++++++++++++++++++++++++++++++++++
>  3 files changed, 36 insertions(+), 33 deletions(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index ed59edefbf97..03d56e4f520c 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -406,39 +406,6 @@ static void enable_trace_mark(void)
>  	open_tracemark_fd();
>  }
>  
> -/*
> - * parse an input value as a base10 value followed by an optional
> - * suffix. The input value is presumed to be in seconds, unless
> - * followed by a modifier suffix: m=minutes, h=hours, d=days
> - *
> - * the return value is a value in seconds
> - */
> -static int parse_time_string(char *val)
> -{
> -	char *end;
> -	int t = strtol(val, &end, 10);
> -	if (end) {
> -		switch (*end) {
> -		case 'm':
> -		case 'M':
> -			t *= 60;
> -			break;
> -
> -		case 'h':
> -		case 'H':
> -			t *= 60*60;
> -			break;
> -
> -		case 'd':
> -		case 'D':
> -			t *= 24*60*60;
> -			break;
> -
> -		}
> -	}
> -	return t;
> -}
> -
>  /*
>   * Raise the soft priority limit up to prio, if that is less than or equal
>   * to the hard limit
> diff --git a/src/include/rt-utils.h b/src/include/rt-utils.h
> index ef0f6acf4ab5..405fa7855346 100644
> --- a/src/include/rt-utils.h
> +++ b/src/include/rt-utils.h
> @@ -24,4 +24,6 @@ uint32_t string_to_policy(const char *str);
>  
>  pid_t gettid(void);
>  
> +int parse_time_string(char *val);
> +
>  #endif	/* __RT_UTILS.H */
> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c
> index ac6878ccacf1..e1b166afcd6c 100644
> --- a/src/lib/rt-utils.c
> +++ b/src/lib/rt-utils.c
> @@ -13,6 +13,7 @@
>  #include <sched.h>
>  #include <stdarg.h>
>  #include <errno.h>
> +#include <ctype.h>
>  #include <fcntl.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
> @@ -320,3 +321,36 @@ pid_t gettid(void)
>  {
>  	return syscall(SYS_gettid);
>  }
> +
> +/*
> + * parse an input value as a base10 value followed by an optional
> + * suffix. The input value is presumed to be in seconds, unless
> + * followed by a modifier suffix: m=minutes, h=hours, d=days
> + *
> + * the return value is a value in seconds
> + */
> +int parse_time_string(char *val)
> +{
> +	char *end;
> +	int t = strtol(val, &end, 10);
> +	if (end) {
> +		switch (*end) {
> +		case 'm':
> +		case 'M':
> +			t *= 60;
> +			break;
> +
> +		case 'h':
> +		case 'H':
> +			t *= 60*60;
> +			break;
> +
> +		case 'd':
> +		case 'D':
> +			t *= 24*60*60;
> +			break;
> +
> +		}
> +	}
> +	return t;
> +}
> -- 

Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 04/12] pi_stress: Allow short command line arguments
  2019-06-05 16:06 ` [PATCH v2 04/12] pi_stress: Allow short command line arguments Daniel Wagner
@ 2019-06-13 14:04   ` John Kacur
  2019-06-16 16:29     ` Daniel Wagner
  0 siblings, 1 reply; 21+ messages in thread
From: John Kacur @ 2019-06-13 14:04 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> Add optstring to getopt_long() command line parser to support the
> short options as it documented in the man page and also in the usage
> help text.
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/pi_tests/pi_stress.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
> index ac7646cd2613..543106be8e18 100644
> --- a/src/pi_tests/pi_stress.c
> +++ b/src/pi_tests/pi_stress.c
> @@ -1322,9 +1322,8 @@ int process_sched_line(const char *arg)
>  void process_command_line(int argc, char **argv)
>  {
>  	int opt;
> -	while ((opt = getopt_long(argc, argv, "+", options, NULL)) != -1) {
> +	while ((opt = getopt_long(argc, argv, "+ht:vqi:g:rs:pdVum", options, NULL)) != -1) {
>  		switch (opt) {
> -		case '?':
>  		case 'h':
>  			usage();
>  			exit(0);
> -- 
> 2.20.1
> 

I actually don't see short options in the usage help text, but I do see 
them in the manpage.

This could use some clean-up to make sure the manpage is current and the 
usage text is current and synced too, if you or anyone else reading cares 
to address this.

Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 05/12] pi_stress: Rename -t command line option to -D
  2019-06-05 16:06 ` [PATCH v2 05/12] pi_stress: Rename -t command line option to -D Daniel Wagner
@ 2019-06-13 14:07   ` John Kacur
  0 siblings, 0 replies; 21+ messages in thread
From: John Kacur @ 2019-06-13 14:07 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> Streamline the duration command line argument for all rt-tests. While
> at it also add man page.
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/pi_tests/pi_stress.8 |  4 ++++
>  src/pi_tests/pi_stress.c | 11 ++++++-----
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/src/pi_tests/pi_stress.8 b/src/pi_tests/pi_stress.8
> index c92b4bdf5609..475d3c34f135 100644
> --- a/src/pi_tests/pi_stress.8
> +++ b/src/pi_tests/pi_stress.8
> @@ -57,6 +57,10 @@ seconds and then terminate.
>  The number of inversion groups to run. Defaults to 10.
>  .IP \-d|\-\-debug
>  Run in debug mode; lots of extra prints
> +.IP "\-D, \-\-duration=TIME"
> +Specify a length for the test run.
> +.br
> +Append 'm', 'h', or 'd' to specify minutes, hours or days.
>  .IP \-v|\-\-verbose
>  Run with verbose messages
>  .IP \-s|\-\-signal
> diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
> index 543106be8e18..1286370c474b 100644
> --- a/src/pi_tests/pi_stress.c
> +++ b/src/pi_tests/pi_stress.c
> @@ -146,7 +146,7 @@ int lockall = 0;
>  
>  /* command line options */
>  struct option options[] = {
> -	{"duration", required_argument, NULL, 't'},
> +	{"duration", required_argument, NULL, 'D'},
>  	{"verbose", no_argument, NULL, 'v'},
>  	{"quiet", no_argument, NULL, 'q'},
>  	{"groups", required_argument, NULL, 'g'},
> @@ -1027,7 +1027,8 @@ void usage(void)
>  	printf("\t--verbose\t- lots of output\n");
>  	printf("\t--quiet\t\t- suppress running output\n");
>  	printf
> -	    ("\t--duration=<n>- length of the test run in seconds [infinite]\n");
> +	    ("\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",
>  	       ngroups);
>  	printf
> @@ -1322,13 +1323,13 @@ int process_sched_line(const char *arg)
>  void process_command_line(int argc, char **argv)
>  {
>  	int opt;
> -	while ((opt = getopt_long(argc, argv, "+ht:vqi:g:rs:pdVum", options, NULL)) != -1) {
> +	while ((opt = getopt_long(argc, argv, "+hD:vqi:g:rs:pdVum", options, NULL)) != -1) {
>  		switch (opt) {
>  		case 'h':
>  			usage();
>  			exit(0);
> -		case 't':
> -			duration = strtol(optarg, NULL, 10);
> +		case 'D':
> +			duration = parse_time_string(optarg);
>  			break;
>  		case 'v':
>  			verbose = 1;
> -- 
> 2.20.1
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 06/12] pmqtest: Add duration command line argument
  2019-06-05 16:06 ` [PATCH v2 06/12] pmqtest: Add duration command line argument Daniel Wagner
@ 2019-06-13 14:10   ` John Kacur
  0 siblings, 0 replies; 21+ messages in thread
From: John Kacur @ 2019-06-13 14:10 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> Many of the test programs have the --loop argument for automatic
> stopping. The main problem with the --loop argument is how long is
> --loop 1000?
> 
> To simplify automated tests introduce a --duration argument which
> allows to set the time how long a test should run. This allows the
> test suite to define the execution time and also the timeout which a
> normal human can understand.
> 
> For example run the test for 10 minutes and timeout at 11 minutes:
> 
>   # timeout 11m pmqtest -D 10m
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/pmqtest/pmqtest.8 |  5 +++++
>  src/pmqtest/pmqtest.c | 17 +++++++++++++++--
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/src/pmqtest/pmqtest.8 b/src/pmqtest/pmqtest.8
> index 05421e01e70b..9108a939b9f7 100644
> --- a/src/pmqtest/pmqtest.8
> +++ b/src/pmqtest/pmqtest.8
> @@ -21,6 +21,11 @@ It is useful to track down unexpected large latencies of a system.
>  .B \-d, \-\-distance=DIST
>  Set the distance of thread intervals in microseconds (default is 500 us). When pmqtest is called with the -t option and more than one thread is created, then this distance value is added to the interval of the threads: Interval(thread N) = Interval(thread N-1) + DIST
>  .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 \-f, \-\-forcetimeout=TO
>  Set an artificial delay of the send function to force timeout of the receiver, requires the -T option
>  .TP
> diff --git a/src/pmqtest/pmqtest.c b/src/pmqtest/pmqtest.c
> index 75d5ee8185a0..054768d161a7 100644
> --- a/src/pmqtest/pmqtest.c
> +++ b/src/pmqtest/pmqtest.c
> @@ -252,6 +252,8 @@ static void display_help(void)
>  	"-f TO    --forcetimeout=TO force timeout of mq_timedreceive(), requires -T\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"
> @@ -271,6 +273,7 @@ static int tracelimit;
>  static int priority;
>  static int num_threads = 1;
>  static int max_cycles;
> +static int duration;
>  static int interval = 1000;
>  static int distance = 500;
>  static int smp;
> @@ -293,6 +296,7 @@ static void process_options (int argc, char *argv[])
>  			{"forcetimeout", required_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'},
> @@ -300,7 +304,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:p:St::T:",
> +		int c = getopt_long (argc, argv, "a::b:d:f:i:l:D:p:St::T:",
>  			long_options, &option_index);
>  		if (c == -1)
>  			break;
> @@ -325,6 +329,7 @@ static void process_options (int argc, char *argv[])
>  		case 'f': forcetimeout = atoi(optarg); 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;
> @@ -369,7 +374,10 @@ static void process_options (int argc, char *argv[])
>  
>  	if (forcetimeout && !timeout)
>  		error = 1;
> - 
> +
> +	if (duration < 0)
> +		error = 1;
> +
>  	if (priority && smp)
>  		sameprio = 1;
>  
> @@ -418,10 +426,15 @@ int main(int argc, char *argv[])
>  	sigemptyset(&sigset);
>  	sigaddset(&sigset, SIGTERM);
>  	sigaddset(&sigset, SIGINT);
> +	sigaddset(&sigset, SIGALRM);
>  	pthread_sigmask(SIG_SETMASK, &sigset, NULL);
>  
>  	signal(SIGINT, sighand);
>  	signal(SIGTERM, sighand);
> +	signal(SIGALRM, sighand);
> +
> +	if (duration)
> +		alarm(duration);
>  
>  	receiver = calloc(num_threads, sizeof(struct params));
>  	sender = calloc(num_threads, sizeof(struct params));
> -- 
> 2.20.1
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 08/12] cyclicdeadline: Add duration command line argument
  2019-06-05 16:06 ` [PATCH v2 08/12] cyclicdeadline: " Daniel Wagner
@ 2019-06-13 14:18   ` John Kacur
  2019-06-16 16:34     ` Daniel Wagner
  2019-06-13 14:40   ` John Kacur
  1 sibling, 1 reply; 21+ messages in thread
From: John Kacur @ 2019-06-13 14:18 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> Many of the test programs have the --loop argument for automatic
> stopping. The main problem with the --loop argument is how long is
> --loop 1000?
> 
> To simplify automated tests introduce a --duration argument which
> allows to set the time how long a test should run. This allows the
> test suite to define the execution time and also the timeout which a
> normal human can understand.
> 
> For example run the test for 10 minutes and timeout at 11 minutes:
> 
>   # timeout 11m cyclicdeadline -D 10m
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/sched_deadline/cyclicdeadline.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index 6d461b27ac43..47892daf747b 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -21,6 +21,8 @@
>  #include <linux/unistd.h>
>  #include <linux/magic.h>
>  
> +#include <rt-utils.h>
> +
>  #ifdef __i386__
>  #ifndef __NR_sched_setattr
>  #define __NR_sched_setattr		351
> @@ -1049,6 +1051,7 @@ int main (int argc, char **argv)
>  	unsigned int interval = 1000;
>  	unsigned int step = 500;
>  	int percent = 60;
> +	int duration = 0;
>  	u64 runtime;
>  	u64 start_period;
>  	u64 end_period;
> @@ -1062,7 +1065,7 @@ int main (int argc, char **argv)
>  		exit(-1);
>  	}
>  
> -	while ((c = getopt(argc, argv, "+hac:i:s:t:")) >= 0) {
> +	while ((c = getopt(argc, argv, "+hac:i:s:t:D:")) >= 0) {
>  		switch (c) {
>  		case 'a':
>  			all_cpus = 1;
> @@ -1081,6 +1084,9 @@ int main (int argc, char **argv)
>  		case 't':
>  			nr_threads = atoi(optarg);
>  			break;
> +		case 'D':
> +			duration = parse_time_string(optarg);
> +			break;
>  		case 'h':
>  		default:
>  			usage(argv);
> @@ -1246,6 +1252,10 @@ int main (int argc, char **argv)
>  
>  	signal(SIGINT, sighand);
>  	signal(SIGTERM, sighand);
> +	signal(SIGALRM, sighand);
> +
> +	if (duration)
> +		alarm(duration);
>  
>  	if (!fail)
>  		loop(sched_data, nr_threads);
> -- 
> 2.20.1
> 

I fixed-up some dos like line endings you added in the man page, are you 
doing something weird with your editor?

Other than that

Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 08/12] cyclicdeadline: Add duration command line argument
  2019-06-05 16:06 ` [PATCH v2 08/12] cyclicdeadline: " Daniel Wagner
  2019-06-13 14:18   ` John Kacur
@ 2019-06-13 14:40   ` John Kacur
  1 sibling, 0 replies; 21+ messages in thread
From: John Kacur @ 2019-06-13 14:40 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> Many of the test programs have the --loop argument for automatic
> stopping. The main problem with the --loop argument is how long is
> --loop 1000?
> 
> To simplify automated tests introduce a --duration argument which
> allows to set the time how long a test should run. This allows the
> test suite to define the execution time and also the timeout which a
> normal human can understand.
> 
> For example run the test for 10 minutes and timeout at 11 minutes:
> 
>   # timeout 11m cyclicdeadline -D 10m
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/sched_deadline/cyclicdeadline.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index 6d461b27ac43..47892daf747b 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -21,6 +21,8 @@
>  #include <linux/unistd.h>
>  #include <linux/magic.h>
>  
> +#include <rt-utils.h>
> +
>  #ifdef __i386__
>  #ifndef __NR_sched_setattr
>  #define __NR_sched_setattr		351
> @@ -1049,6 +1051,7 @@ int main (int argc, char **argv)
>  	unsigned int interval = 1000;
>  	unsigned int step = 500;
>  	int percent = 60;
> +	int duration = 0;
>  	u64 runtime;
>  	u64 start_period;
>  	u64 end_period;
> @@ -1062,7 +1065,7 @@ int main (int argc, char **argv)
>  		exit(-1);
>  	}
>  
> -	while ((c = getopt(argc, argv, "+hac:i:s:t:")) >= 0) {
> +	while ((c = getopt(argc, argv, "+hac:i:s:t:D:")) >= 0) {
>  		switch (c) {
>  		case 'a':
>  			all_cpus = 1;
> @@ -1081,6 +1084,9 @@ int main (int argc, char **argv)
>  		case 't':
>  			nr_threads = atoi(optarg);
>  			break;
> +		case 'D':
> +			duration = parse_time_string(optarg);
> +			break;
>  		case 'h':
>  		default:
>  			usage(argv);
> @@ -1246,6 +1252,10 @@ int main (int argc, char **argv)
>  
>  	signal(SIGINT, sighand);
>  	signal(SIGTERM, sighand);
> +	signal(SIGALRM, sighand);
> +
> +	if (duration)
> +		alarm(duration);
>  
>  	if (!fail)
>  		loop(sched_data, nr_threads);
> -- 
> 2.20.1
> 

I'm reluctantly giving you a signed-off-by.
I say reluctantly because the program needs some work, so the problems 
exited before your patch, but it's a little hard to test your patch until 
these problems get resolved.

I can't run this without getting the message

For less than 2ms run times, you need to
have HRTICK enabled in debugfs/sched_features

- The usage message is broken
- There is no help
- There are no long options

Anyone looking for place to start hacking, this program could use some 
love

Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 09/12] signaltest: Add duration command line argument
  2019-06-05 16:06 ` [PATCH v2 09/12] signaltest: " Daniel Wagner
@ 2019-06-13 19:07   ` John Kacur
  0 siblings, 0 replies; 21+ messages in thread
From: John Kacur @ 2019-06-13 19:07 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-rt-users



On Wed, 5 Jun 2019, Daniel Wagner wrote:

> Many of the test programs have the --loop argument for automatic
> stopping. The main problem with the --loop argument is how long is
> --loop 1000?
> 
> To simplify automated tests introduce a --duration argument which
> allows to set the time how long a test should run. This allows the
> test suite to define the execution time and also the timeout which a
> normal human can understand.
> 
> For example run the test for 10 minutes and timeout at 11 minutes:
> 
>   # timeout 11m signaltest -D 10m
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/signaltest/signaltest.8 |  5 +++++
>  src/signaltest/signaltest.c | 14 +++++++++++++-
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/src/signaltest/signaltest.8 b/src/signaltest/signaltest.8
> index 634d392a6da5..bd6ffe5c7a36 100644
> --- a/src/signaltest/signaltest.8
> +++ b/src/signaltest/signaltest.8
> @@ -13,6 +13,11 @@ starting with two dashes ('\-\-').
>  .B \-b, \-\-breaktrace=USEC
>  Send break trace command when latency > USEC
>  .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 \-l, \-\-loops=LOOPS
>  Number of loops: default=0 (endless)
>  .TP
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 59f979ec5ad1..a168191b7573 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -208,6 +208,8 @@ static void display_help(void)
>  		"signaltest <options>\n\n"
>  		"-b USEC  --breaktrace=USEC send break trace command when latency > USEC\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 of highest prio thread\n"
>  		"-q       --quiet           print a summary only on exit\n"
>  		"-t NUM   --threads=NUM     number of threads: default=2\n"
> @@ -221,6 +223,7 @@ static void display_help(void)
>  static int priority;
>  static int num_threads = 2;
>  static int max_cycles;
> +static int duration;
>  static int verbose;
>  static int quiet;
>  static int lockall = 0;
> @@ -235,6 +238,7 @@ static void process_options (int argc, char *argv[])
>  		static struct option long_options[] = {
>  			{"breaktrace", required_argument, NULL, 'b'},
>  			{"loops", required_argument, NULL, 'l'},
> +			{"duration", required_argument, NULL, 'D'},
>  			{"priority", required_argument, NULL, 'p'},
>  			{"quiet", no_argument, NULL, 'q'},
>  			{"threads", required_argument, NULL, 't'},
> @@ -243,13 +247,14 @@ static void process_options (int argc, char *argv[])
>  			{"help", no_argument, NULL, '?'},
>  			{NULL, 0, NULL, 0}
>  		};
> -		int c = getopt_long (argc, argv, "b:c:d:i:l:np:qrsmt:v",
> +		int c = getopt_long (argc, argv, "b:c:d:i:l:D:np:qrsmt:v",
>  			long_options, &option_index);
>  		if (c == -1)
>  			break;
>  		switch (c) {
>  		case 'b': tracelimit = 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 'q': quiet = 1; break;
>  		case 't': num_threads = atoi(optarg); break;
> @@ -259,6 +264,9 @@ static void process_options (int argc, char *argv[])
>  		}
>  	}
>  
> +	if (duration < 0)
> +		error = 1;
> +
>  	if (priority < 0 || priority > 99)
>  		error = 1;
>  
> @@ -340,6 +348,10 @@ int main(int argc, char **argv)
>  
>  	signal(SIGINT, sighand);
>  	signal(SIGTERM, sighand);
> +	signal(SIGALRM, sighand);
> +
> +	if (duration)
> +		alarm(duration);
>  
>  	par = calloc(num_threads, sizeof(struct thread_param));
>  	if (!par)
> -- 
> 2.20.1
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 04/12] pi_stress: Allow short command line arguments
  2019-06-13 14:04   ` John Kacur
@ 2019-06-16 16:29     ` Daniel Wagner
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Wagner @ 2019-06-16 16:29 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users

Hi John,

On 6/13/19 4:04 PM, John Kacur wrote:
>> index ac7646cd2613..543106be8e18 100644
>> --- a/src/pi_tests/pi_stress.c
>> +++ b/src/pi_tests/pi_stress.c
>> @@ -1322,9 +1322,8 @@ int process_sched_line(const char *arg)
>>   void process_command_line(int argc, char **argv)
>>   {
>>   	int opt;
>> -	while ((opt = getopt_long(argc, argv, "+", options, NULL)) != -1) {
>> +	while ((opt = getopt_long(argc, argv, "+ht:vqi:g:rs:pdVum", options, NULL)) != -1) {
>>   		switch (opt) {
>> -		case '?':
>>   		case 'h':
>>   			usage();
>>   			exit(0);
>> -- 
>> 2.20.1
>>
> 
> I actually don't see short options in the usage help text, but I do see
> them in the manpage.
> 
> This could use some clean-up to make sure the manpage is current and the
> usage text is current and synced too, if you or anyone else reading cares
> to address this.

pi_stress differs a bit in the handling of the options. Indeed it makes 
sense to streamline it with the other tools. Will look into it (but 
don't hold your breath :))

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 08/12] cyclicdeadline: Add duration command line argument
  2019-06-13 14:18   ` John Kacur
@ 2019-06-16 16:34     ` Daniel Wagner
  0 siblings, 0 replies; 21+ messages in thread
From: Daniel Wagner @ 2019-06-16 16:34 UTC (permalink / raw)
  To: John Kacur; +Cc: linux-rt-users

Hi John,

On 6/13/19 4:18 PM, John Kacur wrote:
> 
> 
> On Wed, 5 Jun 2019, Daniel Wagner wrote:
> 
>> Many of the test programs have the --loop argument for automatic
>> stopping. The main problem with the --loop argument is how long is
>> --loop 1000?
>>
>> To simplify automated tests introduce a --duration argument which
>> allows to set the time how long a test should run. This allows the
>> test suite to define the execution time and also the timeout which a
>> normal human can understand.
>>
>> For example run the test for 10 minutes and timeout at 11 minutes:
>>
>>    # timeout 11m cyclicdeadline -D 10m
>>
>> Signed-off-by: Daniel Wagner <wagi@monom.org>
>> ---
>>   src/sched_deadline/cyclicdeadline.c | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
>> index 6d461b27ac43..47892daf747b 100644
>> --- a/src/sched_deadline/cyclicdeadline.c
>> +++ b/src/sched_deadline/cyclicdeadline.c
>> @@ -21,6 +21,8 @@
>>   #include <linux/unistd.h>
>>   #include <linux/magic.h>
>>   
>> +#include <rt-utils.h>
>> +
>>   #ifdef __i386__
>>   #ifndef __NR_sched_setattr
>>   #define __NR_sched_setattr		351
>> @@ -1049,6 +1051,7 @@ int main (int argc, char **argv)
>>   	unsigned int interval = 1000;
>>   	unsigned int step = 500;
>>   	int percent = 60;
>> +	int duration = 0;
>>   	u64 runtime;
>>   	u64 start_period;
>>   	u64 end_period;
>> @@ -1062,7 +1065,7 @@ int main (int argc, char **argv)
>>   		exit(-1);
>>   	}
>>   
>> -	while ((c = getopt(argc, argv, "+hac:i:s:t:")) >= 0) {
>> +	while ((c = getopt(argc, argv, "+hac:i:s:t:D:")) >= 0) {
>>   		switch (c) {
>>   		case 'a':
>>   			all_cpus = 1;
>> @@ -1081,6 +1084,9 @@ int main (int argc, char **argv)
>>   		case 't':
>>   			nr_threads = atoi(optarg);
>>   			break;
>> +		case 'D':
>> +			duration = parse_time_string(optarg);
>> +			break;
>>   		case 'h':
>>   		default:
>>   			usage(argv);
>> @@ -1246,6 +1252,10 @@ int main (int argc, char **argv)
>>   
>>   	signal(SIGINT, sighand);
>>   	signal(SIGTERM, sighand);
>> +	signal(SIGALRM, sighand);
>> +
>> +	if (duration)
>> +		alarm(duration);
>>   
>>   	if (!fail)
>>   		loop(sched_data, nr_threads);
>> -- 
>> 2.20.1
>>
> 
> I fixed-up some dos like line endings you added in the man page, are you
> doing something weird with your editor?

Just guessing: my editor sees DOS encoding in the file and preserves the 
mode. I haven't had this problem before. Very strange.

Sorry for the additional work.

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-06-16 16:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
2019-06-05 16:06 ` [PATCH v2 01/12] rt_numa.h: Remove unused function Daniel Wagner
2019-06-13 13:48   ` John Kacur
2019-06-05 16:06 ` [PATCH v2 02/12] queuelat: Use clock syscall for ARM 32 bit Daniel Wagner
2019-06-13 13:51   ` John Kacur
2019-06-05 16:06 ` [PATCH v2 03/12] rt-utils: Move parse_time_string() Daniel Wagner
2019-06-13 13:57   ` John Kacur
2019-06-05 16:06 ` [PATCH v2 04/12] pi_stress: Allow short command line arguments Daniel Wagner
2019-06-13 14:04   ` John Kacur
2019-06-16 16:29     ` Daniel Wagner
2019-06-05 16:06 ` [PATCH v2 05/12] pi_stress: Rename -t command line option to -D Daniel Wagner
2019-06-13 14:07   ` John Kacur
2019-06-05 16:06 ` [PATCH v2 06/12] pmqtest: Add duration command line argument Daniel Wagner
2019-06-13 14:10   ` John Kacur
2019-06-05 16:06 ` [PATCH v2 07/12] ptsematest: " Daniel Wagner
2019-06-05 16:06 ` [PATCH v2 08/12] cyclicdeadline: " Daniel Wagner
2019-06-13 14:18   ` John Kacur
2019-06-16 16:34     ` Daniel Wagner
2019-06-13 14:40   ` John Kacur
2019-06-05 16:06 ` [PATCH v2 09/12] signaltest: " Daniel Wagner
2019-06-13 19:07   ` John Kacur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).