Commit 117195d9 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf stat: Fix multi-line metric output in JSON

When a metric produces more than one values, it missed to print the opening
bracket.

Fixes: ab6baaae ("perf stat: Fix JSON output in metric-only mode")
Reported-by: default avatarWeilin Wang <weilin.wang@intel.com>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Tested-by: default avatarWeilin Wang <weilin.wang@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221202190447.1588680-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 113bb396
...@@ -441,7 +441,7 @@ static void new_line_json(struct perf_stat_config *config, void *ctx) ...@@ -441,7 +441,7 @@ static void new_line_json(struct perf_stat_config *config, void *ctx)
{ {
struct outstate *os = ctx; struct outstate *os = ctx;
fputc('\n', os->fh); fputs("\n{", os->fh);
if (os->prefix) if (os->prefix)
fprintf(os->fh, "%s", os->prefix); fprintf(os->fh, "%s", os->prefix);
aggr_printout(config, os->evsel, os->id, os->nr); aggr_printout(config, os->evsel, os->id, os->nr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment