See also
Given a Python program main.py:
python -m cProfile -o main.py.profile main.py- If you need to pass args to
main.py, do so after its appearance in this command
- If you need to pass args to
gprof2dot -f pstats main.py.profile -o main.py.dotdot -Tpng main.py.dot
Open main.py.png and viola!