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.

Re: Why does libcurl call “gettimeofday” during curl_easy_perform?

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 17 Jun 2020 08:55:11 +0200 (CEST)

On Wed, 17 Jun 2020, 张聪(柯图) via curl-library wrote:

> I'm using libcurl to pull a big file. While doing the vtune profiling, I
> found that libcurl called gettimeofday() inside "curl_easy_perform" and it
> cost notable time. Is this necessary? Can I set some option to avoid this
> function call?

There's no option to avoid it, no. libcurl has a lot of functionalitiy that is
based on time and it uses "Curl_now()" internally to get the current time -
and that function ends up calling gettimeofday().

This said, we *should* minimize the amount of time calls. It has been a while
since we had a cleanup of that so I'm sure we can improve here - in particular
by avoiding subsequent calls to Curl_now() when we did one in the parent
function etc.

-- 
  / daniel.haxx.se | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-06-17