Runsnakerun[1] is another simple interactive GUI tool for visualizing .pstat files that I've used quite a bit in the past
If you're interested in reading the data with KCacheGrind, you can do that using pyprof2calltree: https://github.com/pwaller/pyprof2calltree
The result ends up looking like this: https://f.cloud.github.com/assets/150329/1570121/5713f02c-50...
A couple years ago at a company hackathon, I took this approach, and then just baked these same tools into the app directly.
Django middleware to turn on/off and collect & store the profile data, and then a developer interface to read the stored profiles and render in SVG using pydot.
Once you have a pstats file, you can do some interesting things with it. You can load it into an interactive pstats session with this:
This will allow you to sort and display the profile data in a number of ways.You can also use the third-party gprof2dot script[1] to turn the pstats file into a GraphViz dot file, and thence into a visualization of your code's performance. For example:
That will turn your foo.pstats file into a PDF. I like the PDF format here because it is vectorized, renders quickly (more quickly than SVG, at least), and you can search for specific text in it (which is useful if you have a large profile and want to find a specific function).[1] https://code.google.com/p/jrfonseca/wiki/Gprof2Dot