Reference: Youtube link
Requirements:
cProfile: python -m cProfile -o log.pstats main.py
yelp-gprof2dot: pip install yelp-gprof2dot
dot: brew install graphviz
Usage:
python -m cProfile -o log.pstats main.py
gprof2dot log.pstats | dot -Tsvg -o log.svg
firefox log.svg &
Bash
Read the output looking for your main function, it should look like main:181:main and letβs regenerate the svg using that as our main as the root of the graph.
gprof2dot log.pstats -z main:181:main | dot -Tsvg -o log.svg
firefox log.svg &
Bash