add simple profiling script

This commit is contained in:
ducklet 2023-02-04 14:56:09 +01:00
parent 7a7d619e64
commit cb7c66a8d1

13
scripts/profile Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh -eu
cd "$RUN_DIR"
outfile="profile-$(date '+%Y%m%d-%H%M%S').txt"
[ -z "${DEBUG:-}" ] || set -x
echo "# Writing profiler stats to: $outfile"
python -m cProfile -o "$outfile" -m unwind "$@"
echo "# Loading stats file: $outfile"
python -m pstats "$outfile"