diff options
| author | Namhyung Kim <[email protected]> | 2022-11-07 13:33:10 -0800 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-11-14 13:21:19 -0300 |
| commit | fdc7d6082459aa6705dd39b827214f6cfc1fa054 (patch) | |
| tree | e40a6dc885e29d9a6e25ebedcc3c061eee66fee2 /tools/perf/scripts/python/stackcollapse.py | |
| parent | f4e55f88da923f39f0b76edc3da3c52d0b72d429 (diff) | |
perf stat: Fix --metric-only --json output
Currently it prints all metric headers for JSON output. But actually it
skips some metrics with valid_only_metric(). So the output looks like:
$ perf stat --metric-only --json true
{"unit" : "CPUs utilized", "unit" : "/sec", "unit" : "/sec", "unit" : "/sec", "unit" : "GHz", "unit" : "insn per cycle", "unit" : "/sec", "unit" : "branch-misses of all branches"}
{"metric-value" : "3.861"}{"metric-value" : "0.79"}{"metric-value" : "3.04"}
As you can see there are 8 units in the header but only 3 metric-values
are there. It should skip the unused headers as well. Also each unit
should be printed as a separate object like metric values.
With this patch:
$ perf stat --metric-only --json true
{"unit" : "GHz"}{"unit" : "insn per cycle"}{"unit" : "branch-misses of all branches"}
{"metric-value" : "4.166"}{"metric-value" : "0.73"}{"metric-value" : "2.96"}
Fixes: df936cadfb58ba93 ("perf stat: Add JSON output option")
Signed-off-by: Namhyung Kim <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Claire Jensen <[email protected]>
Cc: Ian Rogers <[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]>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions