aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-06-14 13:00:41 +0000
committerNathan S. Evans <evans@in.tum.de>2011-06-14 13:00:41 +0000
commit34857d410f10a469ba8cb729b296285dc1af5fe8 (patch)
tree2267488cdcc1f9f279ad6f3d57468733a3063a05 /src/dht
parent535043d064af1be3c3fc387aa90c66a636e76577 (diff)
downloadgnunet-34857d410f10a469ba8cb729b296285dc1af5fe8.tar.gz
gnunet-34857d410f10a469ba8cb729b296285dc1af5fe8.zip
test stop condition, enough requests complete
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-dht-driver.c246
1 files changed, 132 insertions, 114 deletions
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c
index 4b896219c..882a77b65 100644
--- a/src/dht/gnunet-dht-driver.c
+++ b/src/dht/gnunet-dht-driver.c
@@ -704,6 +704,12 @@ static unsigned long long outstanding_gets;
704static unsigned long long gets_completed; 704static unsigned long long gets_completed;
705 705
706/** 706/**
707 * If non-zero, end testing if this many GETs
708 * complete in a single round.
709 */
710static unsigned long long target_completions;
711
712/**
707 * Total number of items to attempt to get. 713 * Total number of items to attempt to get.
708 */ 714 */
709static unsigned long long cumulative_num_gets; 715static unsigned long long cumulative_num_gets;
@@ -980,8 +986,7 @@ finish_testing(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
980 if (get_meter != NULL) 986 if (get_meter != NULL)
981 free_meter (get_meter); 987 free_meter (get_meter);
982 988
983 GNUNET_asprintf (&temp_get_string, 989 GNUNET_asprintf (&temp_get_string, "DHT Successful GETs", trial_to_run);
984 "DHT Successful GETs", trial_to_run);
985 GNUNET_asprintf (&revision_str, "%llu", revision); 990 GNUNET_asprintf (&revision_str, "%llu", revision);
986 if (GNUNET_YES == insert_gauger_data) 991 if (GNUNET_YES == insert_gauger_data)
987 GAUGER_ID("DHT_TESTING", temp_get_string, cumulative_successful_gets / (double)cumulative_num_gets, "percent successful", revision_str); 992 GAUGER_ID("DHT_TESTING", temp_get_string, cumulative_successful_gets / (double)cumulative_num_gets, "percent successful", revision_str);
@@ -1000,7 +1005,7 @@ finish_testing(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
1000 */ 1005 */
1001static void 1006static void
1002log_topology_cb(void *cls, const struct GNUNET_PeerIdentity *first, 1007log_topology_cb(void *cls, const struct GNUNET_PeerIdentity *first,
1003 const struct GNUNET_PeerIdentity *second, const char *emsg) 1008 const struct GNUNET_PeerIdentity *second, const char *emsg)
1004{ 1009{
1005 struct TopologyIteratorContext *topo_ctx = cls; 1010 struct TopologyIteratorContext *topo_ctx = cls;
1006 if ((first != NULL) && (second != NULL)) 1011 if ((first != NULL) && (second != NULL))
@@ -1093,7 +1098,8 @@ stats_finished(void *cls, int result)
1093 */ 1098 */
1094static int 1099static int
1095stats_handle(void *cls, const struct GNUNET_PeerIdentity *peer, 1100stats_handle(void *cls, const struct GNUNET_PeerIdentity *peer,
1096 const char *subsystem, const char *name, uint64_t value, int is_persistent) 1101 const char *subsystem, const char *name, uint64_t value,
1102 int is_persistent)
1097{ 1103{
1098 struct StatisticsIteratorContext *stats_ctx; 1104 struct StatisticsIteratorContext *stats_ctx;
1099 1105
@@ -1168,7 +1174,7 @@ log_dht_statistics(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
1168 */ 1174 */
1169static void 1175static void
1170capture_current_topology(void *cls, 1176capture_current_topology(void *cls,
1171 const struct GNUNET_SCHEDULER_TaskContext * tc) 1177 const struct GNUNET_SCHEDULER_TaskContext * tc)
1172{ 1178{
1173 struct TopologyIteratorContext *topo_ctx = cls; 1179 struct TopologyIteratorContext *topo_ctx = cls;
1174 dhtlog_handle->insert_topology (0); 1180 dhtlog_handle->insert_topology (0);
@@ -1315,7 +1321,7 @@ handle_find_peer_sent(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
1315 1321
1316static void 1322static void
1317send_find_peer_request(void *cls, 1323send_find_peer_request(void *cls,
1318 const struct GNUNET_SCHEDULER_TaskContext * tc) 1324 const struct GNUNET_SCHEDULER_TaskContext * tc)
1319{ 1325{
1320 struct TestFindPeer *test_find_peer = cls; 1326 struct TestFindPeer *test_find_peer = cls;
1321 1327
@@ -1350,8 +1356,8 @@ send_find_peer_request(void *cls,
1350 */ 1356 */
1351static void 1357static void
1352add_new_connection(struct FindPeerContext *find_peer_context, 1358add_new_connection(struct FindPeerContext *find_peer_context,
1353 const struct GNUNET_PeerIdentity *first, 1359 const struct GNUNET_PeerIdentity *first,
1354 const struct GNUNET_PeerIdentity *second) 1360 const struct GNUNET_PeerIdentity *second)
1355{ 1361{
1356 struct PeerCount *first_count; 1362 struct PeerCount *first_count;
1357 struct PeerCount *second_count; 1363 struct PeerCount *second_count;
@@ -1422,7 +1428,7 @@ add_new_connection(struct FindPeerContext *find_peer_context,
1422 */ 1428 */
1423static int 1429static int
1424iterate_min_heap_peers(void *cls, struct GNUNET_CONTAINER_HeapNode *node, 1430iterate_min_heap_peers(void *cls, struct GNUNET_CONTAINER_HeapNode *node,
1425 void *element, GNUNET_CONTAINER_HeapCostType cost) 1431 void *element, GNUNET_CONTAINER_HeapCostType cost)
1426{ 1432{
1427 struct FindPeerContext *find_peer_context = cls; 1433 struct FindPeerContext *find_peer_context = cls;
1428 struct PeerCount *peer_count = element; 1434 struct PeerCount *peer_count = element;
@@ -1472,8 +1478,9 @@ iterate_min_heap_peers(void *cls, struct GNUNET_CONTAINER_HeapNode *node,
1472 * Forward declaration. 1478 * Forward declaration.
1473 */ 1479 */
1474static void 1480static void
1475schedule_churn_find_peer_requests(void *cls, 1481 schedule_churn_find_peer_requests(
1476 const struct GNUNET_SCHEDULER_TaskContext * tc); 1482 void *cls,
1483 const struct GNUNET_SCHEDULER_TaskContext * tc);
1477 1484
1478/** 1485/**
1479 * Callback for iterating over all the peer connections of a peer group. 1486 * Callback for iterating over all the peer connections of a peer group.
@@ -1482,7 +1489,7 @@ schedule_churn_find_peer_requests(void *cls,
1482 */ 1489 */
1483static void 1490static void
1484count_peers_churn_cb(void *cls, const struct GNUNET_PeerIdentity *first, 1491count_peers_churn_cb(void *cls, const struct GNUNET_PeerIdentity *first,
1485 const struct GNUNET_PeerIdentity *second, const char *emsg) 1492 const struct GNUNET_PeerIdentity *second, const char *emsg)
1486{ 1493{
1487 struct FindPeerContext *find_peer_context = cls; 1494 struct FindPeerContext *find_peer_context = cls;
1488 struct TopologyIteratorContext *topo_ctx; 1495 struct TopologyIteratorContext *topo_ctx;
@@ -1627,8 +1634,9 @@ count_peers_churn_cb(void *cls, const struct GNUNET_PeerIdentity *first,
1627 * and the time allowed for each one! 1634 * and the time allowed for each one!
1628 */ 1635 */
1629static void 1636static void
1630schedule_churn_find_peer_requests(void *cls, 1637schedule_churn_find_peer_requests(
1631 const struct GNUNET_SCHEDULER_TaskContext * tc) 1638 void *cls,
1639 const struct GNUNET_SCHEDULER_TaskContext * tc)
1632{ 1640{
1633 struct FindPeerContext *find_peer_ctx = cls; 1641 struct FindPeerContext *find_peer_ctx = cls;
1634 struct TestFindPeer *test_find_peer; 1642 struct TestFindPeer *test_find_peer;
@@ -1712,7 +1720,7 @@ schedule_churn_find_peer_requests(void *cls,
1712 1720
1713static void 1721static void
1714schedule_churn_get_topology(void *cls, 1722schedule_churn_get_topology(void *cls,
1715 const struct GNUNET_SCHEDULER_TaskContext * tc) 1723 const struct GNUNET_SCHEDULER_TaskContext * tc)
1716{ 1724{
1717 struct FindPeerContext *find_peer_context = cls; 1725 struct FindPeerContext *find_peer_context = cls;
1718 GNUNET_TESTING_get_topology (pg, &count_peers_churn_cb, find_peer_context); 1726 GNUNET_TESTING_get_topology (pg, &count_peers_churn_cb, find_peer_context);
@@ -1944,13 +1952,17 @@ get_stop_finished(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
1944 GNUNET_SCHEDULER_cancel (die_task); 1952 GNUNET_SCHEDULER_cancel (die_task);
1945 reset_meter (put_meter); 1953 reset_meter (put_meter);
1946 reset_meter (get_meter); 1954 reset_meter (get_meter);
1955 if ((target_completions > 0)
1956 && (gets_completed > target_completions))
1957 fprintf(stderr, "Ending test early due to GET success!\n");
1947 /** 1958 /**
1948 * Handle all cases: 1959 * Handle all cases:
1949 * 1) Testing is completely finished, call the topology iteration dealy and die 1960 * 1) Testing is completely finished, call the topology iteration dealy and die
1950 * 2) Testing is not finished, churn the network and do gets again (current_churn_round < churn_rounds) 1961 * 2) Testing is not finished, churn the network and do gets again (current_churn_round < churn_rounds)
1951 * 3) Testing is not finished, reschedule all the PUTS *and* GETS again (num_rounds > 1) 1962 * 3) Testing is not finished, reschedule all the PUTS *and* GETS again (num_rounds > 1)
1952 */ 1963 */
1953 if (rounds_finished == total_rounds - 1) /* Everything is finished, end testing */ 1964 if ((rounds_finished == total_rounds - 1) || ((target_completions > 0)
1965 && (gets_completed > target_completions))) /* Everything is finished, end testing */
1954 { 1966 {
1955 if ((dhtlog_handle != NULL) && (GNUNET_NO == dhtlog_minimal)) 1967 if ((dhtlog_handle != NULL) && (GNUNET_NO == dhtlog_minimal))
1956 { 1968 {
@@ -2042,7 +2054,7 @@ get_stop_task(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
2042{ 2054{
2043 struct TestGetContext *test_get = cls; 2055 struct TestGetContext *test_get = cls;
2044 2056
2045 if ( (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) 2057 if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0)
2046 gets_failed++; 2058 gets_failed++;
2047 else 2059 else
2048 cumulative_successful_gets++; 2060 cumulative_successful_gets++;
@@ -2070,10 +2082,10 @@ get_stop_task(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
2070 */ 2082 */
2071static void 2083static void
2072get_result_iterator(void *cls, struct GNUNET_TIME_Absolute exp, 2084get_result_iterator(void *cls, struct GNUNET_TIME_Absolute exp,
2073 const GNUNET_HashCode * key, 2085 const GNUNET_HashCode * key,
2074 const struct GNUNET_PeerIdentity * const *get_path, 2086 const struct GNUNET_PeerIdentity * const *get_path,
2075 const struct GNUNET_PeerIdentity * const *put_path, 2087 const struct GNUNET_PeerIdentity * const *put_path,
2076 enum GNUNET_BLOCK_Type type, size_t size, const void *data) 2088 enum GNUNET_BLOCK_Type type, size_t size, const void *data)
2077{ 2089{
2078 struct TestGetContext *test_get = cls; 2090 struct TestGetContext *test_get = cls;
2079 2091
@@ -2180,7 +2192,7 @@ put_finished(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
2180 outstanding_puts--; 2192 outstanding_puts--;
2181 puts_completed++; 2193 puts_completed++;
2182 2194
2183 if ( (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) 2195 if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0)
2184 fprintf (stderr, "PUT Request failed!\n"); 2196 fprintf (stderr, "PUT Request failed!\n");
2185 2197
2186 /* Reset the daemon (which peer to insert at) for later put request iterations */ 2198 /* Reset the daemon (which peer to insert at) for later put request iterations */
@@ -2299,11 +2311,13 @@ do_put(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
2299 2311
2300static void 2312static void
2301schedule_find_peer_requests(void *cls, 2313schedule_find_peer_requests(void *cls,
2302 const struct GNUNET_SCHEDULER_TaskContext * tc); 2314 const struct GNUNET_SCHEDULER_TaskContext * tc);
2303 2315
2316#if HAVE_MALICIOUS
2304static void 2317static void
2305 setup_malicious_peers(void *cls, 2318setup_malicious_peers(void *cls,
2306 const struct GNUNET_SCHEDULER_TaskContext * tc); 2319 const struct GNUNET_SCHEDULER_TaskContext * tc);
2320#endif
2307 2321
2308/** 2322/**
2309 * Given a number of total peers and a bucket size, estimate the number of 2323 * Given a number of total peers and a bucket size, estimate the number of
@@ -2332,7 +2346,7 @@ connection_estimate(unsigned int peer_count, unsigned int bucket_size)
2332 */ 2346 */
2333static void 2347static void
2334count_peers_cb(void *cls, const struct GNUNET_PeerIdentity *first, 2348count_peers_cb(void *cls, const struct GNUNET_PeerIdentity *first,
2335 const struct GNUNET_PeerIdentity *second, const char *emsg) 2349 const struct GNUNET_PeerIdentity *second, const char *emsg)
2336{ 2350{
2337 struct FindPeerContext *find_peer_context = cls; 2351 struct FindPeerContext *find_peer_context = cls;
2338 if ((first != NULL) && (second != NULL)) 2352 if ((first != NULL) && (second != NULL))
@@ -2390,7 +2404,7 @@ count_peers_cb(void *cls, const struct GNUNET_PeerIdentity *first,
2390 */ 2404 */
2391static void 2405static void
2392schedule_find_peer_requests(void *cls, 2406schedule_find_peer_requests(void *cls,
2393 const struct GNUNET_SCHEDULER_TaskContext * tc) 2407 const struct GNUNET_SCHEDULER_TaskContext * tc)
2394{ 2408{
2395 struct FindPeerContext *find_peer_ctx = cls; 2409 struct FindPeerContext *find_peer_ctx = cls;
2396 struct TestFindPeer *test_find_peer; 2410 struct TestFindPeer *test_find_peer;
@@ -2621,7 +2635,7 @@ setup_puts_and_gets(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
2621 */ 2635 */
2622static void 2636static void
2623continue_puts_and_gets(void *cls, 2637continue_puts_and_gets(void *cls,
2624 const struct GNUNET_SCHEDULER_TaskContext * tc) 2638 const struct GNUNET_SCHEDULER_TaskContext * tc)
2625{ 2639{
2626 int i; 2640 int i;
2627 int max; 2641 int max;
@@ -2721,69 +2735,69 @@ malicious_disconnect_task(void *cls,
2721 } 2735 }
2722} 2736}
2723 2737
2738#if HAVE_MALICIOUS
2724/** 2739/**
2725 * Task to release DHT handles 2740 * Task to release DHT handles
2726 */ 2741 */
2727static void 2742static void
2728malicious_done_task(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 2743malicious_done_task(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
2729{ 2744 {
2730 struct MaliciousContext *ctx = cls; 2745 struct MaliciousContext *ctx = cls;
2731 GNUNET_SCHEDULER_cancel (ctx->disconnect_task); 2746 GNUNET_SCHEDULER_cancel (ctx->disconnect_task);
2732 GNUNET_SCHEDULER_add_now (&malicious_disconnect_task, ctx); 2747 GNUNET_SCHEDULER_add_now (&malicious_disconnect_task, ctx);
2733} 2748 }
2734 2749
2735/** 2750/**
2736 * Set up some data, and call API PUT function 2751 * Set up some data, and call API PUT function
2737 */ 2752 */
2738static void 2753static void
2739set_malicious(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) 2754set_malicious(void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
2740{ 2755 {
2741 struct MaliciousContext *ctx = cls; 2756 struct MaliciousContext *ctx = cls;
2742 2757
2743 if (outstanding_malicious > DEFAULT_MAX_OUTSTANDING_GETS) 2758 if (outstanding_malicious > DEFAULT_MAX_OUTSTANDING_GETS)
2744 { 2759 {
2745 GNUNET_SCHEDULER_add_delayed ( 2760 GNUNET_SCHEDULER_add_delayed (
2746 GNUNET_TIME_relative_multiply ( 2761 GNUNET_TIME_relative_multiply (
2747 GNUNET_TIME_UNIT_MILLISECONDS, 2762 GNUNET_TIME_UNIT_MILLISECONDS,
2748 100), 2763 100),
2749 &set_malicious, ctx); 2764 &set_malicious, ctx);
2750 return; 2765 return;
2751 } 2766 }
2752 2767
2753 if (ctx->dht_handle == NULL) 2768 if (ctx->dht_handle == NULL)
2754 { 2769 {
2755 ctx->dht_handle = GNUNET_DHT_connect (ctx->daemon->cfg, 1); 2770 ctx->dht_handle = GNUNET_DHT_connect (ctx->daemon->cfg, 1);
2756 outstanding_malicious++; 2771 outstanding_malicious++;
2757 } 2772 }
2758 2773
2759 GNUNET_assert(ctx->dht_handle != NULL); 2774 GNUNET_assert(ctx->dht_handle != NULL);
2760 2775
2761#if VERBOSE > 1 2776#if VERBOSE > 1
2762 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting peer %s malicious type %d\n", 2777 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting peer %s malicious type %d\n",
2763 ctx->daemon->shortname, ctx->malicious_type); 2778 ctx->daemon->shortname, ctx->malicious_type);
2764#endif 2779#endif
2765 2780
2766 switch (ctx->malicious_type) 2781 switch (ctx->malicious_type)
2767 { 2782 {
2768 case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_GET: 2783 case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_GET:
2769 GNUNET_DHT_set_malicious_getter (ctx->dht_handle, malicious_get_frequency, &malicious_done_task, ctx); 2784 GNUNET_DHT_set_malicious_getter (ctx->dht_handle, malicious_get_frequency, &malicious_done_task, ctx);
2770 break; 2785 break;
2771 case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT: 2786 case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_PUT:
2772 GNUNET_DHT_set_malicious_putter (ctx->dht_handle, malicious_put_frequency, &malicious_done_task, ctx); 2787 GNUNET_DHT_set_malicious_putter (ctx->dht_handle, malicious_put_frequency, &malicious_done_task, ctx);
2773 break; 2788 break;
2774 case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP: 2789 case GNUNET_MESSAGE_TYPE_DHT_MALICIOUS_DROP:
2775 GNUNET_DHT_set_malicious_dropper (ctx->dht_handle, &malicious_done_task, ctx); 2790 GNUNET_DHT_set_malicious_dropper (ctx->dht_handle, &malicious_done_task, ctx);
2776 break; 2791 break;
2777 default: 2792 default:
2778 break; 2793 break;
2779 } 2794 }
2780 2795
2781 ctx->disconnect_task 2796 ctx->disconnect_task
2782 = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 2797 = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
2783 &malicious_disconnect_task, ctx); 2798 &malicious_disconnect_task, ctx);
2784} 2799 }
2785 2800
2786#if HAVE_MALICIOUS
2787/** 2801/**
2788 * Choose the next peer from the peer group to set as malicious. 2802 * Choose the next peer from the peer group to set as malicious.
2789 * If we are doing a sybil attack, find the nearest peer to the 2803 * If we are doing a sybil attack, find the nearest peer to the
@@ -3009,22 +3023,24 @@ topology_callback(void *cls, const struct GNUNET_PeerIdentity *first,
3009 GNUNET_TIME_absolute_get ()).rel_value 3023 GNUNET_TIME_absolute_get ()).rel_value
3010 / 1000; 3024 / 1000;
3011 3025
3012 failed_conns_per_sec_recent = (double) new_failed_connections / (double) duration; 3026 failed_conns_per_sec_recent = (double) new_failed_connections
3013 failed_conns_per_sec_total = (double) failed_connections / (double) total_duration; 3027 / (double) duration;
3028 failed_conns_per_sec_total = (double) failed_connections
3029 / (double) total_duration;
3014 conns_per_sec_recent = (double) new_connections / (double) duration; 3030 conns_per_sec_recent = (double) new_connections / (double) duration;
3015 conns_per_sec_total = (double) total_connections / (double) total_duration; 3031 conns_per_sec_total = (double) total_connections
3032 / (double) total_duration;
3016 GNUNET_log ( 3033 GNUNET_log (
3017 GNUNET_ERROR_TYPE_WARNING, 3034 GNUNET_ERROR_TYPE_WARNING,
3018 "Recent: %.2f/s, Total: %.2f/s, Recent failed: %.2f/s, total failed %.2f/s\n", 3035 "Recent: %.2f/s, Total: %.2f/s, Recent failed: %.2f/s, total failed %.2f/s\n",
3019 conns_per_sec_recent, 3036 conns_per_sec_recent, conns_per_sec_total,
3020 conns_per_sec_total, failed_conns_per_sec_recent, 3037 failed_conns_per_sec_recent, failed_conns_per_sec_total);
3021 failed_conns_per_sec_total);
3022 connect_last_time = GNUNET_TIME_absolute_get (); 3038 connect_last_time = GNUNET_TIME_absolute_get ();
3023 previous_connections = total_connections; 3039 previous_connections = total_connections;
3024 previous_failed_connections = failed_connections; 3040 previous_failed_connections = failed_connections;
3025 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3041 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3026 "have %llu total_connections, %llu failed\n", total_connections, 3042 "have %llu total_connections, %llu failed\n",
3027 failed_connections); 3043 total_connections, failed_connections);
3028#if ONLY_TESTING 3044#if ONLY_TESTING
3029 /* These conditions likely mean we've entered the death spiral of doom */ 3045 /* These conditions likely mean we've entered the death spiral of doom */
3030 if ((total_connections > 20000) && 3046 if ((total_connections > 20000) &&
@@ -3095,7 +3111,8 @@ topology_callback(void *cls, const struct GNUNET_PeerIdentity *first,
3095 = GNUNET_TIME_absolute_get_difference (connect_start_time, 3111 = GNUNET_TIME_absolute_get_difference (connect_start_time,
3096 GNUNET_TIME_absolute_get ()).rel_value 3112 GNUNET_TIME_absolute_get ()).rel_value
3097 / 1000; 3113 / 1000;
3098 failed_conns_per_sec_total = (long double) failed_connections / total_duration; 3114 failed_conns_per_sec_total = (long double) failed_connections
3115 / total_duration;
3099 conns_per_sec_total = (long double) total_connections / total_duration; 3116 conns_per_sec_total = (long double) total_connections / total_duration;
3100 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3117 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3101 "Overall connection info --- Total: %u, Total Failed %u/s\n", 3118 "Overall connection info --- Total: %u, Total Failed %u/s\n",
@@ -3105,12 +3122,10 @@ topology_callback(void *cls, const struct GNUNET_PeerIdentity *first,
3105 "Overall connection info --- Total: %.2f/s, Total Failed %.2f/s\n", 3122 "Overall connection info --- Total: %.2f/s, Total Failed %.2f/s\n",
3106 conns_per_sec_total, failed_conns_per_sec_total); 3123 conns_per_sec_total, failed_conns_per_sec_total);
3107 3124
3108 GNUNET_asprintf (&temp_conn_string, 3125 GNUNET_asprintf (&temp_conn_string, "DHT Profiler Connection/s",
3109 "DHT Profiler Connection/s",
3110 trial_to_run); 3126 trial_to_run);
3111 GNUNET_asprintf (&temp_conn_failed_string, 3127 GNUNET_asprintf (&temp_conn_failed_string,
3112 "DHT Profiler Connection/s failed", 3128 "DHT Profiler Connection/s failed", trial_to_run);
3113 trial_to_run);
3114 GNUNET_asprintf (&revision_str, "%llu", revision); 3129 GNUNET_asprintf (&revision_str, "%llu", revision);
3115 3130
3116 if (GNUNET_YES == insert_gauger_data) 3131 if (GNUNET_YES == insert_gauger_data)
@@ -3120,13 +3135,10 @@ topology_callback(void *cls, const struct GNUNET_PeerIdentity *first,
3120 3135
3121 GNUNET_free(temp_conn_string); 3136 GNUNET_free(temp_conn_string);
3122 GNUNET_free(temp_conn_failed_string); 3137 GNUNET_free(temp_conn_failed_string);
3123 GNUNET_asprintf (&temp_conn_string, 3138 GNUNET_asprintf (&temp_conn_string, "DHT Profiler Total Connections",
3124 "DHT Profiler Total Connections",
3125 trial_to_run);
3126 GNUNET_asprintf (
3127 &temp_conn_failed_string,
3128 "DHT Profiler Total Connections failed",
3129 trial_to_run); 3139 trial_to_run);
3140 GNUNET_asprintf (&temp_conn_failed_string,
3141 "DHT Profiler Total Connections failed", trial_to_run);
3130 if (GNUNET_YES == insert_gauger_data) 3142 if (GNUNET_YES == insert_gauger_data)
3131 GAUGER_ID("DHT_TESTING", temp_conn_string, (double)total_connections, "conns", revision_str); 3143 GAUGER_ID("DHT_TESTING", temp_conn_string, (double)total_connections, "conns", revision_str);
3132 if (GNUNET_YES == insert_gauger_data) 3144 if (GNUNET_YES == insert_gauger_data)
@@ -3167,8 +3179,8 @@ topology_callback(void *cls, const struct GNUNET_PeerIdentity *first,
3167 3179
3168static void 3180static void
3169peers_started_callback(void *cls, const struct GNUNET_PeerIdentity *id, 3181peers_started_callback(void *cls, const struct GNUNET_PeerIdentity *id,
3170 const struct GNUNET_CONFIGURATION_Handle *cfg, 3182 const struct GNUNET_CONFIGURATION_Handle *cfg,
3171 struct GNUNET_TESTING_Daemon *d, const char *emsg) 3183 struct GNUNET_TESTING_Daemon *d, const char *emsg)
3172{ 3184{
3173 char *revision_str; 3185 char *revision_str;
3174 if (emsg != NULL) 3186 if (emsg != NULL)
@@ -3198,9 +3210,9 @@ peers_started_callback(void *cls, const struct GNUNET_PeerIdentity *id,
3198 GNUNET_asprintf (&revision_str, "%llu", revision); 3210 GNUNET_asprintf (&revision_str, "%llu", revision);
3199 if (GNUNET_YES == insert_gauger_data) 3211 if (GNUNET_YES == insert_gauger_data)
3200 GAUGER_ID("DHT_TESTING", 3212 GAUGER_ID("DHT_TESTING",
3201 "peer_startup_time", 3213 "peer_startup_time",
3202 GNUNET_TIME_absolute_get_duration(peer_start_time).rel_value / (double)num_peers, 3214 GNUNET_TIME_absolute_get_duration(peer_start_time).rel_value / (double)num_peers,
3203 "ms/peer", revision_str); 3215 "ms/peer", revision_str);
3204 GNUNET_free(revision_str); 3216 GNUNET_free(revision_str);
3205 3217
3206 expected_connections = UINT_MAX; 3218 expected_connections = UINT_MAX;
@@ -3247,14 +3259,17 @@ create_topology()
3247{ 3259{
3248 unsigned int create_expected_connections; 3260 unsigned int create_expected_connections;
3249 peers_left = num_peers; /* Reset counter */ 3261 peers_left = num_peers; /* Reset counter */
3250 create_expected_connections = GNUNET_TESTING_create_topology (pg, topology, blacklist_topology, 3262 create_expected_connections
3251 blacklist_transports); 3263 = GNUNET_TESTING_create_topology (pg, topology, blacklist_topology,
3264 blacklist_transports);
3252 if (create_expected_connections > 0) 3265 if (create_expected_connections > 0)
3253 { 3266 {
3254 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3267 GNUNET_log (
3255 "Topology set up, have %u expected connections, now starting peers!\n", create_expected_connections); 3268 GNUNET_ERROR_TYPE_WARNING,
3269 "Topology set up, have %u expected connections, now starting peers!\n",
3270 create_expected_connections);
3256 GNUNET_TESTING_daemons_continue_startup (pg); 3271 GNUNET_TESTING_daemons_continue_startup (pg);
3257 peer_start_time = GNUNET_TIME_absolute_get(); 3272 peer_start_time = GNUNET_TIME_absolute_get ();
3258 } 3273 }
3259 else 3274 else
3260 { 3275 {
@@ -3283,7 +3298,7 @@ create_topology()
3283 */ 3298 */
3284static void 3299static void
3285hostkey_callback(void *cls, const struct GNUNET_PeerIdentity *id, 3300hostkey_callback(void *cls, const struct GNUNET_PeerIdentity *id,
3286 struct GNUNET_TESTING_Daemon *d, const char *emsg) 3301 struct GNUNET_TESTING_Daemon *d, const char *emsg)
3287{ 3302{
3288 char * revision_str; 3303 char * revision_str;
3289 if (emsg != NULL) 3304 if (emsg != NULL)
@@ -3309,19 +3324,19 @@ hostkey_callback(void *cls, const struct GNUNET_PeerIdentity *id,
3309 if (GNUNET_YES == insert_gauger_data) 3324 if (GNUNET_YES == insert_gauger_data)
3310 { 3325 {
3311 if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (config, "TESTING", 3326 if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (config, "TESTING",
3312 "HOSTKEYSFILE")) 3327 "HOSTKEYSFILE"))
3313 { 3328 {
3314 GAUGER_ID("DHT_TESTING", 3329 GAUGER_ID("DHT_TESTING",
3315 "HOSTKEY_GENERATION", 3330 "HOSTKEY_GENERATION",
3316 GNUNET_TIME_absolute_get_duration(hostkey_start_time).rel_value / (double)num_peers, 3331 GNUNET_TIME_absolute_get_duration(hostkey_start_time).rel_value / (double)num_peers,
3317 "ms/hostkey", revision_str); 3332 "ms/hostkey", revision_str);
3318 } 3333 }
3319 else 3334 else
3320 { 3335 {
3321 GAUGER_ID("DHT_TESTING", 3336 GAUGER_ID("DHT_TESTING",
3322 "HOSTKEY_GENERATION_REAL", 3337 "HOSTKEY_GENERATION_REAL",
3323 GNUNET_TIME_absolute_get_duration(hostkey_start_time).rel_value / (double)num_peers, 3338 GNUNET_TIME_absolute_get_duration(hostkey_start_time).rel_value / (double)num_peers,
3324 "ms/hostkey", revision_str); 3339 "ms/hostkey", revision_str);
3325 } 3340 }
3326 } 3341 }
3327 3342
@@ -3789,15 +3804,18 @@ run(void *cls, char * const *args, const char *cfgfile,
3789 test_data_size = DEFAULT_TEST_DATA_SIZE; 3804 test_data_size = DEFAULT_TEST_DATA_SIZE;
3790 3805
3791 /** 3806 /**
3792 * Get testing related options. 3807 * Get DHT testing related options.
3793 */ 3808 */
3794 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING", 3809 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING",
3795 "REPLICATE_SAME")) 3810 "REPLICATE_SAME"))
3796 replicate_same = GNUNET_YES; 3811 replicate_same = GNUNET_YES;
3797 3812
3798 /** 3813 if (GNUNET_SYSERR
3799 * Get testing related options. 3814 == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3800 */ 3815 "target_completions",
3816 &target_completions))
3817 target_completions = 0; /* Not required, on stack */
3818
3801 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING", 3819 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING",
3802 "GET_FROM_SAME")) 3820 "GET_FROM_SAME"))
3803 get_from_same = GNUNET_YES; 3821 get_from_same = GNUNET_YES;
@@ -3848,7 +3866,7 @@ run(void *cls, char * const *args, const char *cfgfile,
3848 do_find_peer = GNUNET_YES; 3866 do_find_peer = GNUNET_YES;
3849 3867
3850 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing", 3868 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing",
3851 "insert_gauger_data")) 3869 "insert_gauger_data"))
3852 insert_gauger_data = GNUNET_YES; 3870 insert_gauger_data = GNUNET_YES;
3853 3871
3854 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", 3872 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht",
@@ -4061,7 +4079,7 @@ run(void *cls, char * const *args, const char *cfgfile,
4061 4079
4062 put_meter = create_meter (num_puts, "Puts completed ", GNUNET_YES); 4080 put_meter = create_meter (num_puts, "Puts completed ", GNUNET_YES);
4063 get_meter = create_meter (num_gets, "Gets completed ", GNUNET_YES); 4081 get_meter = create_meter (num_gets, "Gets completed ", GNUNET_YES);
4064 hostkey_start_time = GNUNET_TIME_absolute_get(); 4082 hostkey_start_time = GNUNET_TIME_absolute_get ();
4065 pg 4083 pg
4066 = GNUNET_TESTING_daemons_start ( 4084 = GNUNET_TESTING_daemons_start (
4067 cfg, 4085 cfg,