From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423070AbcFHIk2 (ORCPT ); Wed, 8 Jun 2016 04:40:28 -0400 Received: from terminus.zytor.com ([198.137.202.10]:53820 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161213AbcFHIk0 (ORCPT ); Wed, 8 Jun 2016 04:40:26 -0400 Date: Wed, 8 Jun 2016 01:40:12 -0700 From: tip-bot for Andi Kleen Message-ID: Cc: mingo@kernel.org, tglx@linutronix.de, ak@linux.intel.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, hpa@zytor.com, acme@redhat.com Reply-To: mingo@kernel.org, tglx@linutronix.de, ak@linux.intel.com, hpa@zytor.com, jolsa@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <1464119559-17203-4-git-send-email-andi@firstfloor.org> References: <1464119559-17203-4-git-send-email-andi@firstfloor.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat: Add missing aggregation headers for --metric-only CSV Git-Commit-ID: c51fd6395d67a6d414834db7f892c95594247d6f X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c51fd6395d67a6d414834db7f892c95594247d6f Gitweb: http://git.kernel.org/tip/c51fd6395d67a6d414834db7f892c95594247d6f Author: Andi Kleen AuthorDate: Tue, 24 May 2016 12:52:39 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 6 Jun 2016 17:43:12 -0300 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 Acked-by: Jiri Olsa Link: http://lkml.kernel.org/r/1464119559-17203-4-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- 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 a168e72..dff6373 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) {