mirror of
https://github.com/curl/curl.git
synced 2026-08-24 14:03:35 +03:00
getinfo: add microsecond precise timers for various intervals
Provide a set of new timers that return the time intervals using integer number of microseconds instead of floats. The new info names are as following: CURLINFO_APPCONNECT_TIME_T CURLINFO_CONNECT_TIME_T CURLINFO_NAMELOOKUP_TIME_T CURLINFO_PRETRANSFER_TIME_T CURLINFO_REDIRECT_TIME_T CURLINFO_STARTTRANSFER_TIME_T CURLINFO_TOTAL_TIME_T Closes #2495
This commit is contained in:
parent
c5fe86804c
commit
ce2140a8c1
23 changed files with 585 additions and 56 deletions
|
|
@ -33,7 +33,7 @@ int main(void)
|
|||
CURL *curl;
|
||||
CURLcode res;
|
||||
struct stat file_info;
|
||||
double speed_upload, total_time;
|
||||
curl_off_t speed_upload, total_time;
|
||||
FILE *fd;
|
||||
|
||||
fd = fopen("debugit", "rb"); /* open file to upload */
|
||||
|
|
@ -72,11 +72,13 @@ int main(void)
|
|||
}
|
||||
else {
|
||||
/* now extract transfer info */
|
||||
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload);
|
||||
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time);
|
||||
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD_T, &speed_upload);
|
||||
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &total_time);
|
||||
|
||||
fprintf(stderr, "Speed: %.3f bytes/sec during %.3f seconds\n",
|
||||
speed_upload, total_time);
|
||||
fprintf(stderr, "Speed: %" CURL_FORMAT_CURL_OFF_T " bytes/sec during %"
|
||||
CURL_FORMAT_CURL_OFF_T ".%06ld seconds\n",
|
||||
speed_upload,
|
||||
(total_time / 1000000), (long)(total_time % 1000000));
|
||||
|
||||
}
|
||||
/* always cleanup */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue