Visualizing the output of python’s cprofile

less than 1 minute read

To better visualize the call tree after profiling a python script, first save your output from cProfile using python -m cProfile -o <myscript.profile> <myscript.py>. You will need to install pyprof2calltree via pip and kcachegrind via apt. Then, visualize the profile data with pyprof2calltree -i <myscript.profile> -k. Reference: this SO answer.

Leave a Comment