Skip to content

Instantly share code, notes, and snippets.

@sdkks
Created June 2, 2018 17:31
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 sdkks/db8ecef073f39145d64422e0346d6715 to your computer and use it in GitHub Desktop.
Save sdkks/db8ecef073f39145d64422e0346d6715 to your computer and use it in GitHub Desktop.
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