Add a script to time all days.

This commit is contained in:
2018-01-27 22:25:25 +01:00
parent fc2c0e245d
commit 7e9dff9be6

29
2017/time-all.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
run () {
pushd "$1" &> /dev/null || exit 1
local epilogue=""
if [[ -f input.txt ]]; then
epilogue=" < input.txt"
fi
local prog="make"
if [[ ! -f Makefile ]]; then
prog=$(find . -type f -executable)
if [[ -z "$prog" ]] || [[ "$(wc -l <<< "$prog")" -gt 1 ]]; then
echo "No executable"
exit 1
fi
fi
local cmd="time $prog $epilogue"
eval "$cmd"
popd &> /dev/null || exit 1
}
for day in day-*; do
echo "$day" "$(run "$day" |& grep -i "real" | awk '{print $2}')"
done