From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751360AbaAEQ6x (ORCPT ); Sun, 5 Jan 2014 11:58:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48399 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112AbaAEQ6w (ORCPT ); Sun, 5 Jan 2014 11:58:52 -0500 Date: Sun, 5 Jan 2014 17:58:31 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Paul Mackerras , Ingo Molnar , Namhyung Kim , LKML , Arun Sharma , Frederic Weisbecker , Rodrigo Campos Subject: Re: [PATCH 05/21] perf hists: Accumulate hist entry stat based on the callchain Message-ID: <20140105165831.GE10018@krava.brq.redhat.com> References: <1387873347-28838-1-git-send-email-namhyung@kernel.org> <1387873347-28838-6-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1387873347-28838-6-git-send-email-namhyung@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 24, 2013 at 05:22:11PM +0900, Namhyung Kim wrote: > From: Namhyung Kim > > Call __hists__add_entry() for each callchain node to get an > accumulated stat for an entry. Introduce new cumulative_iter ops to > process them properly. > > Cc: Arun Sharma > Cc: Frederic Weisbecker > Signed-off-by: Namhyung Kim > --- > tools/perf/builtin-report.c | 103 +++++++++++++++++++++++++++++++++++++++++++- > tools/perf/ui/stdio/hist.c | 2 +- > 2 files changed, 103 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c > index 29fe19071d24..4fde0ab82498 100644 > --- a/tools/perf/builtin-report.c > +++ b/tools/perf/builtin-report.c > @@ -360,6 +360,97 @@ iter_finish_normal_entry(struct add_entry_iter *iter, struct addr_location *al) > return hist_entry__append_callchain(he, sample); > } > > +static int > +iter_prepare_cumulative_entry(struct add_entry_iter *iter, > + struct machine *machine __maybe_unused, > + struct perf_evsel *evsel, > + struct addr_location *al __maybe_unused, > + struct perf_sample *sample) > +{ > + callchain_cursor_commit(&callchain_cursor); > + > + iter->evsel = evsel; > + iter->sample = sample; > + return 0; > +} > + > +static int > +iter_add_single_cumulative_entry(struct add_entry_iter *iter, > + struct addr_location *al) > +{ > + struct perf_evsel *evsel = iter->evsel; > + struct perf_sample *sample = iter->sample; > + struct hist_entry *he; > + > + he = __hists__add_entry(&evsel->hists, al, iter->parent, NULL, NULL, > + sample->period, sample->weight, > + sample->transaction, true); > + if (he == NULL) > + return -ENOMEM; > + > + /* > + * This is for putting parents upward during output resort iff > + * only a child gets sampled. See hist_entry__sort_on_period(). > + */ > + he->callchain->max_depth = PERF_MAX_STACK_DEPTH + 1; so you're using callchain struct to hold the entry's stack position for sorting.. I think we could store this info inside hist_entry itself, and omit 'struct callchain_root' size being allocated for hist_entry I checked 'struct hist_entry' and the 'position' entry seems to be abandonned ;-)) or we could use some unused entry (mem_info?) and create some union. jirka