Created
September 12, 2016 19:29
-
-
Save tdlm/79fe55c147e644a9f9f9248cbc6e9648 to your computer and use it in GitHub Desktop.
Command to take average time-to-first-byte for a given URL
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
#!/usr/local/bin/bash | |
total=0.000 | |
ttfbs=() | |
for i in `seq 1 5` | |
do | |
ttfb=$(curl -s -o /dev/null -w "%{time_starttransfer}" "$1") | |
total=$(scale=3;echo "$total+$ttfb" | bc) | |
done | |
average=$(scale=3;printf %.2f $(echo "$total/5" | bc -l)) | |
echo "Average TTFB for 5 attempts is: $average" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment