hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/tools/perf/builtin-bench.c
....@@ -21,6 +21,7 @@
2121 #include "builtin.h"
2222 #include "bench/bench.h"
2323
24
+#include <locale.h>
2425 #include <stdio.h>
2526 #include <stdlib.h>
2627 #include <string.h>
....@@ -225,7 +226,6 @@
225226 if (!bench->fn)
226227 break;
227228 printf("# Running %s/%s benchmark...\n", coll->name, bench->name);
228
- fflush(stdout);
229229
230230 argv[1] = bench->name;
231231 run_bench(coll->name, bench->name, bench->fn, 1, argv);
....@@ -245,6 +245,10 @@
245245 {
246246 struct collection *coll;
247247 int ret = 0;
248
+
249
+ /* Unbuffered output */
250
+ setvbuf(stdout, NULL, _IONBF, 0);
251
+ setlocale(LC_ALL, "");
248252
249253 if (argc < 2) {
250254 /* No collection specified. */
....@@ -299,7 +303,6 @@
299303
300304 if (bench_format == BENCH_FORMAT_DEFAULT)
301305 printf("# Running '%s/%s' benchmark:\n", coll->name, bench->name);
302
- fflush(stdout);
303306 ret = run_bench(coll->name, bench->name, bench->fn, argc-1, argv+1);
304307 goto end;
305308 }