圖形化執行時間 - jenhaoyang/backend_blog GitHub Wiki

gprof2dot

apt-get install python3 graphviz
pip install gprof2dot

python -m cProfile -o output.pstats path/to/your/script arg1 arg2
gprof2dot.py -f pstats output.pstats | dot -Tpng -o output.png

參考:
https://github.com/jrfonseca/gprof2dot
https://stackoverflow.com/questions/843671/profiling-in-python-who-called-the-function