diff options
author | Supriti Singh <supritisingh08@gmail.com> | 2014-08-26 22:55:42 +0000 |
---|---|---|
committer | Supriti Singh <supritisingh08@gmail.com> | 2014-08-26 22:55:42 +0000 |
commit | 15518021ad63614a28fb9e766bb71bfa9f047e73 (patch) | |
tree | 51a9667d87eb2cbfad257f9aabf78fac65416e30 /src/dht/gnunet_dht_profiler.c | |
parent | bb82f3298d761f26797e6be94613625bf20e994f (diff) | |
download | gnunet-15518021ad63614a28fb9e766bb71bfa9f047e73.tar.gz gnunet-15518021ad63614a28fb9e766bb71bfa9f047e73.zip |
If 0 max search, use r5n dht
Diffstat (limited to 'src/dht/gnunet_dht_profiler.c')
-rw-r--r-- | src/dht/gnunet_dht_profiler.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index 7edc630d5..53c120950 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c | |||
@@ -461,6 +461,8 @@ bandwidth_stats_iterator (void *cls, | |||
461 | static const char *s_sent = "# Bytes transmitted to other peers"; | 461 | static const char *s_sent = "# Bytes transmitted to other peers"; |
462 | static const char *s_recv = "# Bytes received from other peers"; | 462 | static const char *s_recv = "# Bytes received from other peers"; |
463 | 463 | ||
464 | DEBUG("inside bandwidth_stats_iterator()\n"); | ||
465 | |||
464 | if (0 == strncmp (s_sent, name, strlen (s_sent))) | 466 | if (0 == strncmp (s_sent, name, strlen (s_sent))) |
465 | outgoing_bandwidth = outgoing_bandwidth + value; | 467 | outgoing_bandwidth = outgoing_bandwidth + value; |
466 | else if (0 == strncmp(s_recv, name, strlen (s_recv))) | 468 | else if (0 == strncmp(s_recv, name, strlen (s_recv))) |
@@ -516,10 +518,15 @@ cancel_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
516 | GNUNET_TESTBED_operation_done (ctx->op); | 518 | GNUNET_TESTBED_operation_done (ctx->op); |
517 | ctx->op = NULL; | 519 | ctx->op = NULL; |
518 | 520 | ||
521 | DEBUG("inside cancel_get()"); | ||
522 | |||
519 | /* If profiling is complete, summarize */ | 523 | /* If profiling is complete, summarize */ |
520 | if (n_active == n_gets_fail + n_gets_ok) | 524 | if (n_active == n_gets_fail + n_gets_ok) |
525 | { | ||
526 | average_put_path_length = (double)total_put_path_length/(double)n_active; | ||
527 | average_get_path_length = (double)total_get_path_length/(double )n_gets_ok; | ||
521 | summarize (); | 528 | summarize (); |
522 | 529 | } | |
523 | } | 530 | } |
524 | 531 | ||
525 | 532 | ||
@@ -558,7 +565,7 @@ get_iter (void *cls, | |||
558 | /* Check the keys of put and get match or not. */ | 565 | /* Check the keys of put and get match or not. */ |
559 | GNUNET_assert (0 == memcmp (key, &get_ac->hash, sizeof (struct GNUNET_HashCode))); | 566 | GNUNET_assert (0 == memcmp (key, &get_ac->hash, sizeof (struct GNUNET_HashCode))); |
560 | /* we found the data we are looking for */ | 567 | /* we found the data we are looking for */ |
561 | DEBUG ("We found a GET request; %u remaining\n", n_gets - (n_gets_fail + n_gets_ok)); | 568 | DEBUG ("We found a GET request; %u remaining\n", n_gets - (n_gets_fail + n_gets_ok)); //FIXME: It always prints 1. |
562 | n_gets_ok++; | 569 | n_gets_ok++; |
563 | get_ac->nrefs--; | 570 | get_ac->nrefs--; |
564 | GNUNET_DHT_get_stop (ac->dht_get); | 571 | GNUNET_DHT_get_stop (ac->dht_get); |
@@ -884,11 +891,16 @@ successor_stats_cont (void *cls, | |||
884 | struct GNUNET_HashCode *key; | 891 | struct GNUNET_HashCode *key; |
885 | int count; | 892 | int count; |
886 | 893 | ||
894 | |||
887 | /* Don't schedule the task till we are looking for circle here. */ | 895 | /* Don't schedule the task till we are looking for circle here. */ |
888 | successor_stats_task = GNUNET_SCHEDULER_NO_TASK; | 896 | successor_stats_task = GNUNET_SCHEDULER_NO_TASK; |
889 | GNUNET_TESTBED_operation_done (successor_stats_op); | 897 | GNUNET_TESTBED_operation_done (successor_stats_op); |
890 | successor_stats_op = NULL; | 898 | successor_stats_op = NULL; |
891 | 899 | if (0 == max_searches) | |
900 | { | ||
901 | start_profiling(); | ||
902 | return; | ||
903 | } | ||
892 | start_val = | 904 | start_val = |
893 | (struct GNUNET_HashCode *) GNUNET_CONTAINER_multihashmap_get(successor_peer_hashmap, | 905 | (struct GNUNET_HashCode *) GNUNET_CONTAINER_multihashmap_get(successor_peer_hashmap, |
894 | start_key); | 906 | start_key); |
@@ -985,6 +997,9 @@ successor_stats_iterator (void *cls, | |||
985 | int is_persistent) | 997 | int is_persistent) |
986 | { | 998 | { |
987 | static const char *key_string = "XDHT"; | 999 | static const char *key_string = "XDHT"; |
1000 | if (0 == max_searches) | ||
1001 | return GNUNET_OK; | ||
1002 | |||
988 | if (0 == strncmp (key_string, name, strlen (key_string))) | 1003 | if (0 == strncmp (key_string, name, strlen (key_string))) |
989 | { | 1004 | { |
990 | char *my_id_str; | 1005 | char *my_id_str; |
@@ -1037,6 +1052,8 @@ collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1037 | 1052 | ||
1038 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start collecting statistics...\n"); | 1053 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start collecting statistics...\n"); |
1039 | GNUNET_assert(NULL != testbed_handles); | 1054 | GNUNET_assert(NULL != testbed_handles); |
1055 | |||
1056 | if (0 != max_searches) | ||
1040 | successor_peer_hashmap = GNUNET_CONTAINER_multihashmap_create (num_peers, | 1057 | successor_peer_hashmap = GNUNET_CONTAINER_multihashmap_create (num_peers, |
1041 | GNUNET_NO); | 1058 | GNUNET_NO); |
1042 | successor_stats_op = | 1059 | successor_stats_op = |
@@ -1100,6 +1117,7 @@ service_started (void *cls, | |||
1100 | #if ENABLE_MALICIOUS | 1117 | #if ENABLE_MALICIOUS |
1101 | set_malicious(); | 1118 | set_malicious(); |
1102 | #endif | 1119 | #endif |
1120 | |||
1103 | DEBUG("successor_stats_task \n"); | 1121 | DEBUG("successor_stats_task \n"); |
1104 | struct Collect_Stat_Context *collect_stat_cls = GNUNET_new(struct Collect_Stat_Context); | 1122 | struct Collect_Stat_Context *collect_stat_cls = GNUNET_new(struct Collect_Stat_Context); |
1105 | collect_stat_cls->service_connect_ctx = cls; | 1123 | collect_stat_cls->service_connect_ctx = cls; |
@@ -1268,10 +1286,10 @@ main (int argc, char *const *argv) | |||
1268 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 1286 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
1269 | return 2; | 1287 | return 2; |
1270 | /* set default delays */ | 1288 | /* set default delays */ |
1271 | delay_stats = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1); | 1289 | delay_stats = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10); |
1272 | delay_put = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10); | 1290 | delay_put = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10); |
1273 | delay_get = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10); | 1291 | delay_get = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10); |
1274 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5); | 1292 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10); |
1275 | replication = 1; /* default replication */ | 1293 | replication = 1; /* default replication */ |
1276 | rc = 0; | 1294 | rc = 0; |
1277 | if (GNUNET_OK != | 1295 | if (GNUNET_OK != |