added batch_run script (prev manually in shell)

This commit is contained in:
Niklas Halle 2025-06-28 10:48:48 +02:00
parent 95177d5524
commit 7397b124b6

65
batch_run.sh Executable file
View file

@ -0,0 +1,65 @@
#!/usr/bin/env bash
set -euo pipefail
RUN_TIME=${RUN_TIME:-20} # seconds
ITERATIONS=${ITERATIONS:-49}
BUILD_SCRIPT=${BUILD_SCRIPT:-"./build_run_copy.sh"}
TIMER_MODES=${TIMER_MODES:-"direct timed"}
THREADING_MODES=${THREADING_MODES:-"single multi"}
BOOSTS=${BOOSTS:-"1000 500 100 50 10"} # 1000 equals disabled, 500, 100, 50, 10
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a batch_run.log
}
cleanup() {
log "Script interrupted or completed. Cleaning up..."
# Add any cleanup tasks here
}
trap cleanup EXIT INT TERM
# Check if build_run_copy.sh exists and is executable
if [[ ! -x "./build_run_copy.sh" ]]; then
log "ERROR: build_run_copy.sh not found or not executable"
exit 1
fi
declare -g total_runs=$((2 * 2 * 50 + 5 * 2 * 2 * 50)) # 200 + 1000 = 1200
declare -g current_run=0
run_with_progress() {
current_run=$((current_run + 1))
log "Progress: $current_run/$total_runs - Running: $*"
if ! ./build_run_copy.sh "$@"; then
log "ERROR: Failed at run $current_run with args: $*"
exit 1
fi
}
run_test_suite() {
local scheduler=$1
local boost=$2
local time_mode=$3
local thread_mode=$4
# First run with rebuild
run_with_progress "$scheduler" "$thread_mode" "$time_mode" "$boost" "$RUN_TIME" false
# Subsequent runs without rebuild
for run in $(seq 1 $ITERATIONS); do
run_with_progress "$scheduler" "$thread_mode" "$time_mode" "$boost" "$RUN_TIME" true
done
}
# Main execution starts here
for time_mode in $TIMER_MODES; do
for thread_mode in $THREADING_MODES; do
run_test_suite "ros" "1000" "$time_mode" "$thread_mode"
done
for boost in $BOOSTS; do
for thread_mode in $THREADING_MODES; do
run_test_suite "edf" "$boost" "$time_mode" "$thread_mode"
done
done
done