summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilip Prindeville <philipp@redfish-solutions.com>2018-05-17 13:37:36 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-05-17 13:41:04 +0200
commitce2140a8c12299f17bee406bad374e310daa94ed (patch)
treed762462ea05f6187ad9e00468b2087ffb2fd80a0 /tests
parentc5fe86804cce21db3b9902a44ea8903b3b211db0 (diff)
downloadcurl-ce2140a8c12299f17bee406bad374e310daa94ed.tar.gz
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
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/lib500.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c
index 677ab73a7..2a6c58bb5 100644
--- a/tests/libtest/lib500.c
+++ b/tests/libtest/lib500.c
@@ -96,36 +96,50 @@ int test(char *URL)
if(libtest_arg2) {
FILE *moo = fopen(libtest_arg2, "wb");
if(moo) {
- double time_namelookup;
- double time_connect;
- double time_pretransfer;
- double time_starttransfer;
- double time_total;
+ curl_off_t time_namelookup;
+ curl_off_t time_connect;
+ curl_off_t time_pretransfer;
+ curl_off_t time_starttransfer;
+ curl_off_t time_total;
fprintf(moo, "IP: %s\n", ipstr);
- curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &time_namelookup);
- curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &time_connect);
- curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &time_pretransfer);
- curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
+ curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &time_namelookup);
+ curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &time_connect);
+ curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T,
+ &time_pretransfer);
+ curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T,
&time_starttransfer);
- curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total);
+ curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &time_total);
/* since the timing will always vary we only compare relative
differences between these 5 times */
if(time_namelookup > time_connect) {
- fprintf(moo, "namelookup vs connect: %f %f\n",
- time_namelookup, time_connect);
+ fprintf(moo, "namelookup vs connect: %" CURL_FORMAT_CURL_OFF_T
+ ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+ (time_namelookup / 1000000),
+ (long)(time_namelookup % 1000000),
+ (time_connect / 1000000), (long)(time_connect % 1000000));
}
if(time_connect > time_pretransfer) {
- fprintf(moo, "connect vs pretransfer: %f %f\n",
- time_connect, time_pretransfer);
+ fprintf(moo, "connect vs pretransfer: %" CURL_FORMAT_CURL_OFF_T
+ ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+ (time_connect / 1000000), (long)(time_connect % 1000000),
+ (time_pretransfer / 1000000),
+ (long)(time_pretransfer % 1000000));
}
if(time_pretransfer > time_starttransfer) {
- fprintf(moo, "pretransfer vs starttransfer: %f %f\n",
- time_pretransfer, time_starttransfer);
+ fprintf(moo, "pretransfer vs starttransfer: %" CURL_FORMAT_CURL_OFF_T
+ ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+ (time_pretransfer / 1000000),
+ (long)(time_pretransfer % 1000000),
+ (time_starttransfer / 1000000),
+ (long)(time_starttransfer % 1000000));
}
if(time_starttransfer > time_total) {
- fprintf(moo, "starttransfer vs total: %f %f\n",
- time_starttransfer, time_total);
+ fprintf(moo, "starttransfer vs total: %" CURL_FORMAT_CURL_OFF_T
+ ".%06ld %" CURL_FORMAT_CURL_OFF_T ".%06ld\n",
+ (time_starttransfer / 1000000),
+ (long)(time_starttransfer % 1000000),
+ (time_total / 1000000), (long)(time_total % 1000000));
}
fclose(moo);