This is a version of Brian Lee’s post, a more condensed one, just for the sake of my own notes.

Installing flamegraph-generating profiler is easy if you have pip.

pip install git+https://github.com/evanhempel/python-flamegraph.git

Running it was even easier (my script was called black_box.py).

python -m flamegraph -o perf.log black_box.py

It took me a few minutes to figure out the script that generates an interactive svg file for the browser does not require an install. Simply download it to the folder where you’re going to run it. Once done, running it is as simple as

perl flamegraph.pl perf.log > perf.svg
Share →