Skip to content

Snakeviz

Snakeviz#

Snakeviz is a browser absed visualizer of python cProfile output.

pip install snakeviz

Example usage:

python -m cProfile -o expiring_dict_test expiring_dict_test.py
snakeviz expiring_dict_test

It can be seen as more user friendly than the python stats module:

import cProfile
from pstats import Stats

profiler = cProfile.Profile()
profiler.runcall(test)
stats = Stats(profiler)
stats.strip_dirs()
stats.sort_stats('cumulative')
stats.print_stats()

Source#