benfred / py-spy

Sampling profiler for Python programs
MIT License
12.47k stars 411 forks source link

Generate flamegraph from raw output without flamegraph.pl #219

Open amigrave opened 4 years ago

amigrave commented 4 years ago

I have a special case for which I need to display the flamegraph to users of a record session where I use --subprocess but I need to hide the information related to the main process. The easiest way to do it would be to remove the concerned lines from the raw output then generate the svg with flamegraph.pl, that said it's unfortunate to have this flamegraph.pl perl depencency now that py-spy got rid of it ( #38). Is there a way to use the internal py-spy flamegraph generator in order to process a raw output it produced ?

3tilley commented 4 years ago

I would be really interested in this as well. It's not necessarily the job of py-spy to be a Perl-free flamegraph generator, but it would be cool to expose Inferno for use with Python. The options I can think of would be to introduce py-spy plot stacks.folded or to wrap Inferno into a Python package that py-spy depends on. The latter seems like a lot of overhead, maybe inferno could just be exposed as another script from py-spy pyferno plot stacks.folded?