Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752634AbbH1Nda (ORCPT ); Fri, 28 Aug 2015 09:33:30 -0400 Received: from mga03.intel.com ([134.134.136.65]:41353 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752035AbbH1Nd3 convert rfc822-to-8bit (ORCPT ); Fri, 28 Aug 2015 09:33:29 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,424,1437462000"; d="scan'208";a="792739189" From: "Liang, Kan" To: "acme@kernel.org" , Jiri Olsa CC: "jolsa@kernel.org" , "ak@linux.intel.com" , "namhyung@kernel.org" , "eranian@google.com" , "Hunter, Adrian" , "dsahern@gmail.com" , "a.p.zijlstra@chello.nl" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH V2 1/3] perf,tools: get correct cpu id for print_aggr Thread-Topic: [PATCH V2 1/3] perf,tools: get correct cpu id for print_aggr Thread-Index: AQHQtNKRMDGRsPb1nUKQV3bf3DvNCp3H1DCAgFns0hA= Date: Fri, 28 Aug 2015 13:33:22 +0000 Message-ID: <37D7C6CF3E00A74B8858931C1DB2F077018F4065@SHSMSX103.ccr.corp.intel.com> References: <1435820925-51091-1-git-send-email-kan.liang@intel.com> <20150702161302.GD19742@krava.brq.redhat.com> In-Reply-To: <20150702161302.GD19742@krava.brq.redhat.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3107 Lines: 96 > On Thu, Jul 02, 2015 at 03:08:43AM -0400, kan.liang@intel.com wrote: > > From: Kan Liang > > > > print_aggr fails to print per-core/per-socket statistics after commit > > 582ec0829b3d ("perf stat: Fix per-socket output bug for uncore > > events") if events have differnt cpus. Because in print_aggr, > > aggr_get_id needs index (not cpu id) to find core/pkg id. Also, evsel > > cpu maps should be used to get aggregated id. > > > > Here is an example. > > Counting events cycles,uncore_imc_0/cas_count_read/. (Uncore event > has > > cpumask 0,18) > > > > "perf stat -e cycles,uncore_imc_0/cas_count_read/ -C0,18 --per-core > > sleep 2" > > > > Without this patch, it failes to get CPU 18 result. > > Performance counter stats for 'CPU(s) 0,18': > > > > S0-C0 1 7526851 cycles > > S0-C0 1 1.05 MiB uncore_imc_0/cas_count_read/ > > S1-C0 0 cycles > > S1-C0 0 MiB uncore_imc_0/cas_count_read/ > > > > With this patch, it can get both CPU0 and CPU18 result. > > Performance counter stats for 'CPU(s) 0,18': > > > > S0-C0 1 6327768 cycles > > S0-C0 1 0.47 MiB uncore_imc_0/cas_count_read/ > > S1-C0 1 330228 cycles > > S1-C0 1 0.29 MiB uncore_imc_0/cas_count_read/ > > > > Signed-off-by: Kan Liang > > Acked-by: Jiri Olsa > Hi Arnaldo, Could you please merge this patch? This patch is to fix a bug of perf stat. It doesn't depend on other patches of the patchset, and can be merged by itself. Thanks, Kan > thanks, > jirka > > > --- > > > > Changes since V1 > > - Modify changelog > > - Remove perf_evsel__get_cpumap_index > > > > tools/perf/builtin-stat.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c > > index 37e301a..47c3c1f 100644 > > --- a/tools/perf/builtin-stat.c > > +++ b/tools/perf/builtin-stat.c > > @@ -694,7 +694,7 @@ static void abs_printout(int id, int nr, struct > > perf_evsel *evsel, double avg) static void print_aggr(char *prefix) > > { > > struct perf_evsel *counter; > > - int cpu, cpu2, s, s2, id, nr; > > + int cpu, s, s2, id, nr; > > double uval; > > u64 ena, run, val; > > > > @@ -707,8 +707,7 @@ static void print_aggr(char *prefix) > > val = ena = run = 0; > > nr = 0; > > for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); > cpu++) { > > - cpu2 = perf_evsel__cpus(counter)- > >map[cpu]; > > - s2 = aggr_get_id(evsel_list->cpus, cpu2); > > + s2 = > aggr_get_id(perf_evsel__cpus(counter), cpu); > > if (s2 != id) > > continue; > > val += perf_counts(counter->counts, cpu, > 0)->val; > > -- > > 1.8.3.1 > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/