All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Add --quiet option to cyclictest
@ 2006-09-13 20:24 Niklaus Giger
  2006-09-14  7:32 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Niklaus Giger @ 2006-09-13 20:24 UTC (permalink / raw)
  To: xenomai-core

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

Hi

cyclictest emits far too much output. The attached patched makes it honour 
the '-q/--quiet' option like all the other tests.

Could somebody please review the patch and possibly apply it?

Later I really would like to propose a common schema how to pass the most 
common options to the various tests called by xeno-test. 

Best regards in advance

-- 
Niklaus Giger

[-- Attachment #2: cyclictest.diff --]
[-- Type: text/x-diff, Size: 3247 bytes --]

Index: /mnt/data.ng/hcu/kernel/xenomai-head/src/testsuite/cyclic/cyclictest.c
===================================================================
--- /mnt/data.ng/hcu/kernel/xenomai-head/src/testsuite/cyclic/cyclictest.c	(Revision 1604)
+++ /mnt/data.ng/hcu/kernel/xenomai-head/src/testsuite/cyclic/cyclictest.c	(Arbeitskopie)
@@ -309,9 +309,9 @@
 /* Print usage information */
 static void display_help(void)
 {
-	printf("cyclictest %s\n", VERSION_STRING);
+	printf("cyclictest %s (jittertest)\n", VERSION_STRING);
 	printf("Usage:\n"
-	       "jittertest <options>\n\n"
+	       "cyclictest <options>\n\n"
 	       "-b USEC  --breaktrace=USEC send break trace command when latency > USEC\n"
 	       "-c CLOCK --clock=CLOCK     select clock\n"
 	       "                           0 = CLOCK_MONOTONIC (default)\n"
@@ -321,6 +321,7 @@
 	       "-l LOOPS --loops=LOOPS     number of loops: default=0(endless)\n"
 	       "-n       --nanosleep       use clock_nanosleep\n"
 	       "-p PRIO  --prio=PRIO       priority of highest prio thread\n"
+	       "-q       --quiet	   minimal output\n"
 	       "-r       --relative        use relative timer instead of absolute\n"
 	       "-s       --system          use sys_nanosleep and sys_setitimer\n"
 	       "-t NUM   --threads=NUM     number of threads: default=1\n"
@@ -337,6 +338,7 @@
 static int max_cycles;
 static int clocksel = 0;
 static int verbose;
+static int quiet;
 static int interval = 1000;
 static int distance = 500;
 
@@ -364,10 +366,11 @@
 			{"system", no_argument, NULL, 's'},
 			{"threads", required_argument, NULL, 't'},
 			{"verbose", no_argument, NULL, 'v'},
+			{"quiet", no_argument, NULL, 'q'},
 			{"help", no_argument, NULL, '?'},
 			{NULL, 0, NULL, 0}
 		};
-		int c = getopt_long (argc, argv, "b:c:d:i:l:np:rst:v",
+		int c = getopt_long (argc, argv, "b:c:d:i:l:np:qrst:v",
 			long_options, &option_index);
 		if (c == -1)
 			break;
@@ -379,6 +382,7 @@
 		case 'l': max_cycles = atoi(optarg); break;
 		case 'n': use_nanosleep = MODE_CLOCK_NANOSLEEP; break;
 		case 'p': priority = atoi(optarg); break;
+		case 'q': quiet = 1; break;
 		case 'r': timermode = TIMER_RELTIME; break;	
 		case 's': use_system = MODE_SYS_OFFSET; break;
 		case 't': num_threads = atoi(optarg); break;
@@ -410,7 +414,7 @@
 	struct thread_stat *stat = par->stats;
 	
 	if (!verbose) {
-		printf("T:%2d (%5d) P:%2d I:%8ld C:%8lu Min:%8ld Act:%8ld Max:%8ld\n", 
+	 	if (!quiet) printf("T:%2d (%5d) P:%2d I:%8ld C:%8lu Min:%8ld Act:%8ld Max:%8ld\n", 
 		       index, stat->tid, par->prio, par->interval,
 		       stat->cycles, stat->min, stat->act, stat->max);
 	} else {
@@ -496,7 +500,7 @@
 			len = read(fd, &lavg, 255);
 			close(fd);
 			lavg[len-1] = 0x0;
-			printf("%s          \n\n", lavg);
+			if (!quiet) printf("%s          \n\n", lavg);
 		}
 
 		for (i = 0; i < num_threads; i++) {
@@ -509,9 +513,15 @@
 		usleep(10000);
 		if (test_shutdown || allstopped == num_threads)
 			break;
-		if (!verbose)
+		if (!verbose && !quiet)
 			printf("\033[%dA", num_threads + 2);
 	}
+	if (quiet) {
+		quiet = 0; /* Now we want to output the statistics */
+		for (i = 0; i < num_threads; i++) {
+			print_stat(&par[i], i, verbose);
+		}
+	}
 	ret = 0;
  outall:
 	test_shutdown = 1;

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

* Re: [Xenomai-core] Add --quiet option to cyclictest
  2006-09-13 20:24 [Xenomai-core] Add --quiet option to cyclictest Niklaus Giger
@ 2006-09-14  7:32 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2006-09-14  7:32 UTC (permalink / raw)
  To: niklaus.giger; +Cc: xenomai-core

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

Niklaus Giger wrote:
> Hi
> 
> cyclictest emits far too much output. The attached patched makes it honour 
> the '-q/--quiet' option like all the other tests.
> 
> Could somebody please review the patch and possibly apply it?

I wasn't able to find any problems, so I merged it. Thanks.

> 
> Later I really would like to propose a common schema how to pass the most 
> common options to the various tests called by xeno-test. 

Maybe the common part of handling those switches could be moved to a
generic test-tool library (which could later also contain the data
processing and printing of those tests - my old vision...)?

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

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

end of thread, other threads:[~2006-09-14  7:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-13 20:24 [Xenomai-core] Add --quiet option to cyclictest Niklaus Giger
2006-09-14  7:32 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.