linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 09/11] perf stat: Add missing aggregation headers for --metric-only CSV
Date: Mon,  6 Jun 2016 18:04:41 -0300	[thread overview]
Message-ID: <1465247083-4763-10-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1465247083-4763-1-git-send-email-acme@kernel.org>

From: Andi Kleen <ak@linux.intel.com>

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>
---
 tools/perf/builtin-stat.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

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) {
-- 
2.5.5

  parent reply	other threads:[~2016-06-06 21:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 21:04 [GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 01/11] perf evsel: Provide way to extract integer value from format_field Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 02/11] perf evlist: Fix alloc_mmap() failure path Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 03/11] tools lib api: Respect CROSS_COMPILE for the linker Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 04/11] perf script: Show call graphs when 1st event doesn't have it but some other has Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 05/11] perf test: Ignore .scale and other special files Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 06/11] perf stat: Basic support for TopDown in perf stat Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 07/11] perf stat: Add computation of TopDown formulas Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 08/11] perf stat: Print topology/time headers with --metric-only Arnaldo Carvalho de Melo
2016-06-06 21:04 ` Arnaldo Carvalho de Melo [this message]
2016-06-06 21:04 ` [PATCH 10/11] perf config: Fix abnormal termination at perf_parse_file() Arnaldo Carvalho de Melo
2016-06-06 21:04 ` [PATCH 11/11] perf config: Handle the error when config set is NULL at collect_config() Arnaldo Carvalho de Melo
2016-06-08  7:32 ` [GIT PULL 00/11] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465247083-4763-10-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).