From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752523AbcBURWJ (ORCPT ); Sun, 21 Feb 2016 12:22:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35837 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751122AbcBURWF (ORCPT ); Sun, 21 Feb 2016 12:22:05 -0500 Date: Sun, 21 Feb 2016 18:22:01 +0100 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, eranian@google.com, Andi Kleen Subject: Re: [PATCH 3/6] perf, tools, stat: Support metrics in --per-core/socket mode Message-ID: <20160221172201.GE10701@krava.homerouter.cpe> References: <1455749045-18098-1-git-send-email-andi@firstfloor.org> <1455749045-18098-4-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455749045-18098-4-git-send-email-andi@firstfloor.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2016 at 02:44:02PM -0800, Andi Kleen wrote: SNIP > +static void aggr_update_shadow(void) > +{ > + int cpu, cpu2, s2, id, s; > + u64 val; > + struct perf_evsel *counter; > + > + for (s = 0; s < aggr_map->nr; s++) { > + id = aggr_map->map[s]; > + evlist__for_each(evsel_list, counter) { > + val = 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); > + if (s2 != id) > + continue; > + val += perf_counts(counter->counts, cpu, 0)->val; > + } > + val = val * counter->scale; > + perf_stat__update_shadow_stats(counter, &val, > + first_shadow_cpu(counter, id)); > + } > + } > +} > + > static void print_aggr(char *prefix) > { > FILE *output = stat_config.output; > @@ -982,6 +1024,8 @@ static void print_aggr(char *prefix) > if (!(aggr_map || aggr_get_id)) > return; > > + aggr_update_shadow(); this should be called from perf_stat_process_counter, not from display function also please document somewhere (best around shadow stats variables) what cpus (array members) are used for given AGGR_* thanks, jirka