Re: [PATCH perf/core v13 06/15] perf buildid-cache: Scan and import user SDT events to probe cache

From: Masami Hiramatsu
Date: Mon Jul 04 2016 - 22:08:28 EST


On Fri, 1 Jul 2016 15:22:01 -0300
Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:

> Em Fri, Jul 01, 2016 at 05:04:10PM +0900, Masami Hiramatsu escreveu:
> > From: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
> >
> > perf buildid-cache --add <binary> scans given binary and add
> > the SDT events to probe cache. "sdt_" prefix is appended for
> > all SDT providers to avoid event-name clash with other pre-defined
> > events. It is possible to use the cached SDT events as other cached
> > events, via perf probe --add "sdt_<provider>:<event>=<event>".
> >
> > e.g.
> > ----
> > # perf buildid-cache --add /lib/libc-2.17.so
> > # perf probe --cache --list | head -n 5
> > /usr/lib/libc-2.17.so (a6fb821bdf53660eb2c29f778757aef294d3d392):
> > sdt_libc:setjmp=setjmp
> > sdt_libc:longjmp=longjmp
> > sdt_libc:longjmp_target=longjmp_target
> > sdt_libc:memory_heap_new=memory_heap_new
> > # perf probe -x /usr/lib/libc-2.17.so \
> > -a sdt_libc:memory_heap_new=memory_heap_new
>
> Why not remove the need for that build-cache --add? I.e. go straight to:
>
> perf probe -x /usr/lib/libc-2.17.so -a sdt_libc:memory_heap_new=memory_heap_new
>
> And all the various steps above be done automagically?

Ah, this has been done :) Yes, you can do that already.

See commit dd975497ad ("perf probe: Introduce perf_cache interfaces")
which introduces probe cache and it automatically add the target
binary to the buildid-cache.

Thank you,


--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>