perf bench: Add missing setlocale() call to allow usage of %'d style formatting
Arnaldo Carvalho de Melo
maintainerPATCH 1/1 perf bench: Add missing setlocale() call to allow usage of %'d style formatting
FYI: I'm carrying this in the perf-tools-next branch,
Thanks,
- Arnaldo
---
Without this we were not getting the thousands separator for big numbers.
Noticed while developing 'perf bench uprobe', but the use of %' predates that, for instance 'perf bench syscall' uses it.
Before:
# perf bench uprobe all
# Running uprobe/baseline benchmark...
# Executed 1000 usleep(1000) calls
Total time: 1054082243ns1054082.243000 nsecs/op
#
After:
# perf bench uprobe all
# Running uprobe/baseline benchmark...
# Executed 1,000 usleep(1000) calls
Total time: 1,053,715,144ns1,053,715.144000 nsecs/op
#
Fixes c2a08203052f8975 ("perf bench: Add basic syscall benchmark")
Cc Adrian Hunter <[email protected]>
Cc Andre Fredette <[email protected]>
Cc Clark Williams <[email protected]>
Cc Dave Tucker <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc Derek Barbosa <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Tiezhu Yang <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-bench.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/builtin-bench.c +2 -0
@@ -21,6 +21,7 @@#include "builtin.h" #include "bench/bench.h" +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h>
@@ -260,6 +261,7 @@ int cmd_bench(int argc, const char **argv)/* Unbuffered output */ setvbuf (stdout,NULL , _IONBF,0 ); +setlocale (LC_ALL ,"" );if (argc <2 ) {/* No collection specified. */
Signature · 1 line
2.37.1