diff options
-rw-r--r-- | src/curl/curl.c | 9 | ||||
-rw-r--r-- | src/util/benchmark.c | 5 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/curl/curl.c b/src/curl/curl.c index 07f31970a..ec65986cb 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c | |||
@@ -505,15 +505,18 @@ GNUNET_CURL_perform (struct GNUNET_CURL_Context *ctx) | |||
505 | #if ENABLE_BENCHMARK | 505 | #if ENABLE_BENCHMARK |
506 | { | 506 | { |
507 | char *url = NULL; | 507 | char *url = NULL; |
508 | double total = 0; | 508 | double total_as_double = 0; |
509 | struct GNUNET_TIME_Relative total; | ||
509 | struct UrlRequestData *urd; | 510 | struct UrlRequestData *urd; |
510 | CURLcode res; | 511 | CURLcode res; |
511 | res = curl_easy_getinfo (cmsg->easy_handle, CURLINFO_TOTAL_TIME, &total); | 512 | res = curl_easy_getinfo (cmsg->easy_handle, CURLINFO_TOTAL_TIME, &total_as_double); |
512 | GNUNET_break (CURLE_OK == res); | 513 | GNUNET_break (CURLE_OK == res); |
513 | curl_easy_getinfo (cmsg->easy_handle, CURLINFO_EFFECTIVE_URL, &url); | 514 | curl_easy_getinfo (cmsg->easy_handle, CURLINFO_EFFECTIVE_URL, &url); |
515 | total.rel_value_us = total_as_double * 1000 * 1000; | ||
514 | urd = get_url_benchmark_data (url, (unsigned int) response_code); | 516 | urd = get_url_benchmark_data (url, (unsigned int) response_code); |
515 | urd->count++; | 517 | urd->count++; |
516 | urd->time.rel_value_us += total * 1000 * 1000; | 518 | urd->time = GNUNET_TIME_relative_add (urd->time, total); |
519 | urd->time_max = GNUNET_TIME_relative_max (total, urd->time_max); | ||
517 | } | 520 | } |
518 | #endif | 521 | #endif |
519 | job->jcc (job->jcc_cls, | 522 | job->jcc (job->jcc_cls, |
diff --git a/src/util/benchmark.c b/src/util/benchmark.c index 108e01659..b5fc2752c 100644 --- a/src/util/benchmark.c +++ b/src/util/benchmark.c | |||
@@ -135,11 +135,12 @@ write_benchmark_data (struct BenchmarkData *bd) | |||
135 | for (unsigned int i = 0; i < bd->urd_len; i++) | 135 | for (unsigned int i = 0; i < bd->urd_len; i++) |
136 | { | 136 | { |
137 | struct UrlRequestData *urd = &bd->urd[i]; | 137 | struct UrlRequestData *urd = &bd->urd[i]; |
138 | GNUNET_asprintf (&s, "url %s status %u count %llu time_us %llu\n", | 138 | GNUNET_asprintf (&s, "url %s status %u count %llu time_us %llu time_us_max %llu\n", |
139 | urd->request_url, | 139 | urd->request_url, |
140 | urd->status, | 140 | urd->status, |
141 | (unsigned long long) urd->count, | 141 | (unsigned long long) urd->count, |
142 | (unsigned long long) urd->time.rel_value_us); | 142 | (unsigned long long) urd->time.rel_value_us, |
143 | (unsigned long long) urd->time_max.rel_value_us); | ||
143 | GNUNET_assert (GNUNET_SYSERR != GNUNET_DISK_file_write_blocking (fh, s, strlen (s))); | 144 | GNUNET_assert (GNUNET_SYSERR != GNUNET_DISK_file_write_blocking (fh, s, strlen (s))); |
144 | GNUNET_free (s); | 145 | GNUNET_free (s); |
145 | } | 146 | } |