From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751617AbdKUPRy (ORCPT ); Tue, 21 Nov 2017 10:17:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51646 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587AbdKUPRw (ORCPT ); Tue, 21 Nov 2017 10:17:52 -0500 Date: Tue, 21 Nov 2017 16:17:49 +0100 From: Jiri Olsa To: Jin Yao Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com Subject: Re: [PATCH v1 4/9] perf util: Update and print per-thread shadow stats Message-ID: <20171121151749.GH20440@krava> References: <1511189024-19908-1-git-send-email-yao.jin@linux.intel.com> <1511189024-19908-5-git-send-email-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1511189024-19908-5-git-send-email-yao.jin@linux.intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 Nov 2017 15:17:52 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 20, 2017 at 10:43:39PM +0800, Jin Yao wrote: SNIP > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c > index 045e129..6f28782 100644 > --- a/tools/perf/util/stat-shadow.c > +++ b/tools/perf/util/stat-shadow.c > @@ -110,19 +110,32 @@ static void saved_value_delete(struct rblist *rblist __maybe_unused, > > static struct saved_value *saved_value_lookup(struct perf_evsel *evsel, > int cpu, > - bool create) > + bool create, > + enum stat_type type, > + int ctx, > + struct runtime_stat *stat) > { > + struct rblist *rblist; > struct rb_node *nd; > struct saved_value dm = { > .cpu = cpu, > .evsel = evsel, > + .type = type, > + .ctx = ctx, > + .stat = stat, > }; > - nd = rblist__find(&runtime_saved_values, &dm); > + > + if (stat) > + rblist = &stat->value_list; > + else > + rblist = &rt_stat.value_list; please pass the correct 'struct runtime_stat *stat', I don't see a reason noot to pass &rt_stat directly below: > diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c > index 151e9ef..50bb16d 100644 > --- a/tools/perf/util/stat.c > +++ b/tools/perf/util/stat.c > @@ -278,9 +278,16 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel > perf_evsel__compute_deltas(evsel, cpu, thread, count); > perf_counts_values__scale(count, config->scale, NULL); > if (config->aggr_mode == AGGR_NONE) > - perf_stat__update_shadow_stats(evsel, count->val, cpu); > - if (config->aggr_mode == AGGR_THREAD) > - perf_stat__update_shadow_stats(evsel, count->val, 0); > + perf_stat__update_shadow_stats(evsel, count->val, cpu, > + NULL); > + if (config->aggr_mode == AGGR_THREAD) { > + if (config->stats) > + perf_stat__update_shadow_stats(evsel, > + count->val, 0, &config->stats[thread]); > + else > + perf_stat__update_shadow_stats(evsel, > + count->val, 0, NULL); here > + } > break; > case AGGR_GLOBAL: > aggr->val += count->val; > @@ -362,7 +369,7 @@ int perf_stat_process_counter(struct perf_stat_config *config, > /* > * Save the full runtime - to allow normalization during printout: > */ > - perf_stat__update_shadow_stats(counter, *count, 0); > + perf_stat__update_shadow_stats(counter, *count, 0, NULL); and here thanks, jirka