diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-25 13:13:38 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-25 13:13:38 +0000 |
commit | f56d1718ac422e0edea1a782a29cf00158b679ad (patch) | |
tree | 9e77e9e809ea281a6490dd9696bb4dc948307378 | |
parent | fc40f67c76f0c5cac72d85e32f6a5165da2dc19e (diff) | |
download | gnunet-f56d1718ac422e0edea1a782a29cf00158b679ad.tar.gz gnunet-f56d1718ac422e0edea1a782a29cf00158b679ad.zip |
generate histograms
-rw-r--r-- | src/nse/gnunet-service-nse.c | 28 | ||||
-rw-r--r-- | src/nse/test_nse.conf | 2 |
2 files changed, 29 insertions, 1 deletions
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 @@ | |||
45 | #include "gnunet_nse_service.h" | 45 | #include "gnunet_nse_service.h" |
46 | #include "nse.h" | 46 | #include "nse.h" |
47 | 47 | ||
48 | #define ENABLE_HISTOGRAM GNUNET_YES | ||
49 | |||
48 | /** | 50 | /** |
49 | * Over how many values do we calculate the weighted average? | 51 | * Over how many values do we calculate the weighted average? |
50 | */ | 52 | */ |
@@ -76,6 +78,11 @@ static struct GNUNET_TIME_Relative gnunet_nse_interval; | |||
76 | static struct GNUNET_TIME_Relative proof_find_delay; | 78 | static struct GNUNET_TIME_Relative proof_find_delay; |
77 | 79 | ||
78 | 80 | ||
81 | #if ENABLE_HISTOGRAM | ||
82 | static struct GNUNET_BIO_WriteHandle *wh; | ||
83 | #endif | ||
84 | |||
85 | |||
79 | /** | 86 | /** |
80 | * Per-peer information. | 87 | * Per-peer information. |
81 | */ | 88 | */ |
@@ -939,6 +946,10 @@ handle_p2p_size_estimate(void *cls, | |||
939 | uint32_t matching_bits; | 946 | uint32_t matching_bits; |
940 | unsigned int idx; | 947 | unsigned int idx; |
941 | 948 | ||
949 | #if ENABLE_HISTOGRAM | ||
950 | if (NULL != wh) | ||
951 | GNUNET_BIO_write_int64 (wh, GNUNET_htonll (GNUNET_TIME_absolute_get ().abs_value)); | ||
952 | #endif | ||
942 | incoming_flood = (const struct GNUNET_NSE_FloodMessage *) message; | 953 | incoming_flood = (const struct GNUNET_NSE_FloodMessage *) message; |
943 | GNUNET_STATISTICS_update (stats, | 954 | GNUNET_STATISTICS_update (stats, |
944 | "# flood messages received", | 955 | "# flood messages received", |
@@ -1181,6 +1192,13 @@ shutdown_task(void *cls, | |||
1181 | GNUNET_CRYPTO_rsa_key_free (my_private_key); | 1192 | GNUNET_CRYPTO_rsa_key_free (my_private_key); |
1182 | my_private_key = NULL; | 1193 | my_private_key = NULL; |
1183 | } | 1194 | } |
1195 | #if ENABLE_HISTOGRAM | ||
1196 | if (wh != NULL) | ||
1197 | { | ||
1198 | GNUNET_BIO_write_close (wh); | ||
1199 | wh = NULL; | ||
1200 | } | ||
1201 | #endif | ||
1184 | } | 1202 | } |
1185 | 1203 | ||
1186 | 1204 | ||
@@ -1346,6 +1364,16 @@ run(void *cls, struct GNUNET_SERVER_Handle *server, | |||
1346 | core_handlers); /* Register these handlers */ | 1364 | core_handlers); /* Register these handlers */ |
1347 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 1365 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
1348 | &shutdown_task, NULL); | 1366 | &shutdown_task, NULL); |
1367 | #if ENABLE_HISTOGRAM | ||
1368 | if (GNUNET_OK == | ||
1369 | GNUNET_CONFIGURATION_get_value_filename (cfg, | ||
1370 | "NSE", "HISTOGRAM", | ||
1371 | &proof)) | ||
1372 | { | ||
1373 | wh = GNUNET_BIO_write_open (proof); | ||
1374 | GNUNET_free (proof); | ||
1375 | } | ||
1376 | #endif | ||
1349 | if (coreAPI == NULL) | 1377 | if (coreAPI == NULL) |
1350 | { | 1378 | { |
1351 | GNUNET_SCHEDULER_shutdown (); | 1379 | 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 | |||
57 | AUTOSTART = NO | 57 | AUTOSTART = NO |
58 | 58 | ||
59 | [testing] | 59 | [testing] |
60 | NUM_PEERS = 10 | 60 | NUM_PEERS = 1000 |
61 | WEAKRANDOM = YES | 61 | WEAKRANDOM = YES |
62 | TOPOLOGY = NONE | 62 | TOPOLOGY = NONE |
63 | CONNECT_TOPOLOGY = SMALL_WORLD_RING | 63 | CONNECT_TOPOLOGY = SMALL_WORLD_RING |