linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf stat: Fix multi-line metric output in JSON
@ 2022-12-02 19:04 Namhyung Kim
  2022-12-02 19:31 ` Wang, Weilin
  0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2022-12-02 19:04 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ingo Molnar, Peter Zijlstra, LKML, Ian Rogers, Adrian Hunter,
	linux-perf-users, Kan Liang, Zhengjun Xing, James Clark,
	Athira Jajeev, Wang, Weilin

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

Fixes: ab6baaae2735 ("perf stat: Fix JSON output in metric-only mode")
Reported-by: "Wang, Weilin" <weilin.wang@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
Weilin, could you please verify it fixes your problem?

 tools/perf/util/stat-display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index f1ee4b052198..8d0bdd57163d 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -440,7 +440,7 @@ static void new_line_json(struct perf_stat_config *config, void *ctx)
 {
 	struct outstate *os = ctx;
 
-	fputc('\n', os->fh);
+	fputs("\n{", os->fh);
 	if (os->prefix)
 		fprintf(os->fh, "%s", os->prefix);
 	aggr_printout(config, os->evsel, os->id, os->nr);
-- 
2.39.0.rc0.267.gcb52ba06e7-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-05 18:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02 19:04 [PATCH] perf stat: Fix multi-line metric output in JSON Namhyung Kim
2022-12-02 19:31 ` Wang, Weilin
2022-12-05 13:03   ` Arnaldo Carvalho de Melo
2022-12-05 18:07     ` Wang, Weilin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).