From: Christian Grothoff Date: Mon, 25 Jul 2011 13:13:38 +0000 (+0000) Subject: generate histograms X-Git-Tag: initial-import-from-subversion-38251~17669 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f56d1718ac422e0edea1a782a29cf00158b679ad;p=oweals%2Fgnunet.git generate histograms --- diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 10ecac026..ef8784946 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -45,6 +45,8 @@ #include "gnunet_nse_service.h" #include "nse.h" +#define ENABLE_HISTOGRAM GNUNET_YES + /** * Over how many values do we calculate the weighted average? */ @@ -76,6 +78,11 @@ static struct GNUNET_TIME_Relative gnunet_nse_interval; static struct GNUNET_TIME_Relative proof_find_delay; +#if ENABLE_HISTOGRAM +static struct GNUNET_BIO_WriteHandle *wh; +#endif + + /** * Per-peer information. */ @@ -939,6 +946,10 @@ handle_p2p_size_estimate(void *cls, uint32_t matching_bits; unsigned int idx; +#if ENABLE_HISTOGRAM + if (NULL != wh) + GNUNET_BIO_write_int64 (wh, GNUNET_htonll (GNUNET_TIME_absolute_get ().abs_value)); +#endif incoming_flood = (const struct GNUNET_NSE_FloodMessage *) message; GNUNET_STATISTICS_update (stats, "# flood messages received", @@ -1181,6 +1192,13 @@ shutdown_task(void *cls, GNUNET_CRYPTO_rsa_key_free (my_private_key); my_private_key = NULL; } +#if ENABLE_HISTOGRAM + if (wh != NULL) + { + GNUNET_BIO_write_close (wh); + wh = NULL; + } +#endif } @@ -1346,6 +1364,16 @@ run(void *cls, struct GNUNET_SERVER_Handle *server, core_handlers); /* Register these handlers */ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); +#if ENABLE_HISTOGRAM + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_filename (cfg, + "NSE", "HISTOGRAM", + &proof)) + { + wh = GNUNET_BIO_write_open (proof); + GNUNET_free (proof); + } +#endif if (coreAPI == NULL) { GNUNET_SCHEDULER_shutdown (); diff --git a/src/nse/test_nse.conf b/src/nse/test_nse.conf index 35adc0cad..219ac6b5e 100644 --- a/src/nse/test_nse.conf +++ b/src/nse/test_nse.conf @@ -57,7 +57,7 @@ EXTERNAL_ADDRESS = 127.0.0.1 AUTOSTART = NO [testing] -NUM_PEERS = 10 +NUM_PEERS = 1000 WEAKRANDOM = YES TOPOLOGY = NONE CONNECT_TOPOLOGY = SMALL_WORLD_RING