From 6b9a59eabf13c81f09a10f9b2ebf9c14f8900ae1 Mon Sep 17 00:00:00 2001 From: shilangyu Date: Mon, 4 Dec 2023 16:34:26 +0100 Subject: [PATCH] Update benchmark script --- benchmark.sh | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/benchmark.sh b/benchmark.sh index e740dcc..d3968a6 100755 --- a/benchmark.sh +++ b/benchmark.sh @@ -4,13 +4,16 @@ set -e BUILD_TYPE=Release ./build.sh &> /dev/null -MESSAGES=20 -PROCESSES=128 +AGREEMENT_COUNT=10 +PROPOSE_AMOUNT=3 +MAX_UNIQUE_PROPOSED=5 +MAX_PROPOSED_VALUE=2147483648 +PROCESSES=10 RUN_FOLDER=$(mktemp -d) HOSTS_FILE=$RUN_FOLDER/hosts OUTPUTS=$RUN_FOLDER/outputs -CONFIG_FILE=$RUN_FOLDER/fifo-broadcast.config -SLEEP_TIME_S=10 +CONFIG_FILE=$RUN_FOLDER/lattice-agreement.config +SLEEP_TIME_S=30 mkdir $OUTPUTS @@ -24,15 +27,36 @@ do echo $i" localhost "$((11000 + $i)) >> $HOSTS_FILE done -# create config file -echo $MESSAGES > $CONFIG_FILE +# pick random values +NUMS=() +for i in $(seq 1 $MAX_UNIQUE_PROPOSED) +do + num=$(shuf -i 1-$MAX_PROPOSED_VALUE -n 1) + NUMS+=($num) +done +# create config files +for i in $(seq 1 $PROCESSES) +do + echo $AGREEMENT_COUNT" "$PROPOSE_AMOUNT" "$MAX_UNIQUE_PROPOSED > $CONFIG_FILE.$i + + for j in $(seq 1 $AGREEMENT_COUNT) + do + NUM=() + for k in $(shuf -i 0-$(($MAX_UNIQUE_PROPOSED-1)) -n $(shuf -i 1-$PROPOSE_AMOUNT -n 1)) + do + NUM+=(${NUMS[$k]}) + done + + echo ${NUM[@]} >> $CONFIG_FILE.$i + done +done # start all processes PIDS=() for i in $(seq 1 $PROCESSES) do - ./bin/da_proc --id $i --hosts $HOSTS_FILE --output $OUTPUTS/$i.out $CONFIG_FILE 1> $OUTPUTS/$i.stdout 2> $OUTPUTS/$i.stderr & + ./bin/da_proc --id $i --hosts $HOSTS_FILE --output $OUTPUTS/$i.out $CONFIG_FILE.$i 1> $OUTPUTS/$i.stdout 2> $OUTPUTS/$i.stderr & PIDS+=($!) done @@ -48,8 +72,8 @@ do wait $pid || echo "Process "$(($key + 1))" exited with "$? done -delivered=$(cat $OUTPUTS/*.out | grep '^d' | wc -l | xargs) -total=$(($PROCESSES * $PROCESSES * $MESSAGES)) +delivered=$(cat $OUTPUTS/*.out | wc -l | xargs) +total=$(($PROCESSES * $AGREEMENT_COUNT)) frac=$(echo "$delivered/$total * 100" | bc -l) echo "Delivered "$frac"%"