diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-01-25 15:28:08 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-01-25 15:28:08 +0000 |
commit | 30c5c323f28ade8a1e7c6c593778793e44accb3a (patch) | |
tree | 845955ec895d221338b44f0cadce7932932e78cc /src/testbed/gnunet-testbed-profiler.c | |
parent | 43d558efd13a3245e65efd0acdc9c4ba59cd2bee (diff) | |
download | gnunet-30c5c323f28ade8a1e7c6c593778793e44accb3a.tar.gz gnunet-30c5c323f28ade8a1e7c6c593778793e44accb3a.zip |
- indent
Diffstat (limited to 'src/testbed/gnunet-testbed-profiler.c')
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index e5282a5e0..ebb82dfcf 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -21,7 +21,7 @@ | |||
21 | /** | 21 | /** |
22 | * @file testbed/gnunet-testbed-profiler.c | 22 | * @file testbed/gnunet-testbed-profiler.c |
23 | * @brief Profiling driver for the testbed. | 23 | * @brief Profiling driver for the testbed. |
24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> | 24 | * @author Sree Harsha Totakura <sreeharsha@totakura.in> |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "platform.h" | 27 | #include "platform.h" |
@@ -107,7 +107,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
107 | GNUNET_SCHEDULER_cancel (abort_task); | 107 | GNUNET_SCHEDULER_cancel (abort_task); |
108 | if (NULL != cfg) | 108 | if (NULL != cfg) |
109 | GNUNET_CONFIGURATION_destroy (cfg); | 109 | GNUNET_CONFIGURATION_destroy (cfg); |
110 | GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */ | 110 | GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */ |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
@@ -168,7 +168,7 @@ controller_event_cb (void *cls, | |||
168 | if (++cont_fails > num_cont_fails) | 168 | if (++cont_fails > num_cont_fails) |
169 | { | 169 | { |
170 | printf ("\nAborting due to very high failure rate\n"); | 170 | printf ("\nAborting due to very high failure rate\n"); |
171 | print_overlay_links_summary (); | 171 | print_overlay_links_summary (); |
172 | GNUNET_SCHEDULER_cancel (abort_task); | 172 | GNUNET_SCHEDULER_cancel (abort_task); |
173 | abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); | 173 | abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); |
174 | return; | 174 | return; |
@@ -176,15 +176,15 @@ controller_event_cb (void *cls, | |||
176 | } | 176 | } |
177 | break; | 177 | break; |
178 | case GNUNET_TESTBED_ET_CONNECT: | 178 | case GNUNET_TESTBED_ET_CONNECT: |
179 | { | 179 | { |
180 | if (0 != cont_fails) | 180 | if (0 != cont_fails) |
181 | cont_fails--; | 181 | cont_fails--; |
182 | if (0 == established_links) | 182 | if (0 == established_links) |
183 | printf ("Establishing links. Please wait\n"); | 183 | printf ("Establishing links. Please wait\n"); |
184 | printf ("."); | 184 | printf ("."); |
185 | fflush (stdout); | 185 | fflush (stdout); |
186 | established_links++; | 186 | established_links++; |
187 | } | 187 | } |
188 | break; | 188 | break; |
189 | default: | 189 | default: |
190 | GNUNET_break (0); | 190 | GNUNET_break (0); |
@@ -199,9 +199,8 @@ controller_event_cb (void *cls, | |||
199 | * @param num_peers number of peers in 'peers' | 199 | * @param num_peers number of peers in 'peers' |
200 | * @param peers handle to peers run in the testbed | 200 | * @param peers handle to peers run in the testbed |
201 | */ | 201 | */ |
202 | static void test_run (void *cls, | 202 | static void |
203 | unsigned int num_peers, | 203 | test_run (void *cls, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers) |
204 | struct GNUNET_TESTBED_Peer **peers) | ||
205 | { | 204 | { |
206 | result = GNUNET_OK; | 205 | result = GNUNET_OK; |
207 | fprintf (stdout, "\n"); | 206 | fprintf (stdout, "\n"); |
@@ -241,13 +240,10 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
241 | event_mask = 0; | 240 | event_mask = 0; |
242 | event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); | 241 | event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); |
243 | event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); | 242 | event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); |
244 | GNUNET_TESTBED_run (args[0], cfg, | 243 | GNUNET_TESTBED_run (args[0], cfg, num_peers, event_mask, controller_event_cb, |
245 | num_peers, event_mask, | 244 | NULL, &test_run, NULL); |
246 | controller_event_cb, NULL, | ||
247 | &test_run, NULL); | ||
248 | abort_task = | 245 | abort_task = |
249 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 246 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &do_abort, |
250 | &do_abort, | ||
251 | NULL); | 247 | NULL); |
252 | } | 248 | } |
253 | 249 | ||
@@ -261,24 +257,24 @@ int | |||
261 | main (int argc, char *const *argv) | 257 | main (int argc, char *const *argv) |
262 | { | 258 | { |
263 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 259 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
264 | { 'p', "num-peers", "COUNT", | 260 | {'p', "num-peers", "COUNT", |
265 | gettext_noop ("create COUNT number of peers"), | 261 | gettext_noop ("create COUNT number of peers"), |
266 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_peers }, | 262 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_peers}, |
267 | { 'e', "num-errors", "COUNT", | 263 | {'e', "num-errors", "COUNT", |
268 | gettext_noop ("tolerate COUNT number of continious timeout failures"), | 264 | gettext_noop ("tolerate COUNT number of continious timeout failures"), |
269 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails }, | 265 | GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails}, |
270 | GNUNET_GETOPT_OPTION_END | 266 | GNUNET_GETOPT_OPTION_END |
271 | }; | 267 | }; |
272 | int ret; | 268 | int ret; |
273 | 269 | ||
274 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 270 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
275 | return 2; | 271 | return 2; |
276 | result = GNUNET_SYSERR; | 272 | result = GNUNET_SYSERR; |
277 | ret = | 273 | ret = |
278 | GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler [OPTIONS] hosts-file", | 274 | GNUNET_PROGRAM_run (argc, argv, |
279 | _("Profiler for testbed"), | 275 | "gnunet-testbed-profiler [OPTIONS] hosts-file", |
280 | options, &run, NULL); | 276 | _("Profiler for testbed"), options, &run, NULL); |
281 | GNUNET_free ((void*) argv); | 277 | GNUNET_free ((void *) argv); |
282 | if (GNUNET_OK != ret) | 278 | if (GNUNET_OK != ret) |
283 | return ret; | 279 | return ret; |
284 | if (GNUNET_OK != result) | 280 | if (GNUNET_OK != result) |