curl / Mailing Lists / curl-library / 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.

Time measurement

From: Mellergård, Daniel via curl-library <>
Date: Mon, 17 Jan 2022 14:43:56 +0000


I am using the CURLINFO_*_TIME_T functions accessible via curl_easy_getinfo (NAMELOOKUP, CONNECT, APPCONNECT, PRETRANSFER, STARTTRANSFER and TOTAL).

I place new requests using curl_multi_add_handle, and when finished curl_multi_remove_handle. During the request, I use curl_multi_wait (linux) and curl_multi_socket_all (windows) to handle it asynchronously.

I also use the Chrome tracer to inspect transfers made. Since curl only provides relative time information (e,.g. not unix epoch) - which is good – I measure the absolute time just before calling curl_multi_add_handle and reference all timing relative to that. I guess there are several cases where this wouldn’t be sufficient, e.g. we have opened maximum number of connections to a host and have to wait before we start.

I guess the basic question is “when is time zero for a curl easy handle”?

Another related question; when connecting using http/2.0 to a host (have only tried one), I get a lot of time spent in PreTransfer and (most often) very little time in Transfer. Is this the expected behavior? Or, is the amount of information that can be given, limited to using nghttp2 somehow? (http/1 seems to work more like I expect.) Or maybe a server issue?


This electronic communication and any attachments may contain confidential and proprietary information of Maxar, Inc. If you are not the intended recipient, or an agent or employee responsible for delivering this communication to the intended recipient, or if you have received this communication in error, please do not print, copy, retransmit, disseminate or otherwise use the information. Please indicate to the sender that you have received this communication in error, and delete the copy you received.

Maxar reserves the right to monitor any electronic communication sent or received by its employees, agents or representatives.

Received on 2022-01-17