From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757370AbaDWOna (ORCPT ); Wed, 23 Apr 2014 10:43:30 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:48759 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757339AbaDWOnY (ORCPT ); Wed, 23 Apr 2014 10:43:24 -0400 Subject: Re: [PATCH 2/7] perf tools: Account entry stats when it's added to the output tree From: Namhyung Kim To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Paul Mackerras , Namhyung Kim , LKML , David Ahern , Andi Kleen In-Reply-To: <20140423133536.GC11124@krava.brq.redhat.com> References: <1398236408-8856-1-git-send-email-namhyung@kernel.org> <1398236408-8856-3-git-send-email-namhyung@kernel.org> <20140423133536.GC11124@krava.brq.redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Wed, 23 Apr 2014 23:43:16 +0900 Message-ID: <1398264196.1696.12.camel@leonhard> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, 2014-04-23 (수), 15:35 +0200, Jiri Olsa: > On Wed, Apr 23, 2014 at 04:00:03PM +0900, Namhyung Kim wrote: > > Currently, accounting each sample is done in multiple places - once > > when adding them to the input tree, other when adding them to the > > output tree. It's not only confusing but also can cause a subtle > > problem since concurrent processing like in perf top might see the > > updated stats before adding entries into the output tree - like seeing > > more (blank) lines at the end and/or slight inaccurate percentage. > > > > To fix this, only account the entries when it's moved into the output > > tree so that they cannot be seen prematurely. There're some > > exceptional cases here and there - they should be addressed separately > > with comments. > > sry to be PITA, but need to ask you to split the patch, > otherwise I'd get beaten for that ;-) No problem. I'll split it in the next spin. > > I can see several separated changes here: > * remove stats for input tree (as stated in changelog) > * hists__inc_nr_entries -> hists__inc_stats rename > * add hists__reset_stats function > * move hists__calc_col_len out of hists__inc_nr_entries > > > > > > Signed-off-by: Namhyung Kim > > --- > > SNIP > > > > > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c > > index aed52036468d..4bdcc040b216 100644 > > --- a/tools/perf/builtin-report.c > > +++ b/tools/perf/builtin-report.c > > @@ -85,6 +85,10 @@ static void report__inc_stats(struct report *rep, struct hist_entry *he) > > */ > > if (he->stat.nr_events == 1) > > rep->nr_entries++; > > + > > + hists__inc_nr_events(he->hists, PERF_RECORD_SAMPLE); > > + if (!he->filtered) > > + he->hists->stats.nr_non_filtered_samples++; > > could you put here some comments as for the diff command > I mean why is this exception in stats counting for input tree Will do as well. Thanks, Namhyung