๐Ÿ•ต๏ธโ€โ™‚๏ธ Py-Spy

Py-Spy is a sampling profiler for Python programs that can profile running Python processes without modifying them or needing any program restarts.

Usage Example

Install it with: pip install py-spy

Run it in your terminal like this:

py-spy top --pid <pid of your python program>

Or, you can generate a flame graph like this:

py-spy record --pid <pid of your python program> --output profile.svg

Get PDF