commit 3160def02d3175158064c98c175a5af2ec1f14c7 Author: David Fifield david@bamsoftware.com Date: Mon Oct 31 01:41:33 2011 -0700
Add switching-all.sh.
This automatically runs all the switching experiments multiple times. --- experiments/common.sh | 11 ++++++++++ experiments/switching/switching-all.sh | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/experiments/common.sh b/experiments/common.sh index f788235..dcafd84 100644 --- a/experiments/common.sh +++ b/experiments/common.sh @@ -45,3 +45,14 @@ real_time() { # original stderr (fd 2) output of time. (time -p eval "$@" 2>&3) |& tail -n 3 | head -n 1 | awk '{print $2}' } + +# Repeat a subcommand N times. +repeat() { + local N + N="$1" + shift + while [ $N -gt 0 ]; do + eval "$@" + N=$((N-1)) + done +} diff --git a/experiments/switching/switching-all.sh b/experiments/switching/switching-all.sh new file mode 100755 index 0000000..b3051cc --- /dev/null +++ b/experiments/switching/switching-all.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Usage: ./switching-all.sh [-n NUM_ITERATIONS] +# +# Runs the switching experiment scripts several times and stores the results in +# log files +# local-http-constant-DATE.log +# local-http-alternating-DATE.log +# remote-tor-constant-DATE.log +# remote-tor-alternating-DATE.log +# where DATE is the current date. + +. ../common.sh + +NUM_ITERATIONS=1 + +while getopts "n:" OPTNAME; do + if [ "$OPTNAME" == n ]; then + NUM_ITERATIONS="$OPTARG" + fi +done + +DATE="$(date --iso)" + +> "local-http-constant-$DATE.log" +repeat $NUM_ITERATIONS ./local-http-constant.sh "local-http-constant-$DATE.log" + +> "local-http-alternating-$DATE.log" +repeat $NUM_ITERATIONS ./local-http-alternating.sh "local-http-alternating-$DATE.log" + +> "remote-tor-constant-$DATE.log" +repeat $NUM_ITERATIONS ./remote-tor-constant.sh "remote-tor-constant-$DATE.log" + +> "remote-tor-alternating-$DATE.log" +repeat $NUM_ITERATIONS ./remote-tor-alternating.sh "remote-tor-alternating-$DATE.log"
tor-commits@lists.torproject.org