Created
February 13, 2018 12:45
-
-
Save Lewiscowles1986/6a2aeca4fa67bbfa4776ae4ce4e491bb to your computer and use it in GitHub Desktop.
Benchmark URL endpoint CSV
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 | |
if [[ $# -lt 1 ]]; | |
then echo "You need to pass a url!" | |
echo "Usage:" | |
echo "$0 {url}" | |
exit | |
fi | |
URL=$1 | |
for i in {1..1000} | |
do | |
#curl -s -o /dev/null -w "%{time_total}\n" $URL | |
curl -s -o /dev/null -w "%{time_total}\n" -H "Pragma: no-cache" $URL | |
done | awk '{ sum += $1; n++; print ","$1; } END { if(n > 0) print "average,=sum(B1:B"n")/count(B1:B"n")"; print "median,=median(B1:B"n")"; print "mode,=mode(B1:B"n")"; print "max,=max(B1:B"n")"; print "min,=min(B1:B"n")"; }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment