From: Milian Wolff <milian.wolff@kdab.com>
To: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: "linux-perf-use." <linux-perf-users@vger.kernel.org>
Subject: Re: perf report feature request: folded stack output
Date: Sat, 10 Oct 2015 01:33:55 +0200 [thread overview]
Message-ID: <2844120.msKGatE6uD@agathebauer> (raw)
In-Reply-To: <CAE40pddHkm_SB4mpOBeSfTe8BcfU1js5fiEK96xA95gbjPa1bg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]
On Freitag, 9. Oktober 2015 14:24:17 CEST Brendan Gregg wrote:
> G'Day,
>
> Maybe someone would like to code this (if not I hope to find the
> time); perf report already has the capability to print captured stacks
> as a call tree. I'd like a new output mode: folded.
>
> Flame graphs[1] consume folded stacks. Eg:
>
> # git clone https://github.com/brendangregg/FlameGraph
> # cd FlameGraph
> # perf record -F 99 -a -g -- sleep 60
> # perf script | ./stackcollapse-perf.pl | ./flamegraph.pl
> out.perf-folded > flame.svg
>
> The last line is inefficient, and should really be something like:
>
> # perf report --folded | ./flamegraph.pl out.perf-folded > flame.svg
>
> The folded format is function names separated by semicolons, a space,
> then the count of occurrences. Eg:
<snip>
Hey Brendan,
did you consider writing a python script to do the folding? It's pretty simple
nowadays, once you cross the initial bar.
I wrote this for stack collapsing futex locks:
https://paste.kde.org/p61qxah7d
And this to convert samples to callgrind format to open it in KCacheGrind:
https://paste.kde.org/pjfwd1e8f
If you combine the stack collapsing in the former with the generic
process_event hook used in the latter, you should be all set. In my tests, it
was pretty quick to convert stuff, certainly better than creating strings,
pushing them to the console, and then parsing that again in perl.
perf script fold | flamegraph.pl > flame.svg
gets pretty close. If you want to test locally, make sure you use `perf script
-s fold.py` or similar.
Cheers, and HTH
--
Milian Wolff | milian.wolff@kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5903 bytes --]
next prev parent reply other threads:[~2015-10-09 23:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 21:24 perf report feature request: folded stack output Brendan Gregg
2015-10-09 22:13 ` Brendan Gregg
2015-10-09 23:33 ` Milian Wolff [this message]
2015-10-21 0:51 ` Brendan Gregg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2844120.msKGatE6uD@agathebauer \
--to=milian.wolff@kdab.com \
--cc=brendan.d.gregg@gmail.com \
--cc=linux-perf-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).