Skip to contentSkip to conversation

cyclictest - minor change request for histogram

PATCH Nicholas Mc Guire 1 participant 1 message Feb 10, 2012

lore
Share & tools
lore
#0 lore raw

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

src/cyclictest/cyclictest.c +8 -0
index 731b4bd..66a68ed 100644
@@ -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;