Re: [PATCH 10/28] perf report: Cache cumulative callchains

From: Jiri Olsa
Date: Tue Jan 14 2014 - 08:18:00 EST


On Tue, Jan 14, 2014 at 08:55:50AM +0900, Namhyung Kim wrote:
> Hi Jiri,
>
> Thanks for reminding me. :)
>
> On Thu, 9 Jan 2014 19:06:28 +0100, Jiri Olsa wrote:
> > On Wed, Jan 08, 2014 at 05:46:15PM +0900, Namhyung Kim wrote:
>
> [SNIP]
> >> + /*
> >> + * Check if there's duplicate entries in the callchain.
> >> + * It's possible that it has cycles or recursive calls.
> >> + */
> >> + for (i = 0; i < iter->curr; i++) {
> >> + if (hist_entry__cmp(he_cache[i], &he_tmp) == 0)
> >
> > we need here:
> > iter->he = he_cache[i];
> >
> >> + return 0;
> >> + }
> >
> > otherwise iter->he and al are not in sync and
> > hist_entry__inc_addr_samples fails in hist_iter_cb
>
> Right. But the point of the he_cache is to skip duplicate entries. So
> I'd like to change it like setting it to NULL and check it before the
> callback function:
>
> while (iter->next_entry(iter, al)) {
> err = iter->add_next_entry(iter, al);
> if (err)
> break;
>
> if (iter->he && iter->add_entry_cb) {
> err = iter->add_entry_cb(iter, al, ...);
> if (err)
> break;
> }
> }
>
> What do you think?

yep, better ;-) I saw you sent v6.. I'll check that

jirka
--
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/