From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754308AbcCCLe1 (ORCPT ); Thu, 3 Mar 2016 06:34:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40109 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbcCCLeZ (ORCPT ); Thu, 3 Mar 2016 06:34:25 -0500 Date: Thu, 3 Mar 2016 12:34:20 +0100 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH 6/7] perf, tools, stat: Add --metric-only support for -A Message-ID: <20160303113420.GD14355@krava.redhat.com> References: <1456964698-21901-1-git-send-email-andi@firstfloor.org> <1456964698-21901-7-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1456964698-21901-7-git-send-email-andi@firstfloor.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 03 Mar 2016 11:34:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 02, 2016 at 04:24:57PM -0800, Andi Kleen wrote: > From: Andi Kleen > > Add metric only support for -A too. This requires a new print > function that prints the metrics in the right order. > > v2: Fix manpage > Signed-off-by: Andi Kleen > --- > tools/perf/Documentation/perf-stat.txt | 2 +- > tools/perf/builtin-stat.c | 48 ++++++++++++++++++++++++++++------ > 2 files changed, 41 insertions(+), 9 deletions(-) > > diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt > index 271f71d..341757a 100644 > --- a/tools/perf/Documentation/perf-stat.txt > +++ b/tools/perf/Documentation/perf-stat.txt > @@ -141,7 +141,7 @@ The overhead percentage could be high in some cases, for instance with small, su > > --metric-only:: > Only print computed metrics. Print them in a single line. > -Don't show any raw values. Not supported with -A or --per-thread. > +Don't show any raw values. Not supported with --per-thread. > > --per-socket:: > Aggregate counts per processor socket for system-wide mode measurements. This > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c > index 0196fed..42975ae 100644 > --- a/tools/perf/builtin-stat.c > +++ b/tools/perf/builtin-stat.c > @@ -1250,10 +1250,43 @@ static void print_counter(struct perf_evsel *counter, char *prefix) > } > } > > +static void print_no_aggr_metric(char *prefix) > +{ > + int cpu; > + int nrcpus = 0; > + struct perf_evsel *counter; > + u64 ena, run, val; > + double uval; > + > + evlist__for_each(evsel_list, counter) { > + nrcpus = perf_evsel__nr_cpus(counter); > + break; > + } what's the loop for? why can't you use evsel_list->cpus ? jirka