cyclictest - minor change request for histogram

From: Nicholas Mc Guire <hidden>
Date: 2012-02-10 12:45:58
Subsystem: the rest · Maintainer: Linus Torvalds

HI !

 minor change request to the histogram in cyclictest to record the
 comandline - needed for confused people like me ...

 I would prefere if the commandline with the parameters used during the
 test-run would be recorded in the histogram output - thats what the 
 below patch does. i.e. runing:

hofrat@debian:~/rt-tests$ ./cyclictest -q -p 10 -n -h 50 -l 1000

would result in the histogram begin displayed as

# cmdline: ./cyclictest -q -p 10 -n -h 50 -l 1000
# Histogram
000000 000000
000001 000000
000002 000000
...

thx!
hofrat 

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 731b4bd..66a68ed 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -942,6 +942,7 @@ static char *policyname(int policy)
 static void process_options (int argc, char *argv[])
 {
 	int error = 0;
+	int i = 0;
 	int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
 
 	for (;;) {
@@ -1136,6 +1137,13 @@ static void process_options (int argc, char *argv[])
 		warn("distance is ignored and set to 0, if histogram enabled\n");
 	if (distance == -1)
 		distance = DEFAULT_DISTANCE;
+	if (histogram) {
+		printf("# cmdline:");
+		for (i = 0; i < argc; i++) {
+			printf(" %s", argv[i]);
+		}
+		printf("\n");
+	}
 
 	if (priority < 0 || priority > 99)
 		error = 1;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help