glbench: Flush stdout after printing each result
When `printf` writes to a buffered non-tty, it does not flush until the
buffer is full. This patch adds an explicit `fflush` after printing each
test result because I want to watch a steady stream of result updates
when redirecting through `tee`. Without this, nearly a minute
passes before the first flush.
BUG=none
TEST=./glbench |& tee log; Watch a steady stream of output to the tty.
Change-Id: I29c40b0f043e6fec4ad9587a4c6ccd7b06473bd2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/glbench/+/6669610
Reviewed-by: Brian Geffon <[email protected]>
Tested-by: Lina Versace <[email protected]>
Commit-Queue: ChromeOS Auto Runner <[email protected]>
Commit-Queue: Brian Geffon <[email protected]>
Auto-Submit: Lina Versace <[email protected]>
diff --git a/src/testbase.cc b/src/testbase.cc
index 5fab7c4..842e1fc 100644
--- a/src/testbase.cc
+++ b/src/testbase.cc
@@ -174,6 +174,7 @@
// Results are marked using a leading '@RESULT: ' to allow parsing.
printf("@RESULT: %-*s = %10.2f %-15s [%s]\n", MAX_TESTNAME, testname, value,
test->Unit(), name_png);
+ fflush(stdout);
}
bool DrawArraysTestFunc::TestFunc(uint64_t iterations) {