update version. tweak the test (install cython 3.0 for non-x64)
[MACS.git] / test / pyprofile
blobf7bbd3847b6f0e928c53965fed77b8c4b6601dbb
1 #!/usr/bin/env bash
3 ## pyprofile: profile Python script
5 ## $Revision$
6 ## Copyright 2011 Michael M. Hoffman <mmh1@uw.edu>
7 ## Modified by Tao Liu: Correctly get the command name.
9 set -o nounset
10 set -o pipefail
11 set -o errexit
13 if [ $# -lt 2 ]; then
14 echo usage: "$0" PROF CMDLINE...
15 exit 2
18 PROF=$1
19 MAIN=`basename $2`
20 CMD=( $@ )
21 CMD=${CMD[@]: 1}
23 # run CMD with cProfile
24 python -m cProfile -o $PROF $CMD
26 # brief the profile
27 ./pyprofile_stat $PROF tottime > ${PROF/.prof/}.tottime
28 ./pyprofile_stat $PROF calls > ${PROF/.prof/}.calls
29 ./pyprofile_stat $PROF cumulative > ${PROF/.prof/}.cumulative
31 echo "check ${PROF/.prof/}.tottime, ${PROF/.prof/}.calls, and ${PROF/.prof/}.cumulative"