diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-02-22 15:19:49 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-02-22 15:19:49 +0000 |
commit | 7c0698d2296e00d9544f48819f24ed4319e3fad8 (patch) | |
tree | 343507da792d950d8d24ed11648e433bcad304a9 /src/dht | |
parent | ac5cf07b590f788946d4b05f8e11b2414493f4eb (diff) | |
download | gnunet-7c0698d2296e00d9544f48819f24ed4319e3fad8.tar.gz gnunet-7c0698d2296e00d9544f48819f24ed4319e3fad8.zip |
Testing and core related changes.
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-dht-driver.c | 54 | ||||
-rw-r--r-- | src/dht/gnunet-service-dht.c | 4 |
2 files changed, 46 insertions, 12 deletions
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c index 7e10e5a3a..98cf12fc7 100644 --- a/src/dht/gnunet-dht-driver.c +++ b/src/dht/gnunet-dht-driver.c | |||
@@ -34,9 +34,10 @@ | |||
34 | #include "gnunet_dht_service.h" | 34 | #include "gnunet_dht_service.h" |
35 | #include "dhtlog.h" | 35 | #include "dhtlog.h" |
36 | #include "dht.h" | 36 | #include "dht.h" |
37 | #include "gauger.h" | ||
37 | 38 | ||
38 | /* Specific DEBUG hack, do not use normally (may leak memory, segfault, or eat children.) */ | 39 | /* Specific DEBUG hack, do not use normally (may leak memory, segfault, or eat children.) */ |
39 | #define ONLY_TESTING GNUNET_YES | 40 | #define ONLY_TESTING GNUNET_NO |
40 | 41 | ||
41 | /* DEFINES */ | 42 | /* DEFINES */ |
42 | #define VERBOSE GNUNET_NO | 43 | #define VERBOSE GNUNET_NO |
@@ -688,6 +689,16 @@ static unsigned long long outstanding_gets; | |||
688 | static unsigned long long gets_completed; | 689 | static unsigned long long gets_completed; |
689 | 690 | ||
690 | /** | 691 | /** |
692 | * Total number of items to attempt to get. | ||
693 | */ | ||
694 | static unsigned long long cumulative_num_gets; | ||
695 | |||
696 | /** | ||
697 | * How many gets are done? | ||
698 | */ | ||
699 | static unsigned long long cumulative_successful_gets; | ||
700 | |||
701 | /** | ||
691 | * How many gets failed? | 702 | * How many gets failed? |
692 | */ | 703 | */ |
693 | static unsigned long long gets_failed; | 704 | static unsigned long long gets_failed; |
@@ -1354,7 +1365,7 @@ static int iterate_min_heap_peers (void *cls, | |||
1354 | { | 1365 | { |
1355 | timeout = GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime); | 1366 | timeout = GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime); |
1356 | } | 1367 | } |
1357 | GNUNET_TESTING_daemons_connect(d1, d2, timeout, DEFAULT_RECONNECT_ATTEMPTS, NULL, NULL); | 1368 | GNUNET_TESTING_daemons_connect(d1, d2, timeout, DEFAULT_RECONNECT_ATTEMPTS, GNUNET_YES, NULL, NULL); |
1358 | } | 1369 | } |
1359 | if (GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).rel_value > 0) | 1370 | if (GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).rel_value > 0) |
1360 | return GNUNET_YES; | 1371 | return GNUNET_YES; |
@@ -1793,6 +1804,9 @@ get_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
1793 | 1804 | ||
1794 | if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT) | 1805 | if (tc->reason == GNUNET_SCHEDULER_REASON_TIMEOUT) |
1795 | gets_failed++; | 1806 | gets_failed++; |
1807 | else | ||
1808 | cumulative_successful_gets++; | ||
1809 | |||
1796 | GNUNET_assert(test_get->get_handle != NULL); | 1810 | GNUNET_assert(test_get->get_handle != NULL); |
1797 | GNUNET_DHT_get_stop(test_get->get_handle); | 1811 | GNUNET_DHT_get_stop(test_get->get_handle); |
1798 | test_get->get_handle = NULL; | 1812 | test_get->get_handle = NULL; |
@@ -1889,6 +1903,7 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
1889 | GNUNET_assert(test_get->dht_handle != NULL); | 1903 | GNUNET_assert(test_get->dht_handle != NULL); |
1890 | outstanding_gets++; | 1904 | outstanding_gets++; |
1891 | 1905 | ||
1906 | cumulative_num_gets++; | ||
1892 | /* Insert the data at the first peer */ | 1907 | /* Insert the data at the first peer */ |
1893 | test_get->get_handle = GNUNET_DHT_get_start(test_get->dht_handle, | 1908 | test_get->get_handle = GNUNET_DHT_get_start(test_get->dht_handle, |
1894 | get_delay, | 1909 | get_delay, |
@@ -2617,7 +2632,11 @@ topology_callback (void *cls, | |||
2617 | (second_daemon == repeat_connect_peer2)) | 2632 | (second_daemon == repeat_connect_peer2)) |
2618 | { | 2633 | { |
2619 | if (emsg != NULL) /* Peers failed to connect again! */ | 2634 | if (emsg != NULL) /* Peers failed to connect again! */ |
2620 | return; | 2635 | { |
2636 | GNUNET_assert(repeat_connect_task == GNUNET_SCHEDULER_NO_TASK); | ||
2637 | repeat_connect_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60), &repeat_connect, NULL); | ||
2638 | return; | ||
2639 | } | ||
2621 | else /* Repeat peers actually connected! */ | 2640 | else /* Repeat peers actually connected! */ |
2622 | { | 2641 | { |
2623 | if (repeat_connect_task != GNUNET_SCHEDULER_NO_TASK) | 2642 | if (repeat_connect_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -2676,12 +2695,6 @@ topology_callback (void *cls, | |||
2676 | } | 2695 | } |
2677 | #endif | 2696 | #endif |
2678 | } | 2697 | } |
2679 | #if ONLY_TESTING | ||
2680 | else if (repeat_connect_mode == GNUNET_YES) | ||
2681 | { | ||
2682 | repeat_connect_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 60), &repeat_connect, NULL); | ||
2683 | } | ||
2684 | #endif | ||
2685 | 2698 | ||
2686 | if (emsg == NULL) | 2699 | if (emsg == NULL) |
2687 | { | 2700 | { |
@@ -2708,7 +2721,7 @@ topology_callback (void *cls, | |||
2708 | } | 2721 | } |
2709 | 2722 | ||
2710 | #if ONLY_TESTING | 2723 | #if ONLY_TESTING |
2711 | if (repeat_connect_mode == GNUNET_YES) | 2724 | if ((repeat_connect_mode == GNUNET_YES) ) |
2712 | return; | 2725 | return; |
2713 | #endif | 2726 | #endif |
2714 | 2727 | ||
@@ -2728,6 +2741,27 @@ topology_callback (void *cls, | |||
2728 | dhtlog_handle->insert_topology(expected_connections); | 2741 | dhtlog_handle->insert_topology(expected_connections); |
2729 | } | 2742 | } |
2730 | 2743 | ||
2744 | |||
2745 | total_duration = GNUNET_TIME_absolute_get_difference (connect_start_time, | ||
2746 | GNUNET_TIME_absolute_get()).rel_value / 1000; | ||
2747 | failed_conns_per_sec_total = (double)failed_connections / total_duration; | ||
2748 | conns_per_sec_total = (double)total_connections / total_duration; | ||
2749 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Overall connection info --- Total: %u, Total Failed %u/s\n", | ||
2750 | total_connections, failed_connections); | ||
2751 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Overall connection info --- Total: %.2f/s, Total Failed %.2f/s\n", | ||
2752 | conns_per_sec_total, failed_conns_per_sec_total); | ||
2753 | /** Comment out until gauger is ready */ | ||
2754 | /** | ||
2755 | GNUNET_asprintf(&temp_conn_string, "dht_peer_connection_speed"); | ||
2756 | GNUNET_asprintf(&temp_failed_conn_string, "dht_peer_failed_connection_speed"); | ||
2757 | |||
2758 | GAUGER_COUNTER(temp_conn_string, conns_per_sec_total, trial_to_run, DATE); | ||
2759 | GAUGER_COUNTER(temp_failed_conn_string, failed_conns_per_sec_total, trial_to_run, DATE); | ||
2760 | |||
2761 | GNUNET_free(temp_conn_string); | ||
2762 | GNUNET_free(temp_failed_conn_string); | ||
2763 | */ | ||
2764 | |||
2731 | GNUNET_SCHEDULER_cancel (die_task); | 2765 | GNUNET_SCHEDULER_cancel (die_task); |
2732 | 2766 | ||
2733 | if ((GNUNET_YES == dhtlog_minimal) && (NULL != dhtlog_handle)) | 2767 | if ((GNUNET_YES == dhtlog_minimal) && (NULL != dhtlog_handle)) |
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index 72cd7e39f..f205abbae 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -2181,7 +2181,7 @@ route_result_message (struct GNUNET_MessageHeader *msg, | |||
2181 | if (GNUNET_YES == consider_peer (&new_peer)) | 2181 | if (GNUNET_YES == consider_peer (&new_peer)) |
2182 | { | 2182 | { |
2183 | increment_stats (STAT_HELLOS_PROVIDED); | 2183 | increment_stats (STAT_HELLOS_PROVIDED); |
2184 | GNUNET_TRANSPORT_offer_hello (transport_handle, hello_msg); | 2184 | GNUNET_TRANSPORT_offer_hello (transport_handle, hello_msg, NULL, NULL); |
2185 | GNUNET_CORE_peer_request_connect (coreAPI, | 2185 | GNUNET_CORE_peer_request_connect (coreAPI, |
2186 | GNUNET_TIME_relative_multiply | 2186 | GNUNET_TIME_relative_multiply |
2187 | (GNUNET_TIME_UNIT_SECONDS, 5), | 2187 | (GNUNET_TIME_UNIT_SECONDS, 5), |
@@ -2701,7 +2701,7 @@ handle_dht_find_peer (const struct GNUNET_MessageHeader *find_msg, | |||
2701 | if (GNUNET_YES == consider_peer (&peer_id)) | 2701 | if (GNUNET_YES == consider_peer (&peer_id)) |
2702 | { | 2702 | { |
2703 | increment_stats (STAT_HELLOS_PROVIDED); | 2703 | increment_stats (STAT_HELLOS_PROVIDED); |
2704 | GNUNET_TRANSPORT_offer_hello (transport_handle, other_hello); | 2704 | GNUNET_TRANSPORT_offer_hello (transport_handle, other_hello, NULL, NULL); |
2705 | GNUNET_CORE_peer_request_connect (coreAPI, | 2705 | GNUNET_CORE_peer_request_connect (coreAPI, |
2706 | GNUNET_TIME_relative_multiply | 2706 | GNUNET_TIME_relative_multiply |
2707 | (GNUNET_TIME_UNIT_SECONDS, 5), | 2707 | (GNUNET_TIME_UNIT_SECONDS, 5), |