Skip to content

Instantly share code, notes, and snippets.

@acdha
Created November 28, 2011 23:03
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
  • Save acdha/1402514 to your computer and use it in GitHub Desktop.
Save acdha/1402514 to your computer and use it in GitHub Desktop.
Use curl to measure and report HTTP response times (pre-, start- and total transfer)
#!/bin/bash
#
# Report time to first byte for the provided URL using a cache buster to ensure
# that we're measuring full cold-cache performance
while (($#)); do
echo $1
curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \
-w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \
"$1?`date +%s`"
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment