diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2009-12-29 12:23:27 -0600 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2009-12-29 12:23:27 -0600 |
commit | f1619c5c192b57f5bf1f144d21f6fd401d5ef465 (patch) | |
tree | ac8c6eb415ac63103f49e5da19ace0f43bfa83ee | |
parent | 2fc5d42f862fad58ee92dca1effdfe926a25c36b (diff) | |
download | rt-tests-f1619c5c192b57f5bf1f144d21f6fd401d5ef465.tar.gz |
cyclictest: add command line option for unbuffered output
When reading the output from cyclictest with another program, the data is
buffered by default. This prevents nice 'live' display.
This patch adds an command line option to force the output to always be
unbuffered.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | src/cyclictest/cyclictest.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index a15cf57..eee7e73 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -772,6 +772,7 @@ static void display_help(int error) " without -t default = 1\n" "-T TRACE --tracer=TRACER set tracing function\n" " configured tracers: %s\n" + "-u --unbuffered force unbuffered output for live processing\n" "-v --verbose output values on stdout for statistics\n" " format: n:c:v n=tasknum c=count v=value in us\n" "-w --wakeup task wakeup tracing (used with -b)\n" @@ -890,6 +891,7 @@ static void process_options (int argc, char *argv[]) {"relative", no_argument, NULL, 'r'}, {"system", no_argument, NULL, 's'}, {"threads", optional_argument, NULL, 't'}, + {"unbuffered", no_argument, NULL, 'u'}, {"verbose", no_argument, NULL, 'v'}, {"duration",required_argument, NULL, 'D'}, {"wakeup", no_argument, NULL, 'w'}, @@ -899,7 +901,7 @@ static void process_options (int argc, char *argv[]) {"traceopt", required_argument, NULL, 'O'}, {NULL, 0, NULL, 0} }; - int c = getopt_long(argc, argv, "a::b:Bc:Cd:Efh:i:Il:MnNo:O:p:Pmqrst::vD:wWTy:", + int c = getopt_long(argc, argv, "a::b:Bc:Cd:Efh:i:Il:MnNo:O:p:Pmqrst::uvD:wWTy:", long_options, &option_index); if (c == -1) break; @@ -948,6 +950,7 @@ static void process_options (int argc, char *argv[]) num_threads = max_cpus; break; case 'T': strncpy(tracer, optarg, sizeof(tracer)); break; + case 'u': setvbuf(stdout, NULL, _IONBF, 0); break; case 'v': verbose = 1; break; case 'm': lockall = 1; break; case 'M': refresh_on_max = 1; break; |