Re: [PATCH 2/7] perf tools: Account entry stats when it's added to the output tree

From: Namhyung Kim
Date: Wed Apr 23 2014 - 10:43:43 EST


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 <namhyung@xxxxxxxxxx>
> > ---
>
> 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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/