Skip to content

Importing from py spy (python)

Jamie Wong edited this page May 8, 2020 · 2 revisions

py-spy is a profiler that lets you profile Python processes that are already running.

py-spy has an explicit output format for speedscope (See https://github.com/benfred/py-spy/issues/115).

To record a profile on an already-running process with py-spy, run:

sudo py-spy record --pid $PID --format speedscope -o profile.speedscope.json

Then drop the resulting profile.speedscope.json into https://www.speedscope.app/

To view it offline, you'll need to install speedscope via npm:

npm install -g speedscope