#!/bin/bash function usage { echo "Please enter right parameters: current_rps(*5) add_step(*5) duratime" exit 1 } if [ $# -ne 3 ]; then usage fi echo "current_rps(*5) add_step(*5) duratime" #path="/home/njl/sledge/runtime/tests" path="/home/hai/sledge/sledge/runtime/tests" current_rps=$1 step=$2 duratime=$3 max_rps=0 max_latency=0 output="hey_test_max_rps.log" server_log_file="test_rps.log" loop=1 for loop in {1..5}; do $path/start-edf.sh $server_log_file >/dev/null 2>&1 & echo "sledge is running loop $loop" ./test_rps.sh $output $duratime $current_rps 5k.jpg 10000 2>&1 & pid1=$! wait $pid1 $path/kill_sledge.sh latency=$(grep "Requests" $output | awk -F ': ' '{print $2}') if (( $(echo "$latency < $max_rps" | bc -l) )); then break fi echo "loop_$loop RPS: $latency" max_rps=$latency current_rps=$((current_rps + step)) done echo "Maximum RPS: $max_rps"