Skip to content

Instantly share code, notes, and snippets.

@maxheadroom
Last active August 29, 2015 14:11
Show Gist options
  • Save maxheadroom/bc064e849e5451d7a141 to your computer and use it in GitHub Desktop.
Save maxheadroom/bc064e849e5451d7a141 to your computer and use it in GitHub Desktop.
How to gather network timing data with cUrl
Write the following lines into a text file and save as "ctemplate.txt"
\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer\}n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
\n
Use the template with cUrl to display timing data:
'curl -w "@ctemplate.txt" -o /dev/null -s http://wordpress.com/'
Output should look something like this:
time_namelookup: 0.001
time_connect: 0.037
time_appconnect: 0.000
time_pretransfer: 0.037
time_redirect: 0.000
time_starttransfer: 0.092
----------
time_total: 0.164
Alternatively you can place a file in your home directory with curl configuration: ~/.curlrc
write-out = "\n download_size: %{size_download}\n\n time_namelookup: %{time_namelookup}\n time_connect: %{time_connect}\n time_appconnect: %{time_appconnect}\n time_pretransfer: %{time_pretransfer}\n time_redirect: %{time_redirect}\n time_starttransfer: %{time_starttransfer}\n ----------\n time_total: %{time_total}\n"
dump-header = -
output /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment