summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2016-05-24 21:52:39 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-06-06 22:43:12 +0200
commitc51fd6395d67a6d414834db7f892c95594247d6f (patch)
tree43f9cc6f79f78e967385da90757e8faec92daeef /tools/perf/builtin-stat.c
parentperf stat: Print topology/time headers with --metric-only (diff)
downloadlinux-c51fd6395d67a6d414834db7f892c95594247d6f.tar.xz
linux-c51fd6395d67a6d414834db7f892c95594247d6f.zip
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>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-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[] = {
[AGGR_GLOBAL] = 0,
};
+static const char *aggr_header_csv[] = {
+ [AGGR_CORE] = "core,cpus,",
+ [AGGR_SOCKET] = "socket,cpus",
+ [AGGR_NONE] = "cpu,",
+ [AGGR_THREAD] = "comm-pid,",
+ [AGGR_GLOBAL] = ""
+};
+
static void print_metric_headers(const char *prefix, bool no_indent)
{
struct perf_stat_output_ctx out;
@@ -1330,6 +1338,12 @@ static void print_metric_headers(const char *prefix, bool no_indent)
if (!csv_output && !no_indent)
fprintf(stat_config.output, "%*s",
aggr_header_lens[stat_config.aggr_mode], "");
+ if (csv_output) {
+ if (stat_config.interval)
+ fputs("time,", stat_config.output);
+ fputs(aggr_header_csv[stat_config.aggr_mode],
+ stat_config.output);
+ }
/* Print metrics headers only */
evlist__for_each(evsel_list, counter) {