How to use RunSnakeRun to visualize Python profiler statistics

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.

  1. 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.

  2. Install RunSnakeRun from PyPI using easy_install:

$ sudo easy_install SquareMap RunSnakeRun
  1. Profile your Python program and dump the statistics to a file, say foostats.

  2. 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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s