aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2016-05-24 15:52:39 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-06-06 16:43:12 -0400
commitc51fd6395d67a6d414834db7f892c95594247d6f (patch)
tree43f9cc6f79f78e967385da90757e8faec92daeef
parent41c8ca2a924b359e8f1768f8550487cd13a1ec03 (diff)
perf stat: Add missing aggregation headers for --metric-only CSV
When in CSV mode --metric-only outputs an header, unlike the other modes. Previously it did not properly print headers for the aggregation columns, so the headers were actually shifted against the real values. Fix this here by outputting the correct headers for CSV. v2: Indent array. Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/1464119559-17203-4-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/builtin-stat.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a168e726756b..dff63733dfb7 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1316,6 +1316,14 @@ static int aggr_header_lens[] = {
1316 [AGGR_GLOBAL] = 0, 1316 [AGGR_GLOBAL] = 0,
1317}; 1317};
1318 1318
1319static const char *aggr_header_csv[] = {
1320 [AGGR_CORE] = "core,cpus,",
1321 [AGGR_SOCKET] = "socket,cpus",
1322 [AGGR_NONE] = "cpu,",
1323 [AGGR_THREAD] = "comm-pid,",
1324 [AGGR_GLOBAL] = ""
1325};
1326
1319static void print_metric_headers(const char *prefix, bool no_indent) 1327static void print_metric_headers(const char *prefix, bool no_indent)
1320{ 1328{
1321 struct perf_stat_output_ctx out; 1329 struct perf_stat_output_ctx out;
@@ -1330,6 +1338,12 @@ static void print_metric_headers(const char *prefix, bool no_indent)
1330 if (!csv_output && !no_indent) 1338 if (!csv_output && !no_indent)
1331 fprintf(stat_config.output, "%*s", 1339 fprintf(stat_config.output, "%*s",
1332 aggr_header_lens[stat_config.aggr_mode], ""); 1340 aggr_header_lens[stat_config.aggr_mode], "");
1341 if (csv_output) {
1342 if (stat_config.interval)
1343 fputs("time,", stat_config.output);
1344 fputs(aggr_header_csv[stat_config.aggr_mode],
1345 stat_config.output);
1346 }
1333 1347
1334 /* Print metrics headers only */ 1348 /* Print metrics headers only */
1335 evlist__for_each(evsel_list, counter) { 1349 evlist__for_each(evsel_list, counter) {