Skip to content

Using curl to output detail time consuming of http

homepage-banner

1. prepare template file

e.g. curl.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

2. curl with the following command

curl -w "@curl.txt" -o /dev/null -s https://www.google.com
            time_namelookup:  0.004
               time_connect:  0.014
            time_appconnect:  0.141
           time_pretransfer:  0.141
              time_redirect:  0.000
         time_starttransfer:  0.153
                            ----------
                 time_total:  0.165

Reference

  • https://curl.se/
  • https://github.com/curl/curl
Leave a message