[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: add bytes recv/sent to URL
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: add bytes recv/sent to URL request benchmarking |
Date: |
Thu, 28 Feb 2019 18:14:00 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 5a4d49e84 add bytes recv/sent to URL request benchmarking
5a4d49e84 is described below
commit 5a4d49e84c6829741f6e288088e08c7d0332df49
Author: Florian Dold <address@hidden>
AuthorDate: Thu Feb 28 18:13:49 2019 +0100
add bytes recv/sent to URL request benchmarking
---
src/curl/curl.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++----
src/util/benchmark.c | 6 ++++--
src/util/benchmark.h | 10 ++++++++++
3 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/src/curl/curl.c b/src/curl/curl.c
index e413d1cf5..10475fe2e 100644
--- a/src/curl/curl.c
+++ b/src/curl/curl.c
@@ -489,15 +489,60 @@ GNUNET_CURL_perform2 (struct GNUNET_CURL_Context *ctx,
double total_as_double = 0;
struct GNUNET_TIME_Relative total;
struct UrlRequestData *urd;
- CURLcode res;
- res = curl_easy_getinfo (cmsg->easy_handle, CURLINFO_TOTAL_TIME,
&total_as_double);
- GNUNET_break (CURLE_OK == res);
- curl_easy_getinfo (cmsg->easy_handle, CURLINFO_EFFECTIVE_URL, &url);
+ /* Some care required, as curl is using data types (long vs curl_off_t vs
+ * double) inconsistently to store byte count. */
+ curl_off_t size_curl = 0;
+ long size_long = 0;
+ uint64_t bytes_sent = 0;
+ uint64_t bytes_received = 0;
+
+ GNUNET_break (CURLE_OK ==
+ curl_easy_getinfo (cmsg->easy_handle,
+ CURLINFO_TOTAL_TIME,
+ &total_as_double));
total.rel_value_us = total_as_double * 1000 * 1000;
+
+ GNUNET_break (CURLE_OK ==
+ curl_easy_getinfo (cmsg->easy_handle,
+ CURLINFO_EFFECTIVE_URL,
+ &url));
+
+ /* HEADER_SIZE + SIZE_DOWNLOAD_T is hopefully the total
+ number of bytes received, not clear from curl docs. */
+
+ GNUNET_break (CURLE_OK ==
+ curl_easy_getinfo (cmsg->easy_handle,
+ CURLINFO_HEADER_SIZE,
+ &size_long));
+ bytes_received += size_long;
+
+ GNUNET_break (CURLE_OK ==
+ curl_easy_getinfo (cmsg->easy_handle,
+ CURLINFO_SIZE_DOWNLOAD_T,
+ &size_curl));
+ bytes_received += size_curl;
+
+ /* REQUEST_SIZE + SIZE_UPLOAD_T is hopefully the total number of bytes
+ sent, again docs are not completely clear. */
+
+ GNUNET_break (CURLE_OK ==
+ curl_easy_getinfo (cmsg->easy_handle,
+ CURLINFO_REQUEST_SIZE,
+ &size_long));
+ bytes_sent += size_long;
+
+ GNUNET_break (CURLE_OK ==
+ curl_easy_getinfo (cmsg->easy_handle,
+ CURLINFO_SIZE_UPLOAD_T,
+ &size_curl));
+ bytes_sent += size_curl;
+
urd = get_url_benchmark_data (url, (unsigned int) response_code);
urd->count++;
urd->time = GNUNET_TIME_relative_add (urd->time, total);
urd->time_max = GNUNET_TIME_relative_max (total, urd->time_max);
+ urd->bytes_sent = bytes_sent;
+ urd->bytes_received = bytes_received;
}
#endif
job->jcc (job->jcc_cls,
diff --git a/src/util/benchmark.c b/src/util/benchmark.c
index bb1c3c79a..caf6cd64a 100644
--- a/src/util/benchmark.c
+++ b/src/util/benchmark.c
@@ -137,12 +137,14 @@ write_benchmark_data (struct BenchmarkData *bd)
for (unsigned int i = 0; i < bd->urd_len; i++)
{
struct UrlRequestData *urd = &bd->urd[i];
- GNUNET_asprintf (&s, "url %s status %u count %llu time_us %llu time_us_max
%llu\n",
+ GNUNET_asprintf (&s, "url %s status %u count %llu time_us %llu time_us_max
%llu bytes_sent %llu bytes_received %llu\n",
urd->request_url,
urd->status,
(unsigned long long) urd->count,
(unsigned long long) urd->time.rel_value_us,
- (unsigned long long) urd->time_max.rel_value_us);
+ (unsigned long long) urd->time_max.rel_value_us,
+ (unsigned long long) urd->bytes_sent,
+ (unsigned long long) urd->bytes_received);
GNUNET_assert (GNUNET_SYSERR != GNUNET_DISK_file_write_blocking (fh, s,
strlen (s)));
GNUNET_free (s);
}
diff --git a/src/util/benchmark.h b/src/util/benchmark.h
index 36f57febe..4148ac655 100644
--- a/src/util/benchmark.h
+++ b/src/util/benchmark.h
@@ -75,6 +75,16 @@ struct UrlRequestData
*/
uint64_t count;
+ /**
+ * How many bytes were sent in total to request the URL.
+ */
+ uint64_t bytes_sent;
+
+ /**
+ * How many bytes were received in total as response to requesting this URL.
+ */
+ uint64_t bytes_received;
+
/**
* Total time spent requesting this URL.
*/
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: add bytes recv/sent to URL request benchmarking,
gnunet <=