Skip to content

Instantly share code, notes, and snippets.

@kevindees
Created July 29, 2017 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevindees/a24dd20d81e974e2a72cbf03c2550c80 to your computer and use it in GitHub Desktop.
Save kevindees/a24dd20d81e974e2a72cbf03c2550c80 to your computer and use it in GitHub Desktop.
Measuring the average website response time with cURL http://cacodaemon.de/index.php?id=11
#!/bin/bash
URL="$1"
MAX_RUNS="$2"
SUM_TIME="0"
i="0"
while [ $i -lt $MAX_RUNS ]; do
TIME=`curl $URL -o /dev/null -s -w %{time_total}`
TIME="${TIME/,/.}"
SUM_TIME=`echo "scale=5; $TIME + $SUM_TIME" | bc`
i=$[$i+1]
done
TIME_AVERAGE=`echo "scale=5; $SUM_TIME / $MAX_RUNS" | bc`
echo "Sum: $SUM_TIME"
echo "Avg: $TIME_AVERAGE"
@kevindees
Copy link
Author

./web_test.sh http://localhost 300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment