Skip to content

Instantly share code, notes, and snippets.

@bartdag
Created November 18, 2013 10:14
Show Gist options
  • Save bartdag/7525572 to your computer and use it in GitHub Desktop.
Save bartdag/7525572 to your computer and use it in GitHub Desktop.
Basic python cprofile reader. Will print the 100 most time-consuming function calls (time and cumulative)
#!/usr/bin/python
import pstats
import sys
stats = pstats.Stats(sys.argv[1])
newstats = stats.sort_stats('time')
newstats.print_stats(100)
newstats = stats.sort_stats('cumulative')
newstats.print_stats(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment