diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-12-20 15:41:43 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-12-20 15:41:43 +0100 |
commit | e9040f2954bc1423a4b2e47883294dce088a12d5 (patch) | |
tree | 8f4c676ba3e96e996fdde3724e453fbbcf833aab /tests/libtest | |
parent | 51d4885ca046654d37b6bdf31540180693e35e09 (diff) |
lib500: verify timers relative each other
As commit ce896875f8 fixed a timer that accidentally had been moved in
code and then returned a bad timer, the lib500.c code (used in test 500
and some others) now verifies 5 timers against each other to verify that
they have the correct relative values. We cannot compare against
absolute values as the timings will vary a lot.
Diffstat (limited to 'tests/libtest')
-rw-r--r-- | tests/libtest/lib500.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c index 812fb0dd5..109312b37 100644 --- a/tests/libtest/lib500.c +++ b/tests/libtest/lib500.c @@ -88,7 +88,38 @@ int test(char *URL) res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ipstr); moo = fopen(libtest_arg2, "wb"); if(moo) { + double time_namelookup; + double time_connect; + double time_pretransfer; + double time_starttransfer; + double 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, + &time_starttransfer); + curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &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); + } + if(time_connect >= time_pretransfer) { + fprintf(moo, "connect vs pretransfer: %f %f\n", + time_connect, time_pretransfer); + } + if(time_pretransfer >= time_starttransfer) { + fprintf(moo, "pretransfer vs starttransfer: %f %f\n", + time_pretransfer, time_starttransfer); + } + if(time_starttransfer >= time_total) { + fprintf(moo, "starttransfer vs total: %f %f\n", + time_starttransfer, time_total); + } + fclose(moo); } } |