aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-06 22:09:36 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-06 22:09:36 +0200
commit168e95c15c41f7e9029200c2b9d2e09accd42321 (patch)
tree025a77606dc829dd931d4bf8badf68ad6a1b4118 /src/dht
parent3d07ace3af61b22eabe64ccd8b60cad464d36052 (diff)
downloadgnunet-168e95c15c41f7e9029200c2b9d2e09accd42321.tar.gz
gnunet-168e95c15c41f7e9029200c2b9d2e09accd42321.zip
fix stats output of dht profiler
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet_dht_profiler.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c
index 477f33bf6..403deb38a 100644
--- a/src/dht/gnunet_dht_profiler.c
+++ b/src/dht/gnunet_dht_profiler.c
@@ -28,6 +28,8 @@
28#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
29#include "gnunet_testbed_service.h" 29#include "gnunet_testbed_service.h"
30#include "gnunet_dht_service.h" 30#include "gnunet_dht_service.h"
31#include "gnunet_constants.h"
32
31 33
32#define MESSAGE(...) \ 34#define MESSAGE(...) \
33 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, __VA_ARGS__) 35 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, __VA_ARGS__)
@@ -212,11 +214,6 @@ static unsigned int n_gets_fail;
212static unsigned int replication; 214static unsigned int replication;
213 215
214/** 216/**
215 * Number of times we try to find the successor circle formation
216 */
217static unsigned int max_searches;
218
219/**
220 * Testbed Operation (to get stats). 217 * Testbed Operation (to get stats).
221 */ 218 */
222static struct GNUNET_TESTBED_Operation *bandwidth_stats_op; 219static struct GNUNET_TESTBED_Operation *bandwidth_stats_op;
@@ -345,9 +342,9 @@ bandwidth_stats_cont (void *cls,
345 struct GNUNET_TESTBED_Operation *op, 342 struct GNUNET_TESTBED_Operation *op,
346 const char *emsg) 343 const char *emsg)
347{ 344{
348 MESSAGE ("# Outgoing bandwidth: %llu\n", 345 MESSAGE ("# Outgoing (core) bandwidth: %llu bytes\n",
349 (unsigned long long) outgoing_bandwidth); 346 (unsigned long long) outgoing_bandwidth);
350 MESSAGE ("# Incoming bandwidth: %llu\n", 347 MESSAGE ("# Incoming (core) bandwidth: %llu bytes\n",
351 (unsigned long long) incoming_bandwidth); 348 (unsigned long long) incoming_bandwidth);
352 fprintf (stderr, 349 fprintf (stderr,
353 "Benchmark done. Collect data via gnunet-statistics, then press ENTER to exit.\n"); 350 "Benchmark done. Collect data via gnunet-statistics, then press ENTER to exit.\n");
@@ -375,8 +372,8 @@ bandwidth_stats_iterator (void *cls,
375 uint64_t value, 372 uint64_t value,
376 int is_persistent) 373 int is_persistent)
377{ 374{
378 static const char *s_sent = "# Bytes transmitted to other peers"; 375 static const char *s_sent = "# bytes encrypted";
379 static const char *s_recv = "# Bytes received from other peers"; 376 static const char *s_recv = "# bytes decrypted";
380 377
381 if (0 == strncmp (s_sent, name, strlen (s_sent))) 378 if (0 == strncmp (s_sent, name, strlen (s_sent)))
382 outgoing_bandwidth = outgoing_bandwidth + value; 379 outgoing_bandwidth = outgoing_bandwidth + value;
@@ -412,10 +409,10 @@ summarize ()
412 /* Collect Stats*/ 409 /* Collect Stats*/
413 bandwidth_stats_op = GNUNET_TESTBED_get_statistics (n_active, 410 bandwidth_stats_op = GNUNET_TESTBED_get_statistics (n_active,
414 testbed_handles, 411 testbed_handles,
415 "dht", 412 "core",
416 NULL, 413 NULL,
417 bandwidth_stats_iterator, 414 &bandwidth_stats_iterator,
418 bandwidth_stats_cont, 415 &bandwidth_stats_cont,
419 NULL); 416 NULL);
420} 417}
421 418
@@ -615,8 +612,9 @@ delayed_put (void *cls)
615 612
616 /* Generate and DHT PUT some random data */ 613 /* Generate and DHT PUT some random data */
617 block_size = 16; /* minimum */ 614 block_size = 16; /* minimum */
615 /* make random payload, reserve 512 - 16 bytes for DHT headers */
618 block_size += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 616 block_size += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
619 (63*1024)); 617 GNUNET_CONSTANTS_MAX_ENCRYPTED_MESSAGE_SIZE - 512);
620 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, 618 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
621 block, 619 block,
622 block_size); 620 block_size);
@@ -851,8 +849,10 @@ test_run (void *cls,
851 /* exit */ 849 /* exit */
852 GNUNET_assert (0); 850 GNUNET_assert (0);
853 } 851 }
854 MESSAGE ("%u peers started\n", 852 MESSAGE ("%u peers started, %u/%u links up\n",
855 num_peers); 853 num_peers,
854 links_succeeded,
855 links_succeeded + links_failed);
856 a_ctx = GNUNET_new_array (num_peers, 856 a_ctx = GNUNET_new_array (num_peers,
857 struct Context); 857 struct Context);
858 /* select the peers which actively participate in profiling */ 858 /* select the peers which actively participate in profiling */
@@ -879,8 +879,6 @@ test_run (void *cls,
879 ac_cnt++; 879 ac_cnt++;
880 } 880 }
881 n_active = ac_cnt; 881 n_active = ac_cnt;
882 MESSAGE ("Active peers: %u\n",
883 n_active);
884 882
885 /* start DHT service on all peers */ 883 /* start DHT service on all peers */
886 for (unsigned int cnt = 0; cnt < num_peers; cnt++) 884 for (unsigned int cnt = 0; cnt < num_peers; cnt++)
@@ -955,11 +953,6 @@ main (int argc,
955 "COUNT", 953 "COUNT",
956 gettext_noop ("number of PUTs to perform per peer"), 954 gettext_noop ("number of PUTs to perform per peer"),
957 &num_puts_per_peer), 955 &num_puts_per_peer),
958 GNUNET_GETOPT_option_uint ('s',
959 "searches",
960 "COUNT",
961 gettext_noop ("maximum number of times we try to search for successor circle formation (0 for R5N)"),
962 &max_searches),
963 GNUNET_GETOPT_option_string ('H', 956 GNUNET_GETOPT_option_string ('H',
964 "hosts", 957 "hosts",
965 "FILENAME", 958 "FILENAME",
@@ -998,7 +991,6 @@ main (int argc,
998 GNUNET_GETOPT_OPTION_END 991 GNUNET_GETOPT_OPTION_END
999 }; 992 };
1000 993
1001 max_searches = 5;
1002 if (GNUNET_OK != 994 if (GNUNET_OK !=
1003 GNUNET_STRINGS_get_utf8_args (argc, argv, 995 GNUNET_STRINGS_get_utf8_args (argc, argv,
1004 &argc, &argv)) 996 &argc, &argv))