Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to visualize Python profile data with SnakeViz

📅 2015-Feb-23 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cprofile, python, snakeviz, sunburst ⬩ 📚 Archive

Profile data visualized with SnakeViz
Profile data visualized with SnakeViz

SnakeViz is a beautiful visualization tool for the profile statistics generated by the Python cProfile module. The data is presented in the browser as a colorful sunburst and you explore the data from the inner core outwards. You can also choose how deep you want the sunburst. Below the visualization, SnakeViz also presents the typical function call table with various columns and this table can be sorted based on any of the columns.

Installing SnakeViz is easy:

$ sudo pip install snakeviz

To run it on a stats file:

$ snakeviz foo.pstats

The visualization is opened in your default browser with the URL http://127.0.0.1:8080

Tried with: SnakeViz 0.2.1, Python 2.7.6 and Ubuntu 14.04