profile.sh 553B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. OUTPUT=${1:?"output file required"}
  3. SELF_DIR=$(cd $(dirname $0) && pwd) || exit 1
  4. YDIFF_PY=$SELF_DIR/../ydiff.py
  5. # To test with py3k: PYTHON=python3 make test
  6. PYTHON=${PYTHON:-python}
  7. set -o errexit
  8. STATS="stats.$$.tmp"
  9. for i in {1..100}; do cat "tests/svn/in.diff"; done \
  10. | $PYTHON -m cProfile -o $STATS $YDIFF_PY -c always -s -w 60 \
  11. > /dev/null
  12. $PYTHON -c "import pstats; p = pstats.Stats('$STATS'); \
  13. p.strip_dirs().sort_stats('time').print_stats('ydiff')" \
  14. | tee $OUTPUT
  15. rm -f $STATS
  16. # vim:set et sts=4 sw=4: