Re: [RFC] perf record: missing buildid for callstack modules

From: Namhyung Kim
Date: Mon Jan 11 2016 - 06:03:12 EST


Hi Adrian,

On Mon, Jan 11, 2016 at 11:27:56AM +0200, Adrian Hunter wrote:
> On 09/01/16 12:31, Namhyung Kim wrote:
> > Hi Stephane,
> >
> > On Fri, Jan 08, 2016 at 10:01:24AM -0800, Stephane Eranian wrote:
> >> On Thu, Jan 7, 2016 at 3:47 PM, Arnaldo Carvalho de Melo
> >> <acme@xxxxxxxxxx> wrote:
> >>> Em Fri, Jan 08, 2016 at 07:47:03AM +0900, Namhyung Kim escreveu:
> >>>> On January 8, 2016 7:00:35 AM GMT+09:00, Stephane Eranian <eranian@xxxxxxxxxx> wrote:
> >>>>> On Thu, Jan 7, 2016 at 1:59 PM, Arnaldo Carvalho de Melo
> >>>>> <acme@xxxxxxxxxx> wrote:
> >>>>>> Em Thu, Jan 07, 2016 at 01:56:14PM -0800, Stephane Eranian escreveu:
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> Whenever you do:
> >>>>>>>
> >>>>>>> $ perf record -g -a sleep 10
> >>>>>>>
> >>>>>>> Perf will collect the callstack for each sample. At the end of the
> >>>>>>> run, perf record
> >>>>>>> adds the buildid for all dso with at least one sample. But when it
> >>>>> does this, it
> >>>>>>> only looks at the sampled IP and ignore the modules traversed by the
> >>>>> callstack.
> >>>>>>> That means that, it is not possible to uniquely identify the modules
> >>>>> executed,
> >>>>>>> unless they had at least one IP sample captured. But this is not
> >>>>>>> always the case.
> >>>>>>>
> >>>>>>> How about providing an option to perf record to force collecting
> >>>>>>> buildid for all IPs
> >>>>>>> captured in the callstack? I understand that would cost more at the
> >>>>> end of the
> >>>>>>> collection, but this would be beneficial to several monitoring
> >>>>> scenarios.
> >>>>>>
> >>>>>> I agree, would consider applying a patch that provides the option but
> >>>>>> does not do this by default.
> >>>>>>
> >>>>> I agree, not the default.
> >>>>
> >>>> Hi Stephane,
> >>>>
> >>>> Please see
> >>>>
> >>>> https://lkml.org/lkml/2015/3/22/249
> >>>
> >>>
> >>> Oops, Stephane, please try this, so that we can finally merge it :-\
> >>>
> >> I will try it today. However, I am a bit worried about the performance
> >> impact. Unless I am missing something in this approach we may end up
> >> looking up N times the same module if it appears in N callstacks. In
> >> Andi's suggested approach, there would be only one pass at the beginning
> >> (or the end of the run). But you could miss some modules if they are gone
> >> by the time you run the pass.
> >
> > How about this then?
> >
> > Adrian, is it ok to skip process_buildids() for the auxtrace?
>
> If you don't post-process (i.e. call process_buildids), then where do the
> DSOs come from? i.e. dsos__hit_all() just hits the DSOs that exist.

Ah, right. I somehow thought that it was processed already elsewhere.

Then, how about this?