Skip to content

Instantly share code, notes, and snippets.

@zoka123
Created January 30, 2020 15:28
Show Gist options
  • Save zoka123/0bd51fea29188c31d4771f3fabd0e160 to your computer and use it in GitHub Desktop.
Save zoka123/0bd51fea29188c31d4771f3fabd0e160 to your computer and use it in GitHub Desktop.
Measure HTTP request timings with curl

Measure HTTP request/response timings with Curl

1. Report template file

    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

save this content under e.g. curl-format.txt

2. Measure HTTP request/response timings

Run curl -w "@curl-format.txt" -o /dev/null -s https://google.com

Example result:

    time_namelookup:  0.004771
       time_connect:  0.022359
    time_appconnect:  0.065459
   time_pretransfer:  0.065580
      time_redirect:  0.000000
 time_starttransfer:  0.197701
                    ----------
         time_total:  0.216065
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment