Skip to content

Instantly share code, notes, and snippets.

@larytet
Created October 9, 2017 08:29
Show Gist options
  • Save larytet/861325b0f6d0ae0602594decdbaa8de3 to your computer and use it in GitHub Desktop.
Save larytet/861325b0f6d0ae0602594decdbaa8de3 to your computer and use it in GitHub Desktop.
Python profiling
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Do something like python -m cProfile -o stats my_script.py
# ./dump_stats.py
if __name__ == "__main__":
import sys
import pstats
stats = pstats.Stats("stats")
stats.strip_dirs()
stats.sort_stats('cumulative')
stats.print_stats()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment