Calculate estimated observation duration based on speedtest results for accurate channel hopping intervals
This commit is contained in:
parent
4f627a819d
commit
ce7284580e
1 changed files with 29 additions and 7 deletions
36
runtest.sh
36
runtest.sh
|
@ -165,12 +165,12 @@ if [ ! -f "$TEST_FILE" ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ESTIMATED_OBS_DURATION=60
|
||||||
|
|
||||||
for ((COUNTER = 1; COUNTER <= NUM_TESTS; COUNTER++)); do
|
for ((COUNTER = 1; COUNTER <= NUM_TESTS; COUNTER++)); do
|
||||||
|
|
||||||
log "Test run $COUNTER of $NUM_TESTS"
|
log "Test run $COUNTER of $NUM_TESTS"
|
||||||
for ((i = 1; i <= NUM_SAMPLES; i++)); do
|
for ((i = 1; i <= NUM_SAMPLES; i++)); do
|
||||||
OBS_START=$(date +%s)
|
|
||||||
|
|
||||||
if [ "$LISTENER_ENABLED" -eq 1 ]; then
|
if [ "$LISTENER_ENABLED" -eq 1 ]; then
|
||||||
LISTENER_SAMPLE_FILE="${TEST_FILE%.csv}-listener-$COUNTER-$i.csv"
|
LISTENER_SAMPLE_FILE="${TEST_FILE%.csv}-listener-$COUNTER-$i.csv"
|
||||||
|
|
||||||
|
@ -181,8 +181,6 @@ for ((COUNTER = 1; COUNTER <= NUM_TESTS; COUNTER++)); do
|
||||||
ADAPTIVE_ARGS=("${LISTENER_ARGS[@]}")
|
ADAPTIVE_ARGS=("${LISTENER_ARGS[@]}")
|
||||||
if [[ " ${LISTENER_ARGS[*]} " =~ "--channel-hop" ]]; then
|
if [[ " ${LISTENER_ARGS[*]} " =~ "--channel-hop" ]]; then
|
||||||
NUM_CHANNELS=15 # Update if your list changes
|
NUM_CHANNELS=15 # Update if your list changes
|
||||||
OBS_NOW=$(date +%s)
|
|
||||||
ESTIMATED_OBS_DURATION=$((OBS_NOW - OBS_START))
|
|
||||||
HOP_INTERVAL=$((ESTIMATED_OBS_DURATION / (NUM_CHANNELS + 1)))
|
HOP_INTERVAL=$((ESTIMATED_OBS_DURATION / (NUM_CHANNELS + 1)))
|
||||||
[[ "$HOP_INTERVAL" -lt 2 ]] && HOP_INTERVAL=2 # Don't go too fast
|
[[ "$HOP_INTERVAL" -lt 2 ]] && HOP_INTERVAL=2 # Don't go too fast
|
||||||
log "Estimated observation time: ${ESTIMATED_OBS_DURATION}s → Setting hop interval: ${HOP_INTERVAL}s"
|
log "Estimated observation time: ${ESTIMATED_OBS_DURATION}s → Setting hop interval: ${HOP_INTERVAL}s"
|
||||||
|
@ -252,9 +250,29 @@ for ((COUNTER = 1; COUNTER <= NUM_TESTS; COUNTER++)); do
|
||||||
if [ "$NO_IPERF" -eq 0 ]; then
|
if [ "$NO_IPERF" -eq 0 ]; then
|
||||||
log " Running iperf3 tests..."
|
log " Running iperf3 tests..."
|
||||||
SECONDS=0
|
SECONDS=0
|
||||||
LocalTCPUp=$(run_iperf "$IPERF_LOCAL_TARGET" tcp up)
|
LocalTCPDown=$(run_iperf "$IPERF_LOCAL_TARGET" tcp down)
|
||||||
localtcpup_duration=$SECONDS
|
localtcpdown_duration=$SECONDS
|
||||||
...
|
|
||||||
|
SECONDS=0
|
||||||
|
LocalUDPUp=$(run_iperf "$IPERF_LOCAL_TARGET" udp up)
|
||||||
|
localudpup_duration=$SECONDS
|
||||||
|
|
||||||
|
SECONDS=0
|
||||||
|
LocalUDPDown=$(run_iperf "$IPERF_LOCAL_TARGET" udp down)
|
||||||
|
localudpdown_duration=$SECONDS
|
||||||
|
|
||||||
|
SECONDS=0
|
||||||
|
RemoteTCPUp=$(run_iperf "$IPERF_REMOTE_TARGET" tcp up)
|
||||||
|
remotetcpup_duration=$SECONDS
|
||||||
|
|
||||||
|
SECONDS=0
|
||||||
|
RemoteTCPDown=$(run_iperf "$IPERF_REMOTE_TARGET" tcp down)
|
||||||
|
remotetcpdown_duration=$SECONDS
|
||||||
|
|
||||||
|
SECONDS=0
|
||||||
|
RemoteUDPUp=$(run_iperf "$IPERF_REMOTE_TARGET" udp up)
|
||||||
|
remoteudpup_duration=$SECONDS
|
||||||
|
|
||||||
SECONDS=0
|
SECONDS=0
|
||||||
RemoteUDPDown=$(run_iperf "$IPERF_REMOTE_TARGET" udp down)
|
RemoteUDPDown=$(run_iperf "$IPERF_REMOTE_TARGET" udp down)
|
||||||
remoteudpdown_duration=$SECONDS
|
remoteudpdown_duration=$SECONDS
|
||||||
|
@ -288,6 +306,10 @@ for ((COUNTER = 1; COUNTER <= NUM_TESTS; COUNTER++)); do
|
||||||
|
|
||||||
END_TIME=$(date -Iseconds)
|
END_TIME=$(date -Iseconds)
|
||||||
|
|
||||||
|
TOTAL_DURATION=$((speedtest_duration + localtcpup_duration + localtcpdown_duration + localudpup_duration + localudpdown_duration + remotetcpup_duration + remotetcpdown_duration + remoteudpup_duration + remoteudpdown_duration))
|
||||||
|
[[ "$TOTAL_DURATION" -lt 10 ]] && TOTAL_DURATION=60 # fallback sanity value
|
||||||
|
ESTIMATED_OBS_DURATION=$TOTAL_DURATION
|
||||||
|
|
||||||
if [ "$LISTENER_ENABLED" -eq 1 ] && [ -n "${LISTENER_SAMPLE_FILE:-}" ]; then
|
if [ "$LISTENER_ENABLED" -eq 1 ] && [ -n "${LISTENER_SAMPLE_FILE:-}" ]; then
|
||||||
if [ -f "$LISTENER_SAMPLE_FILE" ]; then
|
if [ -f "$LISTENER_SAMPLE_FILE" ]; then
|
||||||
LISTENER_ROW=$(tail -n 1 "$LISTENER_SAMPLE_FILE")
|
LISTENER_ROW=$(tail -n 1 "$LISTENER_SAMPLE_FILE")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue