I’ve previously talked about how to get timing details with cURL. On that post is a comment by Matthias L├╝dtke linking to a curlt script.

I liked that script so much that I’ve added it to my standard set of shell tools. My slightly modified version is at https://github.com/josephscott/shell/blob/master/bin/curlt.

For easy reference, here is how my curlt looks right now:

#!/bin/bash

curl_format='{
	"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}
}'

curl -w "$curl_format" -k --compressed -v -s -o /dev/null "$@"