From d5155945e03ffef6ff4de05d1ec5dfd0951e0860 Mon Sep 17 00:00:00 2001 From: Andy Zhou Date: Mon, 29 Apr 2013 14:42:56 -0700 Subject: [PATCH] ovs-benchmark: improve 'rate' command piped output support. Add fflush() to the 'rate' command of 'ovs-benchmark'. On a tty console the output is line-buffered. However, piped output by default has a deeper (usually 4KB) buffer, the output won't appear to the other end of the pipe until this buffer is full. This patch makes the piped output of the 'rate' command's consistent with tty console output. Signed-off-by: Andy Zhou Signed-off-by: Ben Pfaff --- utilities/ovs-benchmark.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities/ovs-benchmark.c b/utilities/ovs-benchmark.c index 162f7cf0a..8bea9f085 100644 --- a/utilities/ovs-benchmark.c +++ b/utilities/ovs-benchmark.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -472,6 +472,7 @@ cmd_rate(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) printf("%.3f s elapsed, %u OK, %u failed, avg %.1f/s\n", elapsed / 1000.0, completed - failures, failures, completed / (elapsed / 1000.0)); + fflush(stdout); prev = now; if (timeout && elapsed > timeout * 1000LL) { -- 2.43.0