-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.sh
53 lines (38 loc) · 862 Bytes
/
profile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Advent of Code 2024
# Dr Lee A. Christie
#
# GitHub: @leechristie
# Mastodon: @0x1ac@techhub.social
# Website: leechristie.com
clear
EXECUTABLE="../aoc24c/cmake-build-release/aoc24c"
OUTPUT="../profile.txt"
CONDA_ENV="python313"
if [ -f "$OUTPUT" ]; then
rm "$OUTPUT"
fi
echo -n "Day to profile : "
read -r day
echo -n "Number of runs : "
read -r runs
for ((i=1; i<=runs; i++)); do
echo
echo >> "$OUTPUT"
echo "Run $i of $runs"
echo "Run $i of $runs" >> "$OUTPUT"
stdout_stderr=$("$EXECUTABLE" $day 2>&1)
return_code=$?
echo "$stdout_stderr"
echo "$stdout_stderr" >> "$OUTPUT"
if [ $return_code -ne 0 ]; then
rm "$OUTPUT"
echo
exit 1
fi
done
eval "$(conda shell.bash hook)"
conda activate "$CONDA_ENV"
which python
python --version
python ../profile.py "$OUTPUT"
rm $OUTPUT