-
-
Save taoliu/1034674 to your computer and use it in GitHub Desktop.
pyrprofile: profile Python script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## pyprofile: profile Python script | |
## $Revision$ | |
## Copyright 2011 Michael M. Hoffman <[email protected]> | |
## Modified by Tao Liu: Correctly get the command name. | |
set -o nounset | |
set -o pipefail | |
set -o errexit | |
if [ $# == 0 ]; then | |
echo usage: "$0" CMDLINE... | |
exit 2 | |
fi | |
MAIN=`basename $1` | |
PROF="${MAIN}.$(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