Re: [PATCH 35/40] perf record: Synthesize COMM event for a command line workload

From: Namhyung Kim
Date: Tue May 19 2015 - 20:06:31 EST


On Tue, May 19, 2015 at 05:18:54PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, May 19, 2015 at 09:49:03PM +0200, Jiri Olsa escreveu:
> > On Wed, May 20, 2015 at 12:12:45AM +0900, Namhyung Kim wrote:
> >
> > SNIP
> >
> > > > > >
> > > > > > This looks reasonable, but I think it probably needs to be done
> > > > > > somewhere in perf_evlist__prepare_workload() or
> > > > > > perf_evlist__start_workload(), as this affects other tools as well, like
> > > > > > 'top', 'trace' and any other that may want to do this start-workload use
> > > > > > case.
> > > > >
> > > > > Hmm.. I need to look at this again as it only affects on processing
> > > > > indexed data files which used to have a separate missing threads tree.
> > > >
> > > > Humm, you're thinking about where you managed to reproduce the problem,
> > > > I am thinking outside indexing, etc, i.e. by definition we either enable
> > > > the event before we fork, so that we get the PERF_RECORD_FORK/COMM or we
> > > > synthesize it either from /proc or directly (preferred) if we decide to
> > > > do it after the fork/exec, right?
> > >
> > > But as I said before, later COMM event will override thread->comm to a
> > > proper string as long as it can find a matching thread. So I think it
> > > has no problem in the current code.
>
> > I can see the issue in the current script code and the patch cured it ;-)
>
> Exactly, this is my point, this is not something new :-)

Ah, okay. The perf script shows samples before processing comm events
while perf report shows after processing all events.

But to move it under generic place like perf_evlist__{prepare,start}_
workload(), it seems we need to pass an additional callback and data.

I'll try to write a patch.

Thanks,
Namhyung

>
> - Arnaldo
>
> > before:
> >
> > [jolsa@krava perf]$ ./perf record -o - true | ./perf script
> > [ perf record: Woken up 1 times to write data ]
> > [ perf record: Captured and wrote 0.000 MB - ]
> > :29236 29236 350869.479255: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > :29236 29236 350869.479260: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > :29236 29236 350869.479261: 7 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > :29236 29236 350869.479263: 122 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > :29236 29236 350869.479264: 2303 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > :29236 29236 350869.479266: 49582 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > true 29236 350869.479283: 1041734 cycles: ffffffff81190a4a perf_output_begin ([kernel.kallsyms])
> >
> > after:
> >
> > [jolsa@krava perf]$ ./perf record -o - true | ./perf script
> > [ perf record: Woken up 1 times to write data ]
> > [ perf record: Captured and wrote 0.000 MB - ]
> > perf 28041 350801.438466: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > perf 28041 350801.438471: 1 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > perf 28041 350801.438472: 7 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > perf 28041 350801.438473: 140 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > perf 28041 350801.438475: 3721 cycles: ffffffff8105e8aa native_write_msr_safe ([kernel.kallsy
> > perf 28041 350801.438476: 94744 cycles: ffffffff8118e270 perf_event_comm ([kernel.kallsyms])
> > true 28041 350801.438508: 1604677 cycles: ffffffff811d0781 do_mmap_pgoff ([kernel.kallsyms])
> >
> > 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/
--
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/