From cb7c66a8d195525e16a4cefcafd770d460afaa7e Mon Sep 17 00:00:00 2001 From: ducklet Date: Sat, 4 Feb 2023 14:56:09 +0100 Subject: [PATCH] add simple profiling script --- scripts/profile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 scripts/profile diff --git a/scripts/profile b/scripts/profile new file mode 100755 index 0000000..ccbfc70 --- /dev/null +++ b/scripts/profile @@ -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"