public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf stat: fix cvs output format
@ 2018-03-06  6:43 Cong Wang
  2018-03-06  7:58 ` Jiri Olsa
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Cong Wang @ 2018-03-06  6:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Cong Wang, Andi Kleen, Arnaldo Carvalho de Melo, Jiri Olsa,
	Ilya Pronin

From: Ilya Pronin <ipronin@twitter.com>

When printing stats in CSV mode, perf stat appends extra CSV
separators when counter is not supported:

<not supported>,,L1-dcache-store-misses,mesos/bd442f34-2b4a-47df-b966-9b281f9f56fc,0,100.00,,,,

which causes a failure of parsing fields. The numbers of separators
is fixed for each line, no matter supported or not supported.

Fixes: 92a61f6412d3 ("perf stat: Implement CSV metrics output")
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Ilya Pronin <ipronin@twitter.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 tools/perf/builtin-stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 98bf9d32f222..54a4c152edb3 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -917,7 +917,7 @@ static void print_metric_csv(void *ctx,
 	char buf[64], *vals, *ends;
 
 	if (unit == NULL || fmt == NULL) {
-		fprintf(out, "%s%s%s%s", csv_sep, csv_sep, csv_sep, csv_sep);
+		fprintf(out, "%s%s", csv_sep, csv_sep);
 		return;
 	}
 	snprintf(buf, sizeof(buf), fmt, val);
-- 
2.13.0

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

end of thread, other threads:[~2018-03-09  0:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-06  6:43 [PATCH] perf stat: fix cvs output format Cong Wang
2018-03-06  7:58 ` Jiri Olsa
2018-03-06 13:54   ` Arnaldo Carvalho de Melo
2018-03-06 17:00 ` Andi Kleen
2018-03-06 17:30   ` Arnaldo Carvalho de Melo
2018-03-06 18:57     ` Andi Kleen
2018-03-06 17:47   ` Cong Wang
2018-03-06 17:53     ` Andi Kleen
2018-03-06 19:03       ` Cong Wang
2018-03-06 20:31         ` Ilya Pronin
2018-03-07 17:04           ` Andi Kleen
2018-03-08 21:52             ` Ilya Pronin
2018-03-09  0:06               ` Andi Kleen
2018-03-07  8:27 ` [tip:perf/urgent] perf stat: Fix CVS output format for non-supported counters tip-bot for Ilya Pronin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox