def main(): cProfile.run('very_slow()', 'prof.txt') import pstats p = pstats.Stats('prof.txt') p.sort_stats('time').print_stats()