#!/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"