Re: ping Re: [PATCH] perf script: Add stackcollapse.py script

From: Paolo Bonzini
Date: Fri Apr 15 2016 - 07:10:42 EST




On 15/04/2016 12:57, Jiri Olsa wrote:
>>> > > +# Input may be created and processed using:
>>> > > +#
>>> > > +# perf record -a -g -F 99 sleep 60
>>> > > +# perf script report stackcollapse > out.stacks-folded
>>> > > +#
>>> > > +# (perf script record stackcollapse works too).
> IIRC Namhyung added -g folded option recently for report
> so you could do:
>
> perf report -g folded --stdio
>
> however we dont seem to have it for perf script, so this might
> be useful until we add the --call-graph support into perf script

Thanks for the pointer. I think the output of "perf script -g folded"
would still be a bit different from what the flamegraph tool expects.
Something like

perf 13675 51165.817380: 1921 cycles:pp: native_write_cr2; do_nmi; end_repeat_nmi; ...

rather than this

perf;native_write_cr2;do_nmi;end_repeat_nmi;... 1921

which this script produces. The format that flamegraph expects is very
simple so that they can have converters for perf, stap, dtrace and others.

I'd be just as happy if perf looked for scripts into $HOME/.local. :) But
since it doesn't, this script can also be useful to demonstrate script access
to callchains.

Thanks,

Paolo