aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-10-22 21:26:57 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-10-22 21:26:57 +0000
commit4b4446ff38e6737fbc432c129688371452222e33 (patch)
treedbfb6c36b19dc9b3bd6b35a846b8aa59a3276bf6 /src/testbed
parentbd9f50c4923d523fdd3494a174b12a4926335149 (diff)
downloadgnunet-4b4446ff38e6737fbc432c129688371452222e33.tar.gz
gnunet-4b4446ff38e6737fbc432c129688371452222e33.zip
profiler topology option
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-testbed-profiler.c76
1 files changed, 69 insertions, 7 deletions
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index 36d04601f..8e02a55f8 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -231,6 +231,11 @@ static int result;
231 */ 231 */
232enum State state; 232enum State state;
233 233
234/**
235 * The topology we want to acheive
236 */
237enum GNUNET_TESTBED_TopologyOption topology;
238
234 239
235/** 240/**
236 * Shutdown nicely 241 * Shutdown nicely
@@ -336,12 +341,26 @@ peer_churn_cb (void *cls, const char *emsg)
336 state = STATE_PEERS_LINKING; 341 state = STATE_PEERS_LINKING;
337 /* Do overlay connect */ 342 /* Do overlay connect */
338 prof_start_time = GNUNET_TIME_absolute_get (); 343 prof_start_time = GNUNET_TIME_absolute_get ();
339 topology_op = 344 switch (topology)
340 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers, 345 {
341 GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, 346 case GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI:
342 num_links, 347 topology_op =
343 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY, 348 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers,
344 GNUNET_TESTBED_TOPOLOGY_OPTION_END); 349 topology,
350 num_links,
351 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
352 GNUNET_TESTBED_TOPOLOGY_OPTION_END);
353 break;
354 case GNUNET_TESTBED_TOPOLOGY_CLIQUE:
355 topology_op =
356 GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers,
357 topology,
358 GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
359 GNUNET_TESTBED_TOPOLOGY_OPTION_END);
360 break;
361 default:
362 GNUNET_assert (0);
363 }
345 } 364 }
346} 365}
347 366
@@ -531,7 +550,9 @@ controller_event_cb (void *cls,
531 printf ("."); 550 printf (".");
532 fflush (stdout); 551 fflush (stdout);
533 established_links++; 552 established_links++;
534 if ((established_links + failed_links) == num_links) 553 if ((established_links + failed_links) ==
554 (GNUNET_TESTBED_TOPOLOGY_CLIQUE == topology ?
555 num_peers * (num_peers -1) : num_links))
535 { 556 {
536 print_overlay_links_summary (); 557 print_overlay_links_summary ();
537 result = GNUNET_OK; 558 result = GNUNET_OK;
@@ -725,6 +746,41 @@ run (void *cls, char *const *args, const char *cfgfile,
725 746
726 747
727/** 748/**
749 * Set an option of type 'char *' from the command line.
750 * A pointer to this function should be passed as part of the
751 * 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options
752 * of this type. It should be followed by a pointer to a value of
753 * type 'char *'.
754 *
755 * @param ctx command line processing context
756 * @param scls additional closure (will point to the 'char *',
757 * which will be allocated)
758 * @param option name of the option
759 * @param value actual value of the option (a string)
760 * @return GNUNET_OK to continue procesing; GNUNET_SYSERR to signal error
761 */
762int
763set_topology (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
764 void *scls, const char *option, const char *value)
765{
766 enum GNUNET_TESTBED_TopologyOption *val = scls;
767
768 if (0 == strncasecmp ("CLIQUE", value, strlen ("CLIQUE")))
769 {
770 *val = GNUNET_TESTBED_TOPOLOGY_CLIQUE;
771 return GNUNET_OK;
772 }
773 if (0 == strncasecmp ("RANDOM", value, strlen ("RANDOM")))
774 {
775 *val = GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI;
776 return GNUNET_OK;
777 }
778 FPRINTF (stderr, _("Only `CLIQUE' and `RANDOM' are permitted"));
779 return GNUNET_SYSERR;
780}
781
782
783/**
728 * Main function. 784 * Main function.
729 * 785 *
730 * @return 0 on success 786 * @return 0 on success
@@ -742,10 +798,16 @@ main (int argc, char *const *argv)
742 { 'e', "num-errors", "COUNT", 798 { 'e', "num-errors", "COUNT",
743 gettext_noop ("tolerate COUNT number of continious timeout failures"), 799 gettext_noop ("tolerate COUNT number of continious timeout failures"),
744 GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails }, 800 GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails },
801 { 't', "topology", "TOPOLOGY",
802 gettext_noop ("Try to acheive TOPOLOGY. This options takes either CLIQUE "
803 "or RANDOM. For CLIQUE the parameter -n is ignored. The "
804 "default is to acheive a random graph topology."),
805 GNUNET_YES, &GNUNET_GETOPT_set_string, &topology },
745 GNUNET_GETOPT_OPTION_END 806 GNUNET_GETOPT_OPTION_END
746 }; 807 };
747 int ret; 808 int ret;
748 809
810 topology = GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI;
749 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 811 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
750 return 2; 812 return 2;
751 813