Skip to content

Instantly share code, notes, and snippets.

@sdkks
Created Jun 2, 2018
Embed
What would you like to do?
Get URL Load Speed Using CURL
#!/usr/bin/env bash
case $1 in
http*)
URL="$1"
;;
*)
echo "Please provide URL as positional parameter. i.e.: ./script <url>"
exit 1
;;
esac
set -euo pipefail
TIMING='time_spent:\t%{time_total}\n'
for ((i=0;i<500;i++)); do
echo iteration $(($i+1))
curl \
-k \
-m 3 \
-s \
-o /dev/null \
-D - \
-w ${TIMING} \
${URL}
done 2>&1 | grep -iP 'time_spent:|age:|iteration'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment