diff options
author | Namhyung Kim <[email protected]> | 2022-11-07 13:33:12 -0800 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-11-14 13:21:19 -0300 |
commit | 1cc7642abba7b281ecd836bfb56fc6dedac32555 (patch) | |
tree | b48bf9ff803e9dd071508aaa530068acbd0bf9de | |
parent | 6d0a7e394eabd456f70c2f2f8e958b2343074360 (diff) |
perf stat: Add header for interval in JSON output
It missed to print a matching header line for intervals.
Before:
# perf stat -a -e cycles,instructions --metric-only -j -I 500
{"unit" : "insn per cycle"}
{"interval" : 0.500544283}{"metric-value" : "1.96"}
^C
After:
# perf stat -a -e cycles,instructions --metric-only -j -I 500
{"unit" : "sec"}{"unit" : "insn per cycle"}
{"interval" : 0.500515681}{"metric-value" : "2.31"}
^C
Signed-off-by: Namhyung Kim <[email protected]>
Acked-by: Ian Rogers <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Xing Zhengjun <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/stat-display.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 99bc0db8f068..2a08c66121ec 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -858,6 +858,10 @@ static void print_metric_headers(struct perf_stat_config *config, if (!config->iostat_run) fputs(aggr_header_csv[config->aggr_mode], config->output); } + if (config->json_output) { + if (config->interval) + fputs("{\"unit\" : \"sec\"}", config->output); + } if (config->iostat_run) iostat_print_header_prefix(config); |