I just stumbled on this as well, and spent some time learning how to generate a call graph (the normal results of cProfile is not terribly informative). Future reference, here’s another way to generate a beautiful call-tree graphic with cProfile + gprof2dot + graphViz.
———————
- Install GraphViz: http://www.graphviz.org/Download_macos.php
easy_install gprof2dot
-
Run profile on the code.
python -m cProfile -o myLog.profile <myScript.py> arg1 arg2 ...
-
Run gprof2dot to convert the call profile into a dot file
gprof2dot -f pstats myLog.profile -o callingGraph.dot
-
Open with graphViz to visualize the graph
Here’s what the end result would look like!
Graph is color-coded- red means higher concentration of time.