diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-06-25 22:32:59 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-06-25 22:45:11 +0200 |
commit | e0b79dfaf9e46b1f5ac3cd7b9e309815e978745b (patch) | |
tree | d2fe8a16eaf9a8b021795beddf5c1705a78d8028 | |
parent | f762fec323f36fd7da7ad6eddfbbae940ec3229e (diff) | |
download | curl-bagder/time-namelookup-start.tar.gz |
CURLINFO_NAMELOOKUP_START_TIME: time-stamp when the resolve startsbagder/time-namelookup-start
Mostly experimental at this point.
-rw-r--r-- | include/curl/curl.h | 8 | ||||
-rw-r--r-- | lib/getinfo.c | 3 | ||||
-rw-r--r-- | lib/hostip.c | 5 | ||||
-rw-r--r-- | lib/progress.c | 3 | ||||
-rw-r--r-- | lib/progress.h | 1 | ||||
-rw-r--r-- | lib/urldata.h | 1 | ||||
-rw-r--r-- | src/tool_writeout.c | 10 |
7 files changed, 24 insertions, 7 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h index 067b34ded..abe03b998 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -2534,10 +2534,6 @@ typedef enum { CURLINFO_PROXY_SSL_VERIFYRESULT = CURLINFO_LONG + 47, CURLINFO_PROTOCOL = CURLINFO_LONG + 48, CURLINFO_SCHEME = CURLINFO_STRING + 49, - /* Fill in new entries below here! */ - - /* Preferably these would be defined conditionally based on the - sizeof curl_off_t being 64-bits */ CURLINFO_TOTAL_TIME_T = CURLINFO_OFF_T + 50, CURLINFO_NAMELOOKUP_TIME_T = CURLINFO_OFF_T + 51, CURLINFO_CONNECT_TIME_T = CURLINFO_OFF_T + 52, @@ -2545,8 +2541,10 @@ typedef enum { CURLINFO_STARTTRANSFER_TIME_T = CURLINFO_OFF_T + 54, CURLINFO_REDIRECT_TIME_T = CURLINFO_OFF_T + 55, CURLINFO_APPCONNECT_TIME_T = CURLINFO_OFF_T + 56, + CURLINFO_NAMELOOKUP_START_TIME = CURLINFO_DOUBLE + 57, + /* Fill in new entries below here! */ - CURLINFO_LASTONE = 56 + CURLINFO_LASTONE = 57 } CURLINFO; /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as diff --git a/lib/getinfo.c b/lib/getinfo.c index 14b456274..98463e5c2 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -317,6 +317,9 @@ static CURLcode getinfo_double(struct Curl_easy *data, CURLINFO info, case CURLINFO_TOTAL_TIME: *param_doublep = DOUBLE_SECS(data->progress.timespent); break; + case CURLINFO_NAMELOOKUP_START_TIME: + *param_doublep = DOUBLE_SECS(data->progress.t_nslookup_start); + break; case CURLINFO_NAMELOOKUP_TIME: *param_doublep = DOUBLE_SECS(data->progress.t_nslookup); break; diff --git a/lib/hostip.c b/lib/hostip.c index d809578e1..92cd7233f 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -61,6 +61,7 @@ #include "inet_ntop.h" #include "multiif.h" #include "warnless.h" +#include "progress.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" #include "curl_memory.h" @@ -668,8 +669,8 @@ int Curl_resolv_timeout(struct connectdata *conn, #endif /* HAVE_SIGACTION */ volatile long timeout; volatile unsigned int prev_alarm = 0; - struct Curl_easy *data = conn->data; #endif /* USE_ALARM_TIMEOUT */ + struct Curl_easy *data = conn->data; int rc; *entry = NULL; @@ -678,6 +679,8 @@ int Curl_resolv_timeout(struct connectdata *conn, /* got an already expired timeout */ return CURLRESOLV_TIMEDOUT; + Curl_pgrsTime(data, TIMER_NAMELOOKUP_START); + #ifdef USE_ALARM_TIMEOUT if(data->set.no_signal) /* Ignore the timeout when signals are disabled */ diff --git a/lib/progress.c b/lib/progress.c index a94668dc2..0d396567b 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -188,6 +188,9 @@ void Curl_pgrsTime(struct Curl_easy *data, timerid timer) case TIMER_NAMELOOKUP: delta = &data->progress.t_nslookup; break; + case TIMER_NAMELOOKUP_START: + delta = &data->progress.t_nslookup_start; + break; case TIMER_CONNECT: delta = &data->progress.t_connect; break; diff --git a/lib/progress.h b/lib/progress.h index 92dbcbd9a..c67f6ef9f 100644 --- a/lib/progress.h +++ b/lib/progress.h @@ -29,6 +29,7 @@ typedef enum { TIMER_NONE, TIMER_STARTOP, TIMER_STARTSINGLE, + TIMER_NAMELOOKUP_START, TIMER_NAMELOOKUP, TIMER_CONNECT, TIMER_APPCONNECT, diff --git a/lib/urldata.h b/lib/urldata.h index 666981c38..19a6df0fb 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1082,6 +1082,7 @@ struct Progress { curl_off_t ulspeed; time_t t_nslookup; + time_t t_nslookup_start; time_t t_connect; time_t t_appconnect; time_t t_pretransfer; diff --git a/src/tool_writeout.c b/src/tool_writeout.c index ffe47c633..f476f04cc 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -31,6 +31,7 @@ typedef enum { VAR_NONE, /* must be the first */ VAR_TOTAL_TIME, + VAR_NAMELOOKUP_START_TIME, VAR_NAMELOOKUP_TIME, VAR_CONNECT_TIME, VAR_APPCONNECT_TIME, @@ -76,6 +77,7 @@ static const struct variable replacements[]={ {"http_connect", VAR_HTTP_CODE_PROXY}, {"time_total", VAR_TOTAL_TIME}, {"time_namelookup", VAR_NAMELOOKUP_TIME}, + {"time_namelookup_start", VAR_NAMELOOKUP_START_TIME}, {"time_connect", VAR_CONNECT_TIME}, {"time_appconnect", VAR_APPCONNECT_TIME}, {"time_pretransfer", VAR_PRETRANSFER_TIME}, @@ -186,6 +188,12 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo) curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &doubleinfo)) fprintf(stream, "%.6f", doubleinfo); break; + case VAR_NAMELOOKUP_START_TIME: + if(CURLE_OK == + curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_START_TIME, + &doubleinfo)) + fprintf(stream, "%.6f", doubleinfo); + break; case VAR_NAMELOOKUP_TIME: if(CURLE_OK == curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, |