benfred / py-spy

Sampling profiler for Python programs
MIT License
12.53k stars 414 forks source link

Combine multiple runs into one file #476

Closed tsafs closed 1 year ago

tsafs commented 2 years ago

Say I have multiple docker containers which run the same software in parallel. On each container I start an instance of py-spy monitoring that software. Is there a way to combine the results into one file, such that in speedscope the left heavy view would group the same call stacks of the various processes together?

Jongy commented 2 years ago

You can use --format raw to get raw stackcollapsed format. Merging them done by simply concatenating the files. Then, you can convert the result back to speedscope.

olejorgenb commented 1 year ago

~How do you convert the raw format back to speedscope format?~ Nvm. speedscope can open the raw format (and can also export it to speedscope json format)