diff options
Diffstat (limited to 'src/rps/test_rps.c')
-rw-r--r-- | src/rps/test_rps.c | 188 |
1 files changed, 131 insertions, 57 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 8d31bf50d..92d8c12ea 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2012 GNUnet e.V. | 3 | Copyright (C) 2009, 2012 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file rps/test_rps.c | 19 | * @file rps/test_rps.c |
@@ -42,6 +40,12 @@ static uint32_t num_peers; | |||
42 | 40 | ||
43 | /** | 41 | /** |
44 | * How long do we run the test? | 42 | * How long do we run the test? |
43 | * In seconds. | ||
44 | */ | ||
45 | static uint32_t timeout_s; | ||
46 | |||
47 | /** | ||
48 | * How long do we run the test? | ||
45 | */ | 49 | */ |
46 | //#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 50 | //#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
47 | static struct GNUNET_TIME_Relative timeout; | 51 | static struct GNUNET_TIME_Relative timeout; |
@@ -371,6 +375,11 @@ static int ok; | |||
371 | /** | 375 | /** |
372 | * Identifier for the churn task that runs periodically | 376 | * Identifier for the churn task that runs periodically |
373 | */ | 377 | */ |
378 | static struct GNUNET_SCHEDULER_Task *post_test_task; | ||
379 | |||
380 | /** | ||
381 | * Identifier for the churn task that runs periodically | ||
382 | */ | ||
374 | static struct GNUNET_SCHEDULER_Task *shutdown_task; | 383 | static struct GNUNET_SCHEDULER_Task *shutdown_task; |
375 | 384 | ||
376 | /** | 385 | /** |
@@ -556,6 +565,11 @@ struct SingleTestRun | |||
556 | } cur_test_run; | 565 | } cur_test_run; |
557 | 566 | ||
558 | /** | 567 | /** |
568 | * Did we finish the test? | ||
569 | */ | ||
570 | static int post_test; | ||
571 | |||
572 | /** | ||
559 | * Are we shutting down? | 573 | * Are we shutting down? |
560 | */ | 574 | */ |
561 | static int in_shutdown; | 575 | static int in_shutdown; |
@@ -755,6 +769,41 @@ shutdown_op (void *cls) | |||
755 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 769 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
756 | "Shutdown task scheduled, going down.\n"); | 770 | "Shutdown task scheduled, going down.\n"); |
757 | in_shutdown = GNUNET_YES; | 771 | in_shutdown = GNUNET_YES; |
772 | if (NULL != post_test_task) | ||
773 | { | ||
774 | GNUNET_SCHEDULER_cancel (post_test_task); | ||
775 | } | ||
776 | if (NULL != churn_task) | ||
777 | { | ||
778 | GNUNET_SCHEDULER_cancel (churn_task); | ||
779 | churn_task = NULL; | ||
780 | } | ||
781 | for (i = 0; i < num_peers; i++) | ||
782 | { | ||
783 | if (NULL != rps_peers[i].rps_handle) | ||
784 | { | ||
785 | GNUNET_RPS_disconnect (rps_peers[i].rps_handle); | ||
786 | } | ||
787 | if (NULL != rps_peers[i].op) | ||
788 | { | ||
789 | GNUNET_TESTBED_operation_done (rps_peers[i].op); | ||
790 | } | ||
791 | } | ||
792 | } | ||
793 | |||
794 | |||
795 | /** | ||
796 | * Task run on timeout to collect statistics and potentially shut down. | ||
797 | */ | ||
798 | static void | ||
799 | post_test_op (void *cls) | ||
800 | { | ||
801 | unsigned int i; | ||
802 | |||
803 | post_test_task = NULL; | ||
804 | post_test = GNUNET_YES; | ||
805 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
806 | "Post test task scheduled, going down.\n"); | ||
758 | if (NULL != churn_task) | 807 | if (NULL != churn_task) |
759 | { | 808 | { |
760 | GNUNET_SCHEDULER_cancel (churn_task); | 809 | GNUNET_SCHEDULER_cancel (churn_task); |
@@ -763,7 +812,10 @@ shutdown_op (void *cls) | |||
763 | for (i = 0; i < num_peers; i++) | 812 | for (i = 0; i < num_peers; i++) |
764 | { | 813 | { |
765 | if (NULL != rps_peers[i].op) | 814 | if (NULL != rps_peers[i].op) |
815 | { | ||
766 | GNUNET_TESTBED_operation_done (rps_peers[i].op); | 816 | GNUNET_TESTBED_operation_done (rps_peers[i].op); |
817 | rps_peers[i].op = NULL; | ||
818 | } | ||
767 | if (NULL != cur_test_run.post_test) | 819 | if (NULL != cur_test_run.post_test) |
768 | { | 820 | { |
769 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing post_test for peer %u\n", i); | 821 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing post_test for peer %u\n", i); |
@@ -789,6 +841,13 @@ seed_peers (void *cls) | |||
789 | unsigned int amount; | 841 | unsigned int amount; |
790 | unsigned int i; | 842 | unsigned int i; |
791 | 843 | ||
844 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) | ||
845 | { | ||
846 | return; | ||
847 | } | ||
848 | |||
849 | GNUNET_assert (NULL != peer->rps_handle); | ||
850 | |||
792 | // TODO if malicious don't seed mal peers | 851 | // TODO if malicious don't seed mal peers |
793 | amount = round (.5 * num_peers); | 852 | amount = round (.5 * num_peers); |
794 | 853 | ||
@@ -847,7 +906,7 @@ info_cb (void *cb_cls, | |||
847 | { | 906 | { |
848 | struct OpListEntry *entry = (struct OpListEntry *) cb_cls; | 907 | struct OpListEntry *entry = (struct OpListEntry *) cb_cls; |
849 | 908 | ||
850 | if (GNUNET_YES == in_shutdown) | 909 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
851 | { | 910 | { |
852 | return; | 911 | return; |
853 | } | 912 | } |
@@ -901,7 +960,9 @@ rps_connect_complete_cb (void *cls, | |||
901 | struct RPSPeer *rps_peer = cls; | 960 | struct RPSPeer *rps_peer = cls; |
902 | struct GNUNET_RPS_Handle *rps = ca_result; | 961 | struct GNUNET_RPS_Handle *rps = ca_result; |
903 | 962 | ||
904 | if (GNUNET_YES == in_shutdown) | 963 | GNUNET_assert (NULL != ca_result); |
964 | |||
965 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) | ||
905 | { | 966 | { |
906 | return; | 967 | return; |
907 | } | 968 | } |
@@ -944,9 +1005,11 @@ rps_connect_adapter (void *cls, | |||
944 | struct GNUNET_RPS_Handle *h; | 1005 | struct GNUNET_RPS_Handle *h; |
945 | 1006 | ||
946 | h = GNUNET_RPS_connect (cfg); | 1007 | h = GNUNET_RPS_connect (cfg); |
1008 | GNUNET_assert (NULL != h); | ||
947 | 1009 | ||
948 | if (NULL != cur_test_run.pre_test) | 1010 | if (NULL != cur_test_run.pre_test) |
949 | cur_test_run.pre_test (cls, h); | 1011 | cur_test_run.pre_test (cls, h); |
1012 | GNUNET_assert (NULL != h); | ||
950 | 1013 | ||
951 | return h; | 1014 | return h; |
952 | } | 1015 | } |
@@ -1105,10 +1168,10 @@ default_reply_handle (void *cls, | |||
1105 | if (0 == evaluate () && HAVE_QUICK_QUIT == cur_test_run.have_quick_quit) | 1168 | if (0 == evaluate () && HAVE_QUICK_QUIT == cur_test_run.have_quick_quit) |
1106 | { | 1169 | { |
1107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test succeeded before timeout\n"); | 1170 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test succeeded before timeout\n"); |
1108 | GNUNET_assert (NULL != shutdown_task); | 1171 | GNUNET_assert (NULL != post_test_task); |
1109 | GNUNET_SCHEDULER_cancel (shutdown_task); | 1172 | GNUNET_SCHEDULER_cancel (post_test_task); |
1110 | shutdown_task = GNUNET_SCHEDULER_add_now (&shutdown_op, NULL); | 1173 | post_test_task = GNUNET_SCHEDULER_add_now (&post_test_op, NULL); |
1111 | GNUNET_assert (NULL!= shutdown_task); | 1174 | GNUNET_assert (NULL!= post_test_task); |
1112 | } | 1175 | } |
1113 | } | 1176 | } |
1114 | 1177 | ||
@@ -1122,7 +1185,7 @@ request_peers (void *cls) | |||
1122 | struct RPSPeer *rps_peer; | 1185 | struct RPSPeer *rps_peer; |
1123 | struct PendingReply *pending_rep; | 1186 | struct PendingReply *pending_rep; |
1124 | 1187 | ||
1125 | if (GNUNET_YES == in_shutdown) | 1188 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1126 | return; | 1189 | return; |
1127 | rps_peer = pending_req->rps_peer; | 1190 | rps_peer = pending_req->rps_peer; |
1128 | GNUNET_assert (1 <= rps_peer->num_pending_reqs); | 1191 | GNUNET_assert (1 <= rps_peer->num_pending_reqs); |
@@ -1185,7 +1248,7 @@ cancel_request_cb (void *cls) | |||
1185 | struct RPSPeer *rps_peer = cls; | 1248 | struct RPSPeer *rps_peer = cls; |
1186 | struct PendingReply *pending_rep; | 1249 | struct PendingReply *pending_rep; |
1187 | 1250 | ||
1188 | if (GNUNET_YES == in_shutdown) | 1251 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1189 | return; | 1252 | return; |
1190 | pending_rep = rps_peer->pending_rep_head; | 1253 | pending_rep = rps_peer->pending_rep_head; |
1191 | GNUNET_assert (1 <= rps_peer->num_pending_reps); | 1254 | GNUNET_assert (1 <= rps_peer->num_pending_reps); |
@@ -1290,7 +1353,7 @@ mal_cb (struct RPSPeer *rps_peer) | |||
1290 | { | 1353 | { |
1291 | uint32_t num_mal_peers; | 1354 | uint32_t num_mal_peers; |
1292 | 1355 | ||
1293 | if (GNUNET_YES == in_shutdown) | 1356 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1294 | { | 1357 | { |
1295 | return; | 1358 | return; |
1296 | } | 1359 | } |
@@ -1317,7 +1380,7 @@ mal_cb (struct RPSPeer *rps_peer) | |||
1317 | static void | 1380 | static void |
1318 | single_req_cb (struct RPSPeer *rps_peer) | 1381 | single_req_cb (struct RPSPeer *rps_peer) |
1319 | { | 1382 | { |
1320 | if (GNUNET_YES == in_shutdown) | 1383 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1321 | { | 1384 | { |
1322 | return; | 1385 | return; |
1323 | } | 1386 | } |
@@ -1331,7 +1394,7 @@ single_req_cb (struct RPSPeer *rps_peer) | |||
1331 | static void | 1394 | static void |
1332 | delay_req_cb (struct RPSPeer *rps_peer) | 1395 | delay_req_cb (struct RPSPeer *rps_peer) |
1333 | { | 1396 | { |
1334 | if (GNUNET_YES == in_shutdown) | 1397 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1335 | { | 1398 | { |
1336 | return; | 1399 | return; |
1337 | } | 1400 | } |
@@ -1345,7 +1408,7 @@ delay_req_cb (struct RPSPeer *rps_peer) | |||
1345 | static void | 1408 | static void |
1346 | seed_cb (struct RPSPeer *rps_peer) | 1409 | seed_cb (struct RPSPeer *rps_peer) |
1347 | { | 1410 | { |
1348 | if (GNUNET_YES == in_shutdown) | 1411 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1349 | { | 1412 | { |
1350 | return; | 1413 | return; |
1351 | } | 1414 | } |
@@ -1361,7 +1424,7 @@ seed_cb (struct RPSPeer *rps_peer) | |||
1361 | static void | 1424 | static void |
1362 | seed_big_cb (struct RPSPeer *rps_peer) | 1425 | seed_big_cb (struct RPSPeer *rps_peer) |
1363 | { | 1426 | { |
1364 | if (GNUNET_YES == in_shutdown) | 1427 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1365 | { | 1428 | { |
1366 | return; | 1429 | return; |
1367 | } | 1430 | } |
@@ -1387,7 +1450,7 @@ single_peer_seed_cb (struct RPSPeer *rps_peer) | |||
1387 | static void | 1450 | static void |
1388 | seed_req_cb (struct RPSPeer *rps_peer) | 1451 | seed_req_cb (struct RPSPeer *rps_peer) |
1389 | { | 1452 | { |
1390 | if (GNUNET_YES == in_shutdown) | 1453 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1391 | { | 1454 | { |
1392 | return; | 1455 | return; |
1393 | } | 1456 | } |
@@ -1406,7 +1469,7 @@ seed_req_cb (struct RPSPeer *rps_peer) | |||
1406 | static void | 1469 | static void |
1407 | req_cancel_cb (struct RPSPeer *rps_peer) | 1470 | req_cancel_cb (struct RPSPeer *rps_peer) |
1408 | { | 1471 | { |
1409 | if (GNUNET_YES == in_shutdown) | 1472 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1410 | { | 1473 | { |
1411 | return; | 1474 | return; |
1412 | } | 1475 | } |
@@ -1439,7 +1502,7 @@ churn (void *cls); | |||
1439 | static void | 1502 | static void |
1440 | churn_test_cb (struct RPSPeer *rps_peer) | 1503 | churn_test_cb (struct RPSPeer *rps_peer) |
1441 | { | 1504 | { |
1442 | if (GNUNET_YES == in_shutdown) | 1505 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1443 | { | 1506 | { |
1444 | return; | 1507 | return; |
1445 | } | 1508 | } |
@@ -1480,7 +1543,7 @@ churn_cb (void *cls, | |||
1480 | // FIXME | 1543 | // FIXME |
1481 | struct OpListEntry *entry = cls; | 1544 | struct OpListEntry *entry = cls; |
1482 | 1545 | ||
1483 | if (GNUNET_YES == in_shutdown) | 1546 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1484 | { | 1547 | { |
1485 | return; | 1548 | return; |
1486 | } | 1549 | } |
@@ -1615,7 +1678,7 @@ churn (void *cls) | |||
1615 | double portion_go_online; | 1678 | double portion_go_online; |
1616 | double portion_go_offline; | 1679 | double portion_go_offline; |
1617 | 1680 | ||
1618 | if (GNUNET_YES == in_shutdown) | 1681 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1619 | { | 1682 | { |
1620 | return; | 1683 | return; |
1621 | } | 1684 | } |
@@ -1731,7 +1794,7 @@ profiler_reply_handle (void *cls, | |||
1731 | static void | 1794 | static void |
1732 | profiler_cb (struct RPSPeer *rps_peer) | 1795 | profiler_cb (struct RPSPeer *rps_peer) |
1733 | { | 1796 | { |
1734 | if (GNUNET_YES == in_shutdown) | 1797 | if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) |
1735 | { | 1798 | { |
1736 | return; | 1799 | return; |
1737 | } | 1800 | } |
@@ -1836,7 +1899,7 @@ static uint32_t binom (uint32_t n, uint32_t k) | |||
1836 | * @param a | 1899 | * @param a |
1837 | * @param b | 1900 | * @param b |
1838 | * | 1901 | * |
1839 | * @return | 1902 | * @return |
1840 | */ | 1903 | */ |
1841 | static int is_in_view (uint32_t a, uint32_t b) | 1904 | static int is_in_view (uint32_t a, uint32_t b) |
1842 | { | 1905 | { |
@@ -2172,30 +2235,33 @@ void view_update_cb (void *cls, | |||
2172 | rps_peer->cur_view_count, | 2235 | rps_peer->cur_view_count, |
2173 | view_size); | 2236 | view_size); |
2174 | //*rps_peer->cur_view = *peers; | 2237 | //*rps_peer->cur_view = *peers; |
2175 | memcpy (rps_peer->cur_view, | 2238 | GNUNET_memcpy (rps_peer->cur_view, |
2176 | peers, | 2239 | peers, |
2177 | view_size * sizeof (struct GNUNET_PeerIdentity)); | 2240 | view_size * sizeof (struct GNUNET_PeerIdentity)); |
2178 | to_file ("/tmp/rps/count_in_views.txt", | 2241 | to_file ("/tmp/rps/count_in_views.txt", |
2179 | "%" PRIu64 " %" PRIu32 "", | 2242 | "%" PRIu64 " %" PRIu32 "", |
2180 | rps_peer->index, | 2243 | rps_peer->index, |
2181 | count_peer_in_views_2 (rps_peer->index)); | 2244 | count_peer_in_views_2 (rps_peer->index)); |
2182 | cumulated_view_sizes(); | 2245 | cumulated_view_sizes(); |
2183 | to_file ("/tmp/rps/repr.txt", | 2246 | if (0 != view_size) |
2184 | "%" PRIu64 /* index */ | 2247 | { |
2185 | " %" PRIu32 /* occurrence in views */ | 2248 | to_file ("/tmp/rps/repr.txt", |
2186 | " %" PRIu32 /* view sizes */ | 2249 | "%" PRIu64 /* index */ |
2187 | " %f" /* fraction of repr in views */ | 2250 | " %" PRIu32 /* occurrence in views */ |
2188 | " %f" /* average view size */ | 2251 | " %" PRIu32 /* view sizes */ |
2189 | " %f" /* prob of occurrence in view slot */ | 2252 | " %f" /* fraction of repr in views */ |
2190 | " %f" "", /* exp frac of repr in views */ | 2253 | " %f" /* average view size */ |
2191 | rps_peer->index, | 2254 | " %f" /* prob of occurrence in view slot */ |
2192 | count_peer_in_views_2 (rps_peer->index), | 2255 | " %f" "", /* exp frac of repr in views */ |
2193 | view_sizes, | 2256 | rps_peer->index, |
2194 | count_peer_in_views_2 (rps_peer->index) / (view_size * 1.0), /* fraction of representation in views */ | 2257 | count_peer_in_views_2 (rps_peer->index), |
2195 | view_sizes / (view_size * 1.0), /* average view size */ | 2258 | view_sizes, |
2196 | 1.0 /view_size, /* prob of occurrence in view slot */ | 2259 | count_peer_in_views_2 (rps_peer->index) / (view_size * 1.0), /* fraction of representation in views */ |
2197 | (1.0/view_size) * (view_sizes/view_size) /* expected fraction of repr in views */ | 2260 | view_sizes / (view_size * 1.0), /* average view size */ |
2198 | ); | 2261 | 1.0 /view_size, /* prob of occurrence in view slot */ |
2262 | (1.0/view_size) * (view_sizes/view_size) /* expected fraction of repr in views */ | ||
2263 | ); | ||
2264 | } | ||
2199 | compute_probabilities (rps_peer->index); | 2265 | compute_probabilities (rps_peer->index); |
2200 | all_views_updated_cb(); | 2266 | all_views_updated_cb(); |
2201 | } | 2267 | } |
@@ -2641,7 +2707,12 @@ run (void *cls, | |||
2641 | 2707 | ||
2642 | if (NULL != churn_task) | 2708 | if (NULL != churn_task) |
2643 | GNUNET_SCHEDULER_cancel (churn_task); | 2709 | GNUNET_SCHEDULER_cancel (churn_task); |
2710 | post_test_task = GNUNET_SCHEDULER_add_delayed (timeout, &post_test_op, NULL); | ||
2711 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | ||
2712 | (timeout_s * 1.2) + 0.1 * num_peers); | ||
2644 | shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); | 2713 | shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); |
2714 | shutdown_task = GNUNET_SCHEDULER_add_shutdown (shutdown_op, NULL); | ||
2715 | |||
2645 | } | 2716 | } |
2646 | 2717 | ||
2647 | 2718 | ||
@@ -2670,7 +2741,7 @@ main (int argc, char *argv[]) | |||
2670 | cur_test_run.stat_collect_flags = 0; | 2741 | cur_test_run.stat_collect_flags = 0; |
2671 | cur_test_run.have_collect_view = NO_COLLECT_VIEW; | 2742 | cur_test_run.have_collect_view = NO_COLLECT_VIEW; |
2672 | churn_task = NULL; | 2743 | churn_task = NULL; |
2673 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30); | 2744 | timeout_s = 30; |
2674 | 2745 | ||
2675 | if (strstr (argv[0], "malicious") != NULL) | 2746 | if (strstr (argv[0], "malicious") != NULL) |
2676 | { | 2747 | { |
@@ -2722,7 +2793,7 @@ main (int argc, char *argv[]) | |||
2722 | cur_test_run.main_test = seed_big_cb; | 2793 | cur_test_run.main_test = seed_big_cb; |
2723 | cur_test_run.eval_cb = no_eval; | 2794 | cur_test_run.eval_cb = no_eval; |
2724 | cur_test_run.have_churn = HAVE_NO_CHURN; | 2795 | cur_test_run.have_churn = HAVE_NO_CHURN; |
2725 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10); | 2796 | timeout_s = 10; |
2726 | } | 2797 | } |
2727 | 2798 | ||
2728 | else if (strstr (argv[0], "_single_peer_seed") != NULL) | 2799 | else if (strstr (argv[0], "_single_peer_seed") != NULL) |
@@ -2758,7 +2829,7 @@ main (int argc, char *argv[]) | |||
2758 | cur_test_run.main_test = req_cancel_cb; | 2829 | cur_test_run.main_test = req_cancel_cb; |
2759 | cur_test_run.eval_cb = no_eval; | 2830 | cur_test_run.eval_cb = no_eval; |
2760 | cur_test_run.have_churn = HAVE_NO_CHURN; | 2831 | cur_test_run.have_churn = HAVE_NO_CHURN; |
2761 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10); | 2832 | timeout_s = 10; |
2762 | } | 2833 | } |
2763 | 2834 | ||
2764 | else if (strstr (argv[0], "_churn") != NULL) | 2835 | else if (strstr (argv[0], "_churn") != NULL) |
@@ -2770,16 +2841,16 @@ main (int argc, char *argv[]) | |||
2770 | cur_test_run.main_test = churn_test_cb; | 2841 | cur_test_run.main_test = churn_test_cb; |
2771 | cur_test_run.reply_handle = default_reply_handle; | 2842 | cur_test_run.reply_handle = default_reply_handle; |
2772 | cur_test_run.eval_cb = default_eval_cb; | 2843 | cur_test_run.eval_cb = default_eval_cb; |
2773 | cur_test_run.have_churn = HAVE_CHURN; | 2844 | cur_test_run.have_churn = HAVE_NO_CHURN; |
2774 | cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; | 2845 | cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; |
2775 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10); | 2846 | timeout_s = 10; |
2776 | } | 2847 | } |
2777 | 2848 | ||
2778 | else if (strstr (argv[0], "profiler") != NULL) | 2849 | else if (strstr (argv[0], "profiler") != NULL) |
2779 | { | 2850 | { |
2780 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n"); | 2851 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n"); |
2781 | cur_test_run.name = "test-rps-profiler"; | 2852 | cur_test_run.name = "test-rps-profiler"; |
2782 | num_peers = 10; | 2853 | num_peers = 16; |
2783 | mal_type = 3; | 2854 | mal_type = 3; |
2784 | cur_test_run.init_peer = profiler_init_peer; | 2855 | cur_test_run.init_peer = profiler_init_peer; |
2785 | //cur_test_run.pre_test = mal_pre; | 2856 | //cur_test_run.pre_test = mal_pre; |
@@ -2790,7 +2861,8 @@ main (int argc, char *argv[]) | |||
2790 | cur_test_run.post_test = post_profiler; | 2861 | cur_test_run.post_test = post_profiler; |
2791 | cur_test_run.request_interval = 2; | 2862 | cur_test_run.request_interval = 2; |
2792 | cur_test_run.num_requests = 5; | 2863 | cur_test_run.num_requests = 5; |
2793 | cur_test_run.have_churn = HAVE_CHURN; | 2864 | //cur_test_run.have_churn = HAVE_CHURN; |
2865 | cur_test_run.have_churn = HAVE_NO_CHURN; | ||
2794 | cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; | 2866 | cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; |
2795 | cur_test_run.have_collect_statistics = COLLECT_STATISTICS; | 2867 | cur_test_run.have_collect_statistics = COLLECT_STATISTICS; |
2796 | cur_test_run.stat_collect_flags = STAT_TYPE_ROUNDS | | 2868 | cur_test_run.stat_collect_flags = STAT_TYPE_ROUNDS | |
@@ -2810,12 +2882,13 @@ main (int argc, char *argv[]) | |||
2810 | STAT_TYPE_RECV_PULL_REQ | | 2882 | STAT_TYPE_RECV_PULL_REQ | |
2811 | STAT_TYPE_RECV_PULL_REP; | 2883 | STAT_TYPE_RECV_PULL_REP; |
2812 | cur_test_run.have_collect_view = COLLECT_VIEW; | 2884 | cur_test_run.have_collect_view = COLLECT_VIEW; |
2813 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300); | 2885 | timeout_s = 150; |
2814 | 2886 | ||
2815 | /* 'Clean' directory */ | 2887 | /* 'Clean' directory */ |
2816 | (void) GNUNET_DISK_directory_remove ("/tmp/rps/"); | 2888 | (void) GNUNET_DISK_directory_remove ("/tmp/rps/"); |
2817 | GNUNET_DISK_directory_create ("/tmp/rps/"); | 2889 | GNUNET_DISK_directory_create ("/tmp/rps/"); |
2818 | } | 2890 | } |
2891 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, timeout_s); | ||
2819 | 2892 | ||
2820 | rps_peers = GNUNET_new_array (num_peers, struct RPSPeer); | 2893 | rps_peers = GNUNET_new_array (num_peers, struct RPSPeer); |
2821 | peer_map = GNUNET_CONTAINER_multipeermap_create (num_peers, GNUNET_NO); | 2894 | peer_map = GNUNET_CONTAINER_multipeermap_create (num_peers, GNUNET_NO); |
@@ -2843,6 +2916,7 @@ main (int argc, char *argv[]) | |||
2843 | } | 2916 | } |
2844 | 2917 | ||
2845 | ret_value = cur_test_run.eval_cb(); | 2918 | ret_value = cur_test_run.eval_cb(); |
2919 | |||
2846 | if (NO_COLLECT_VIEW == cur_test_run.have_collect_view) | 2920 | if (NO_COLLECT_VIEW == cur_test_run.have_collect_view) |
2847 | { | 2921 | { |
2848 | GNUNET_array_grow (rps_peers->cur_view, | 2922 | GNUNET_array_grow (rps_peers->cur_view, |