diff --git a/runtime/curl.cpp b/runtime/curl.cpp index 5fb066cf27..382d0003d9 100644 --- a/runtime/curl.cpp +++ b/runtime/curl.cpp @@ -18,6 +18,7 @@ #include "common/macos-ports.h" #include "common/smart_ptrs/singleton.h" #include "common/wrappers/to_array.h" +#include "common/dl-utils-lite.h" #include "net/net-events.h" #include "net/net-reactor.h" #include "server/curl-adaptor.h" @@ -661,6 +662,7 @@ bool f$curl_setopt_array(curl_easy easy_id, const array &options) noexcep } mixed f$curl_exec(curl_easy easy_id) noexcept { + constexpr double long_curl_query = 2 * 10e-2; // 0.2 sec auto *easy_context = get_context(easy_id); if (!easy_context) { return false; @@ -672,8 +674,13 @@ mixed f$curl_exec(curl_easy easy_id) noexcept { } easy_context->cleanup_for_next_request(); + double request_start_time = dl_time(); easy_context->error_num = dl::critical_section_call(curl_easy_perform, easy_context->easy_handle); - + double request_finish_time = dl_time(); + if (request_finish_time - request_start_time >= long_curl_query) { + kprintf("LONG curl query : %f. Curl id = %d, url = %s\n", request_finish_time - request_start_time, + easy_context->uniq_id, easy_context->get_info(CURLINFO_EFFECTIVE_URL).as_string().c_str()); + } if (easy_context->error_num != CURLE_OK && easy_context->error_num != CURLE_PARTIAL_FILE) { if (kphp_tracing::is_turned_on()) { kphp_tracing::on_curl_exec_fail(easy_context->uniq_id, -easy_context->error_num); // error_num > 0, pass negative