π 2013-May-12 ⬩ βοΈ Ashwin Nanjappa ⬩ π·οΈ profiler, python, runsnakerun ⬩ π Archive
It is really easy to profile a Python program. But, it is not straightforward to determine the different bottlenecks in the program by looking at the profiler output. A visualization of the profiler output makes it really convenient to examine the different sources of bottleneck in the program. Β One way to visualize the profiler output is to use RunSnakeRun.
RunSnakeRun ships as a Python module. But, before installing it, install the packages it is dependent on: python-profiler, python-wxgtk2.8 and python-setuptools.
Install RunSnakeRun from PyPI using easy_install:
$ sudo easy_install SquareMap RunSnakeRun
Profile your Python program and dump the statistics to a file, say foostats.
Open the profiler statistics file with RunSnakeRun:
$ runsnake foostats
RunSnakeRun shows a tabular view of the profiler statistics, similar to the output of cProfile. It also shows a squaremap visualization of the call tree. This makes it really convenient to drill down to the various bottlenecks in the program.
Tried with: RunSnakeRun 2.0.2b1, Python 2.7.3 and Ubuntu 12.04 LTS