From 6e7e1ca448d8542278f5fbfac0d78c1fbce42002 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Mon, 21 Jan 2019 17:16:10 +0100 Subject: [PATCH] set stdout line-buffering in throughput tests Line buffering allows monitoring progress via pipes or files, and as there is just one line of output per second, it doesn't affect performance Signed-off-by: Erik Boasson --- src/examples/throughput/publisher.c | 2 ++ src/examples/throughput/subscriber.c | 1 + 2 files changed, 3 insertions(+) diff --git a/src/examples/throughput/publisher.c b/src/examples/throughput/publisher.c index 18abfa5..6809e44 100644 --- a/src/examples/throughput/publisher.c +++ b/src/examples/throughput/publisher.c @@ -57,6 +57,8 @@ int main (int argc, char **argv) dds_entity_t writer; ThroughputModule_DataType sample; + setvbuf (stdout, NULL, _IOLBF, 0); + if (parse_args(argc, argv, &payloadSize, &burstInterval, &burstSize, &timeOut, &partitionName) == EXIT_FAILURE) { return EXIT_FAILURE; } diff --git a/src/examples/throughput/subscriber.c b/src/examples/throughput/subscriber.c index 4ea5422..4eb3d18 100644 --- a/src/examples/throughput/subscriber.c +++ b/src/examples/throughput/subscriber.c @@ -98,6 +98,7 @@ int main (int argc, char **argv) sat.sa_flags = 0; sigaction (SIGINT, &sat, &oldAction); #endif + setvbuf (stdout, NULL, _IOLBF, 0); if (parse_args(argc, argv, &maxCycles, &partitionName) == EXIT_FAILURE) {