Skip to content

Instantly share code, notes, and snippets.

@kamermans
Created October 21, 2017 15:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kamermans/b2d68b74686000cf3df255bef0e3ecd8 to your computer and use it in GitHub Desktop.
Save kamermans/b2d68b74686000cf3df255bef0e3ecd8 to your computer and use it in GitHub Desktop.
Curl helper that adds detailed timing information
#!/bin/bash -e
# Put this file in /usr/local/bin and use 'curl-timing' in place of 'curl'
# to get a detailed timing report with the response.
# You can customize the report below. For older versions of curl, some
# of the fields below will not be available.
TIMING_FORMAT=$(cat <<EOL
url_effective: %{url_effective}
remote_ip: %{remote_ip}
response: HTTP/%{http_version} %{http_code}
time_namelookup: %{time_namelookup}
time_connect: %{time_connect}
time_appconnect: %{time_appconnect}
time_pretransfer: %{time_pretransfer}
time_redirect: %{time_redirect}
time_starttransfer: %{time_starttransfer}
----------
time_total: %{time_total}
speed_download: %{speed_download} Bps
\n
EOL
)
curl -w "$TIMING_FORMAT" $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment