diff options
| author | Namhyung Kim <[email protected]> | 2022-11-23 18:02:08 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-11-24 12:41:42 +0000 |
| commit | 765d4e497fc51c64b50e5947d0b63bc3ccbd83d3 (patch) | |
| tree | 14123472bb01581721e59c86190c6d0bc3256c37 /tools/perf/util/scripting-engines/trace-event-perl.c | |
| parent | perf stat: Rename "aggregate-number" to "cpu-count" in JSON (diff) | |
| download | kernel-765d4e497fc51c64b50e5947d0b63bc3ccbd83d3.tar.gz kernel-765d4e497fc51c64b50e5947d0b63bc3ccbd83d3.zip | |
perf stat: Tidy up JSON metric-only output when no metrics
It printed empty strings for each metric. I guess it's needed for CSV
output to match the column number. We could just ignore the empty
metrics in JSON but it ended up with a broken JSON object with a
trailing comma.
So I added a dummy '"metric-value" : "none"' part. To do that, it
needs to pass struct outstate to print_metric_end() to check if any
metric value is printed or not.
Before:
# perf stat -aj --metric-only --per-socket --for-each-cgroup system.slice true
{"socket" : "S0", "cpu-count" : 8, "cgroup" : "system.slice", "" : "", "" : "", "" : "", "" : "", "" : "", "" : "", "" : "", "" : ""}
After:
# perf stat -aj --metric-only --per-socket --for-each-cgroup system.slice true
{"socket" : "S0", "cpu-count" : 8, "cgroup" : "system.slice", "metric-value" : "none"}
Signed-off-by: Namhyung Kim <[email protected]>
Acked-by: Ian Rogers <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Athira Jajeev <[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/util/scripting-engines/trace-event-perl.c')
0 files changed, 0 insertions, 0 deletions
