Created
June 25, 2015 13:05
-
-
Save davidmontoyago/283810a11ab2857428a6 to your computer and use it in GitHub Desktop.
Average load time with curl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
total_load_time=0 | |
total_runs=10 | |
if [ -z "$1" ]; then | |
host="http://localhost:3000" | |
else | |
host=`echo $1` | |
fi | |
echo banging $host | |
for (( i=1; i<=$total_runs; i++ )) | |
do | |
load_time=`curl -s -w "%{time_total}\n" -o /dev/null $host` | |
#echo $load_time | |
total_load_time=`echo $total_load_time+$load_time | bc` | |
done | |
avg=`echo $total_load_time/$total_runs | bc -l` | |
echo $avg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment