diff options
author | Julius Bünger <buenger@mytum.de> | 2018-06-24 14:18:30 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-06-24 14:19:34 +0200 |
commit | 923ba3b333068b0c925c35661f5ed4c0475e9ebd (patch) | |
tree | 353dbad6c1692d79adee184cbb5963c814113b72 /src/rps | |
parent | 0a7a4ba1c5fbc42cc665ae3f0a2a4ebd2290286a (diff) | |
download | gnunet-923ba3b333068b0c925c35661f5ed4c0475e9ebd.tar.gz gnunet-923ba3b333068b0c925c35661f5ed4c0475e9ebd.zip |
rps profiler: add commandline parameters
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-rps-profiler.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index 4a7a89b15..a0e79e565 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -48,12 +48,6 @@ static unsigned bits_needed; | |||
48 | 48 | ||
49 | /** | 49 | /** |
50 | * How long do we run the test? | 50 | * How long do we run the test? |
51 | * In seconds. | ||
52 | */ | ||
53 | static uint32_t timeout_s; | ||
54 | |||
55 | /** | ||
56 | * How long do we run the test? | ||
57 | */ | 51 | */ |
58 | //#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) | 52 | //#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) |
59 | static struct GNUNET_TIME_Relative timeout; | 53 | static struct GNUNET_TIME_Relative timeout; |
@@ -948,6 +942,8 @@ post_test_op (void *cls) | |||
948 | if (NO_COLLECT_STATISTICS == cur_test_run.have_collect_statistics || | 942 | if (NO_COLLECT_STATISTICS == cur_test_run.have_collect_statistics || |
949 | GNUNET_YES == check_statistics_collect_completed()) | 943 | GNUNET_YES == check_statistics_collect_completed()) |
950 | { | 944 | { |
945 | GNUNET_SCHEDULER_cancel (shutdown_task); | ||
946 | shutdown_task = GNUNET_SCHEDULER_add_now (&shutdown_op, NULL); | ||
951 | GNUNET_SCHEDULER_shutdown (); | 947 | GNUNET_SCHEDULER_shutdown (); |
952 | } | 948 | } |
953 | } | 949 | } |
@@ -2570,10 +2566,9 @@ test_run (void *cls, | |||
2570 | if (NULL != churn_task) | 2566 | if (NULL != churn_task) |
2571 | GNUNET_SCHEDULER_cancel (churn_task); | 2567 | GNUNET_SCHEDULER_cancel (churn_task); |
2572 | post_test_task = GNUNET_SCHEDULER_add_delayed (timeout, &post_test_op, NULL); | 2568 | post_test_task = GNUNET_SCHEDULER_add_delayed (timeout, &post_test_op, NULL); |
2573 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 2569 | timeout = GNUNET_TIME_relative_multiply (timeout, 1 + (0.1 * num_peers)); |
2574 | (timeout_s * 1.2) + 0.1 * num_peers); | ||
2575 | shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); | ||
2576 | shutdown_task = GNUNET_SCHEDULER_add_shutdown (shutdown_op, NULL); | 2570 | shutdown_task = GNUNET_SCHEDULER_add_shutdown (shutdown_op, NULL); |
2571 | shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); | ||
2577 | 2572 | ||
2578 | } | 2573 | } |
2579 | 2574 | ||
@@ -2598,7 +2593,7 @@ run (void *cls, | |||
2598 | 2593 | ||
2599 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n"); | 2594 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n"); |
2600 | cur_test_run.name = "test-rps-profiler"; | 2595 | cur_test_run.name = "test-rps-profiler"; |
2601 | num_peers = 10; | 2596 | if (0 == num_peers) num_peers = 10; |
2602 | mal_type = 3; | 2597 | mal_type = 3; |
2603 | cur_test_run.init_peer = profiler_init_peer; | 2598 | cur_test_run.init_peer = profiler_init_peer; |
2604 | //cur_test_run.pre_test = mal_pre; | 2599 | //cur_test_run.pre_test = mal_pre; |
@@ -2608,7 +2603,7 @@ run (void *cls, | |||
2608 | cur_test_run.eval_cb = profiler_eval; | 2603 | cur_test_run.eval_cb = profiler_eval; |
2609 | cur_test_run.post_test = post_profiler; | 2604 | cur_test_run.post_test = post_profiler; |
2610 | cur_test_run.request_interval = 2; | 2605 | cur_test_run.request_interval = 2; |
2611 | cur_test_run.num_requests = 5; | 2606 | if (0 == cur_test_run.num_requests) cur_test_run.num_requests = 5; |
2612 | //cur_test_run.have_churn = HAVE_CHURN; | 2607 | //cur_test_run.have_churn = HAVE_CHURN; |
2613 | cur_test_run.have_churn = HAVE_NO_CHURN; | 2608 | cur_test_run.have_churn = HAVE_NO_CHURN; |
2614 | cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; | 2609 | cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; |
@@ -2630,12 +2625,14 @@ run (void *cls, | |||
2630 | BIT(STAT_TYPE_RECV_PULL_REQ) | | 2625 | BIT(STAT_TYPE_RECV_PULL_REQ) | |
2631 | BIT(STAT_TYPE_RECV_PULL_REP); | 2626 | BIT(STAT_TYPE_RECV_PULL_REP); |
2632 | cur_test_run.have_collect_view = COLLECT_VIEW; | 2627 | cur_test_run.have_collect_view = COLLECT_VIEW; |
2633 | timeout_s = 300; | ||
2634 | 2628 | ||
2635 | /* 'Clean' directory */ | 2629 | /* 'Clean' directory */ |
2636 | (void) GNUNET_DISK_directory_remove ("/tmp/rps/"); | 2630 | (void) GNUNET_DISK_directory_remove ("/tmp/rps/"); |
2637 | GNUNET_DISK_directory_create ("/tmp/rps/"); | 2631 | GNUNET_DISK_directory_create ("/tmp/rps/"); |
2638 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, timeout_s); | 2632 | if (0 == timeout.rel_value_us) |
2633 | { | ||
2634 | timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90); | ||
2635 | } | ||
2639 | 2636 | ||
2640 | /* Compute number of bits for representing largest peer id */ | 2637 | /* Compute number of bits for representing largest peer id */ |
2641 | for (bits_needed = 1; (bits_needed << 1) < num_peers - 1; bits_needed++) | 2638 | for (bits_needed = 1; (bits_needed << 1) < num_peers - 1; bits_needed++) |
@@ -2686,10 +2683,23 @@ main (int argc, char *argv[]) | |||
2686 | int ret_value; | 2683 | int ret_value; |
2687 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 2684 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
2688 | GNUNET_GETOPT_option_uint ('n', | 2685 | GNUNET_GETOPT_option_uint ('n', |
2689 | "peers", | 2686 | "num-peers", |
2690 | "COUNT", | 2687 | "COUNT", |
2691 | gettext_noop ("number of peers to start"), | 2688 | gettext_noop ("number of peers to start"), |
2692 | &num_peers), | 2689 | &num_peers), |
2690 | |||
2691 | GNUNET_GETOPT_option_relative_time ('t', | ||
2692 | "timeout", | ||
2693 | "TIMEOUT", | ||
2694 | gettext_noop ("timeout for DHT PUT and GET requests (default: 1 min)"), | ||
2695 | &timeout), | ||
2696 | |||
2697 | GNUNET_GETOPT_option_uint ('r', | ||
2698 | "num-requests", | ||
2699 | "COUNT", | ||
2700 | gettext_noop ("number of PeerIDs to request"), | ||
2701 | &cur_test_run.num_requests), | ||
2702 | |||
2693 | GNUNET_GETOPT_OPTION_END | 2703 | GNUNET_GETOPT_OPTION_END |
2694 | }; | 2704 | }; |
2695 | 2705 | ||