Re: [PATCH 14/26] perf tools: Add mmap3 events to --show-mmap-events option

Jiri Olsa
2020-09-14T20:30:08Z

On Mon, Sep 14, 2020 at 03:30:53PM +0900, Namhyung Kim wrote:
> On Mon, Sep 14, 2020 at 6:04 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Displaying mmap3 events for --show-mmap-events option,
> > the build id is displayed within <> braces:
> >
> > $ perf script --show-mmap-events
> > kill 12148 13893.519014: PERF_RECORD_MMAP3 12148/12148: <43938d0803c5e3130ea679cd569aaf44b98d9ae8> [0x560e7d7f..
> > kill 12148 13893.519420: PERF_RECORD_MMAP3 12148/12148: <1805c738c8f3ec0f47b7ea09080c28f34d18a82b> [0x7f9e7dfc..
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/perf/builtin-script.c | 33 +++++++++++++++++++++++++++++++++
> > 1 file changed, 33 insertions(+)
> >
> > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> > index d839983cfb88..9c09581d5cb0 100644
> > --- a/tools/perf/builtin-script.c
> > +++ b/tools/perf/builtin-script.c
> > @@ -2342,6 +2342,38 @@ static int process_mmap2_event(struct perf_tool *tool,
> > event->mmap2.tid);
> > }
> >
> > +static int process_mmap3_event(struct perf_tool *tool,
> > + union perf_event *event,
> > + struct perf_sample *sample,
> > + struct machine *machine)
> > +{
> > + struct thread *thread;
> > + struct perf_script *script = container_of(tool, struct perf_script, tool);
> > + struct perf_session *session = script->session;
> > + struct evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
> > +
> > + if (perf_event__process_mmap3(tool, event, sample, machine) < 0)
> > + return -1;
> > +
> > + thread = machine__findnew_thread(machine, event->mmap3.pid, event->mmap3.tid);
> > + if (thread == NULL) {
> > + pr_debug("problem processing MMAP2 event, skipping it.\n");
>
> MMAP3 ?

yes, thanks,
jirka