curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Measure http request and response time using curl command

From: Kaushal Shriyan via curl-users <curl-users_at_lists.haxx.se>
Date: Tue, 2 Nov 2021 13:17:23 +0530

On Fri, Oct 29, 2021 at 1:06 AM Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Fri, 29 Oct 2021, Kaushal Shriyan via curl-users wrote:
>
> > Is there a way to measure http request and response time including
> network
> > latency using any utility of a specific website? For example
> > https://about.gitlab.com
>
> Maybe one or more of the --write-out variables?
> https://everything.curl.dev/usingcurl/verbose/writeout


Thanks a lot Daniel for the details and appreciate it. I have used the
below template to find out the response time.

$cat curl-format.txt
{\n
"time_redirect": %{time_redirect},\n
"time_namelookup": %{time_namelookup},\n
"time_connect": %{time_connect},\n
"time_appconnect": %{time_appconnect},\n
"time_pretransfer": %{time_pretransfer},\n
"time_starttransfer": %{time_starttransfer},\n
"time_total": %{time_total},\n
"size_request": %{size_request},\n
"size_upload": %{size_upload},\n
"size_download": %{size_download},\n
"size_header": %{size_header}\n
}\n

When I run the below curl call I see time_total property value keeps
changing.

$curl -v -w "_at_curl-format.txt" https://www.google.com

*Response 1.*
{
"time_redirect": 0.000,
"time_namelookup": 0.004,
"time_connect": 0.006,
"time_appconnect": 0.151,
"time_pretransfer": 0.151,
"time_starttransfer": 0.203,
"time_total": 0.203, --> This property value keeps changing when I run
the above curl call multiple times.
"size_request": 78,
"size_upload": 0,
"size_download": 15295,
"size_header": 732
}

*Response 2.*
{
"time_redirect": 0.000,
"time_namelookup": 0.029,
"time_connect": 0.030,
"time_appconnect": 0.177,
"time_pretransfer": 0.177,
"time_starttransfer": 0.230,
"time_total": 0.231,
"size_request": 78,
"size_upload": 0,
"size_download": 15270,
"size_header": 732
}

*Response 3.*
{
"time_redirect": 0.000,
"time_namelookup": 0.029,
"time_connect": 0.030,
"time_appconnect": 0.177,
"time_pretransfer": 0.177,
"time_starttransfer": 0.229,
"time_total": 0.229,
"size_request": 78,
"size_upload": 0,
"size_download": 15266,
"size_header": 732
}

Please guide and correct me if I am missing anything. Thanks in advance.

Best Regards,

Kaushal


-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-11-02