* [PATCH] cyclictest: add command line option for unbuffered output
@ 2009-12-25 12:01 Wolfram Sang
2009-12-29 18:37 ` Clark Williams
0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2009-12-25 12:01 UTC (permalink / raw)
To: linux-rt-users; +Cc: Michael Olbrich, Wolfram Sang
From: Michael Olbrich <m.olbrich@pengutronix.de>
Wenn 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>
---
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;
--
1.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-29 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-25 12:01 [PATCH] cyclictest: add command line option for unbuffered output Wolfram Sang
2009-12-29 18:37 ` Clark Williams
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).