1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

Introcuding a new timestamp for curl_easy_getinfo():

CURLINFO_APPCONNECT_TIME. This is set with the "application layer"
handshake/connection is completed (typically SSL, TLS or SSH). By using this
you can figure out the application layer's own connect time. You can extract
the time stamp using curl's -w option and the new variable named
'time_appconnect'. This feature was sponsored by Lenny Rachitsky at NeuStar.
This commit is contained in:
Daniel Stenberg 2008-07-03 06:56:03 +00:00
parent ee64d14733
commit 7c648782bc
13 changed files with 74 additions and 21 deletions

View File

@ -6,6 +6,14 @@
Changelog
Daniel Stenberg (3 Jul 2008)
- Introcuding a new timestamp for curl_easy_getinfo():
CURLINFO_APPCONNECT_TIME. This is set with the "application layer"
handshake/connection is completed. Which typically is SSL, TLS or SSH and by
using this you can figure out the application layer's own connect time. You
can extract the time stamp using curl's -w option and the new variable named
'time_appconnect'. This feature was sponsored by Lenny Rachitsky at NeuStar.
Daniel Fandrich (2 Jul 2008)
- Support Open Watcom C on Linux (as well as Windows).

View File

@ -16,6 +16,7 @@ This release includes the following changes:
o curl's option parser for boolean options reworked
o Added --remote-name-all
o Now builds for the INTEGRITY operating system
o Added CURLINFO_APPCONNECT_TIME
This release includes the following bugfixes:

View File

@ -1241,8 +1241,12 @@ The time, in seconds, it took from the start until the name resolving was
completed.
.TP
.B time_connect
The time, in seconds, it took from the start until the connect to the remote
host (or proxy) was completed.
The time, in seconds, it took from the start until the TCP connect to the
remote host (or proxy) was completed.
.TP
.B time_appconnect
The time, in seconds, it took from the start until the SSL/SSH/etc
connect/handshake to the remote host was completed. (Added in 7.19.0)
.TP
.B time_pretransfer
The time, in seconds, it took from the start until the file transfer is just

View File

@ -71,6 +71,12 @@ start until the name resolving was completed.
.IP CURLINFO_CONNECT_TIME
Pass a pointer to a double to receive the time, in seconds, it took from the
start until the connect to the remote host (or proxy) was completed.
.IP CURLINFO_APPCONNECT_TIME
Pass a pointer to a double to receive the time, in seconds, it took from the
start until the SSL/SSH connect/handshake to the remote host was completed.
This time is most often very near to the PRETRANSFER time, except for cases
such as HTTP pippelining where the pretransfer time can be delayed due to
waits in line for the pipeline and more. (Added in 7.19.0)
.IP CURLINFO_PRETRANSFER_TIME
Pass a pointer to a double to receive the time, in seconds, it took from the
start until the file transfer is just about to begin. This includes all
@ -190,29 +196,33 @@ An overview of the six time values available from curl_easy_getinfo()
curl_easy_perform()
|
|--NT
|--|--CT
|--|--|--PT
|--|--|--|--ST
|--|--|--|--|--TT
|--|--|--|--|--RT
|--NAMELOOKUP
|--|--CONNECT
|--|--|--APPCONNECT
|--|--|--|--PRETRANSFER
|--|--|--|--|--STARTTRANSFER
|--|--|--|--|--|--TOTAL
|--|--|--|--|--|--REDIRECT
.FI
.IP NT
.IP NAMELOOKUP
\fICURLINFO_NAMELOOKUP_TIME\fP. The time it took from the start until the name
resolving was completed.
.IP CT
.IP CONNECT
\fICURLINFO_CONNECT_TIME\fP. The time it took from the start until the connect
to the remote host (or proxy) was completed.
.IP PT
.IP APPCONNECT
\fICURLINFO_APPCONNECT_TIME\fP. The time it took from the start until the SSL
connect/handshake with the remote host was completed. (Added in in 7.19.0)
.IP PRETRANSFER
\fICURLINFO_PRETRANSFER_TIME\fP. The time it took from the start until the
file transfer is just about to begin. This includes all pre-transfer commands
and negotiations that are specific to the particular protocol(s) involved.
.IP ST
.IP STARTTRANSFER
\fICURLINFO_STARTTRANSFER_TIME\fP. The time it took from the start until the
first byte is just about to be transferred.
.IP TT
.IP TOTAL
\fICURLINFO_TOTAL_TIME\fP. Total time of the previous request.
.IP RT
.IP REDIRECT
\fICURLINFO_REDIRECT_TIME\fP. The time it took for all redirection steps
include name lookup, connect, pretransfer and transfer before final
transaction was started. So, this is zero if no redirection took place.

View File

@ -1608,9 +1608,10 @@ typedef enum {
CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33,
/* Fill in new entries below here! */
CURLINFO_LASTONE = 32
CURLINFO_LASTONE = 33
} CURLINFO;
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as

View File

@ -137,6 +137,9 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
case CURLINFO_CONNECT_TIME:
*param_doublep = data->progress.t_connect;
break;
case CURLINFO_APPCONNECT_TIME:
*param_doublep = data->progress.t_appconnect;
break;
case CURLINFO_PRETRANSFER_TIME:
*param_doublep = data->progress.t_pretransfer;
break;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2008, 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
@ -172,6 +172,10 @@ void Curl_pgrsTime(struct SessionHandle *data, timerid timer)
data->progress.t_connect =
Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle);
break;
case TIMER_APPCONNECT:
data->progress.t_appconnect =
Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle);
break;
case TIMER_PRETRANSFER:
data->progress.t_pretransfer =
Curl_tvdiff_secs(Curl_tvnow(), data->progress.t_startsingle);

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2008, 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
@ -30,6 +30,7 @@ typedef enum {
TIMER_NONE,
TIMER_NAMELOOKUP,
TIMER_CONNECT,
TIMER_APPCONNECT,
TIMER_PRETRANSFER,
TIMER_STARTTRANSFER,
TIMER_POSTRANSFER,

View File

@ -715,6 +715,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn)
*/
infof(data, "Authentication complete\n");
Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSH is connected */
conn->sockfd = sock;
conn->writesockfd = CURL_SOCKET_BAD;

View File

@ -60,6 +60,7 @@
#include "strequal.h"
#include "url.h"
#include "memory.h"
#include "progress.h"
/* The last #include file should be: */
#include "memdebug.h"
@ -178,11 +179,17 @@ void Curl_ssl_cleanup(void)
CURLcode
Curl_ssl_connect(struct connectdata *conn, int sockindex)
{
CURLcode res;
/* mark this is being ssl-enabled from here on. */
conn->ssl[sockindex].use = TRUE;
conn->ssl[sockindex].state = ssl_connection_negotiating;
return curlssl_connect(conn, sockindex);
res = curlssl_connect(conn, sockindex);
if(!res)
Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */
return res;
}
CURLcode
@ -192,7 +199,7 @@ Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex,
#ifdef curlssl_connect_nonblocking
/* mark this is being ssl requested from here on. */
conn->ssl[sockindex].use = TRUE;
return Curl_ossl_connect_nonblocking(conn, sockindex, done);
return curlssl_connect_nonblocking(conn, sockindex, done);
#else
*done = TRUE; /* fallback to BLOCKING */
conn->ssl[sockindex].use = TRUE;

View File

@ -4328,6 +4328,7 @@ static CURLcode setup_conn(struct connectdata *conn,
}
else {
Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */
Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
conn->bits.tcpconnect = TRUE;
*protocol_done = TRUE;
if(data->set.verbose)

View File

@ -1067,6 +1067,7 @@ struct Progress {
double t_nslookup;
double t_connect;
double t_appconnect;
double t_pretransfer;
double t_starttransfer;
double t_redirect;

View File

@ -45,6 +45,7 @@ typedef enum {
VAR_TOTAL_TIME,
VAR_NAMELOOKUP_TIME,
VAR_CONNECT_TIME,
VAR_APPCONNECT_TIME,
VAR_PRETRANSFER_TIME,
VAR_STARTTRANSFER_TIME,
VAR_SIZE_DOWNLOAD,
@ -79,6 +80,7 @@ static const struct variable replacements[]={
{"time_total", VAR_TOTAL_TIME},
{"time_namelookup", VAR_NAMELOOKUP_TIME},
{"time_connect", VAR_CONNECT_TIME},
{"time_appconnect", VAR_APPCONNECT_TIME},
{"time_pretransfer", VAR_PRETRANSFER_TIME},
{"time_starttransfer", VAR_STARTTRANSFER_TIME},
{"size_header", VAR_HEADER_SIZE},
@ -183,14 +185,22 @@ void ourWriteOut(CURL *curl, const char *writeinfo)
curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &doubleinfo))
fprintf(stream, "%.3f", doubleinfo);
break;
case VAR_APPCONNECT_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME,
&doubleinfo))
fprintf(stream, "%.3f", doubleinfo);
break;
case VAR_PRETRANSFER_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &doubleinfo))
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME,
&doubleinfo))
fprintf(stream, "%.3f", doubleinfo);
break;
case VAR_STARTTRANSFER_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, &doubleinfo))
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
&doubleinfo))
fprintf(stream, "%.3f", doubleinfo);
break;
case VAR_SIZE_UPLOAD: