Skip to content

Instantly share code, notes, and snippets.

Created June 2, 2011 22:45
Show Gist options
  • Save anonymous/1005510 to your computer and use it in GitHub Desktop.
Save anonymous/1005510 to your computer and use it in GitHub Desktop.
pyrprofile: profile Python script
#!/usr/bin/env bash
## pyprofile: profile Python script
## $Revision$
## Copyright 2011 Michael M. Hoffman <mmh1@uw.edu>
set -o nounset
set -o pipefail
set -o errexit
if [ $# == 0 ]; then
echo usage: "$0" CMDLINE...
exit 2
fi
PROF="$1.$(date +%Y%m%dT%H%M%S).prof"
python -m cProfile -o "$PROF" "$@"
python -m pstats "$PROF"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment