diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/getinfo.c | 4 | ||||
-rw-r--r-- | lib/progress.c | 16 | ||||
-rw-r--r-- | lib/progress.h | 1 | ||||
-rw-r--r-- | lib/transfer.c | 2 | ||||
-rw-r--r-- | lib/urldata.h | 3 |
5 files changed, 18 insertions, 8 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c index b502609ea..cdb69ca72 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -43,6 +43,7 @@ CURLcode Curl_initinfo(struct SessionHandle *data) pro->t_nslookup = 0; pro->t_connect = 0; pro->t_pretransfer = 0; + pro->t_starttransfer = 0; info->httpcode = 0; info->httpversion=0; @@ -107,6 +108,9 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) case CURLINFO_PRETRANSFER_TIME: *param_doublep = data->progress.t_pretransfer; break; + case CURLINFO_STARTTRANSFER_TIME: + *param_doublep = data->progress.t_starttransfer; + break; case CURLINFO_SIZE_UPLOAD: *param_doublep = data->progress.uploaded; break; diff --git a/lib/progress.c b/lib/progress.c index 865744654..318a6d872 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -111,22 +111,24 @@ void Curl_pgrsTime(struct SessionHandle *data, timerid timer) /* mistake filter */ break; case TIMER_STARTSINGLE: - /* This is set at the start of a single fetch, there may be several - fetches within an operation, why we add all other times relative - to this one */ + /* This is set at the start of a single fetch */ data->progress.t_startsingle = Curl_tvnow(); break; case TIMER_NAMELOOKUP: - data->progress.t_nslookup += + data->progress.t_nslookup = (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0; break; case TIMER_CONNECT: - data->progress.t_connect += + data->progress.t_connect = (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0; break; case TIMER_PRETRANSFER: - data->progress.t_pretransfer += + data->progress.t_pretransfer = + (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0; + break; + case TIMER_STARTTRANSFER: + data->progress.t_starttransfer = (double)Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle)/1000.0; break; case TIMER_POSTRANSFER: @@ -227,7 +229,7 @@ int Curl_pgrsUpdate(struct connectdata *conn) /* The exact time spent so far (from the start) */ timespent = (double)Curl_tvdiff (now, data->progress.start)/1000; - data->progress.timespent = (long)timespent; + data->progress.timespent = timespent; /* The average download speed this far */ data->progress.dlspeed = diff --git a/lib/progress.h b/lib/progress.h index 3d0a6b084..2d4598414 100644 --- a/lib/progress.h +++ b/lib/progress.h @@ -31,6 +31,7 @@ typedef enum { TIMER_NAMELOOKUP, TIMER_CONNECT, TIMER_PRETRANSFER, + TIMER_STARTTRANSFER, TIMER_POSTRANSFER, TIMER_STARTSINGLE, TIMER_LAST /* must be last */ diff --git a/lib/transfer.c b/lib/transfer.c index 163b2cb84..b59c9f2f7 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -305,6 +305,8 @@ Transfer(struct connectdata *c_conn) } break; default: + if ((bytecount == 0) && (writebytecount == 0)) + Curl_pgrsTime(data, TIMER_STARTTRANSFER); if((keepon & KEEP_READ) && FD_ISSET(conn->sockfd, &readfd)) { /* read! */ urg = Curl_read(conn, conn->sockfd, buf, BUFSIZE -1, &nread); diff --git a/lib/urldata.h b/lib/urldata.h index a8f1ebe78..6749113fe 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -374,7 +374,7 @@ struct Progress { int width; /* screen width at download start */ int flags; /* see progress.h */ - long timespent; + double timespent; double dlspeed; double ulspeed; @@ -382,6 +382,7 @@ struct Progress { double t_nslookup; double t_connect; double t_pretransfer; + double t_starttransfer; struct timeval start; struct timeval t_startsingle; |