disable auto retry
[oweals/gnunet.git] / src / testbed / gnunet-testbed-profiler.c
1 /*
2      This file is part of GNUnet.
3      (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file testbed/gnunet-testbed-profiler.c
23  * @brief Profiling driver for the testbed.
24  * @author Sree Harsha Totakura <sreeharsha@totakura.in> 
25  */
26
27 #include "platform.h"
28 #include "gnunet_common.h"
29 #include "gnunet_testbed_service.h"
30 #include "testbed_api_hosts.h"
31
32 /**
33  * Generic loggins shorthand
34  */
35 #define LOG(kind,...)                                           \
36   GNUNET_log (kind, __VA_ARGS__)
37
38
39 /**
40  * DLL of operations
41  */
42 struct DLLOperation
43 {
44   /**
45    * The testbed operation handle
46    */
47   struct GNUNET_TESTBED_Operation *op;
48
49   /**
50    * Closure
51    */
52   void *cls;
53
54   /**
55    * The next pointer for DLL
56    */
57   struct DLLOperation *next;
58
59   /**
60    * The prev pointer for DLL
61    */
62   struct DLLOperation *prev;
63 };
64
65
66 /**
67  * Availanle states during profiling
68  */
69 enum State
70 {
71   /**
72    * Initial state
73    */
74   STATE_INIT = 0,
75
76   /**
77    * Starting slaves
78    */
79   STATE_SLAVES_STARTING,
80
81   /**
82    * Creating peers
83    */
84   STATE_PEERS_CREATING,
85
86   /**
87    * Starting peers
88    */
89   STATE_PEERS_STARTING,
90
91   /**
92    * Linking peers
93    */
94   STATE_PEERS_LINKING,
95
96   /**
97    * Destroying peers; we can do this as the controller takes care of stopping a
98    * peer if it is running
99    */
100   STATE_PEERS_DESTROYING
101 };
102
103
104 /**
105  * An array of hosts loaded from the hostkeys file
106  */
107 static struct GNUNET_TESTBED_Host **hosts;
108
109 /**
110  * The array of peers; we fill this as the peers are given to us by the testbed
111  */
112 static struct GNUNET_TESTBED_Peer **peers;
113
114 /* /\** */
115 /*  * Operation handle */
116 /*  *\/ */
117 /* static struct GNUNET_TESTBED_Operation *op; */
118
119 /**
120  * Host registration handle
121  */
122 static struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle;
123
124 /**
125  * Handle to the master controller process
126  */
127 struct GNUNET_TESTBED_ControllerProc *mc_proc;
128
129 /**
130  * Handle to the master controller
131  */
132 struct GNUNET_TESTBED_Controller *mc;
133
134 /**
135  * Handle to global configuration
136  */
137 struct GNUNET_CONFIGURATION_Handle *cfg;
138
139 /**
140  * Head of the operations list
141  */
142 struct DLLOperation *dll_op_head;
143
144 /**
145  * Tail of the operations list
146  */
147 struct DLLOperation *dll_op_tail;
148
149 /**
150  * Peer linking - topology operation
151  */
152 struct GNUNET_TESTBED_Operation *topology_op;
153
154 /**
155  * Abort task identifier
156  */
157 static GNUNET_SCHEDULER_TaskIdentifier abort_task;
158
159 /**
160  * Shutdown task identifier
161  */
162 static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
163
164 /**
165  * Host registration task identifier
166  */
167 static GNUNET_SCHEDULER_TaskIdentifier register_hosts_task;
168
169 /**
170  * Global event mask for all testbed events
171  */
172 uint64_t event_mask;
173
174 /**
175  * The starting time of a profiling step
176  */
177 struct GNUNET_TIME_Absolute prof_start_time;
178
179 /**
180  * Duration profiling step has taken
181  */
182 struct GNUNET_TIME_Relative prof_time;
183
184 /**
185  * Current peer id
186  */
187 unsigned int peer_id;
188
189 /**
190  * Number of peers to be started by the profiler
191  */
192 static unsigned int num_peers;
193
194 /**
195  * Number of hosts in the hosts array
196  */
197 static unsigned int num_hosts;
198
199 /**
200  * Number of random links to be established between peers
201  */
202 static unsigned int num_links;
203
204 /**
205  * Number of timeout failures to tolerate
206  */
207 static unsigned int num_cont_fails;
208
209 /**
210  * Continuous failures during overlay connect operations
211  */
212 static unsigned int cont_fails;
213
214 /**
215  * Links which are successfully established
216  */
217 static unsigned int established_links;
218
219 /**
220  * Links which are not successfully established
221  */
222 static unsigned int failed_links;
223
224 /**
225  * Global testing status
226  */
227 static int result;
228
229 /**
230  * current state of profiling
231  */
232 enum State state;
233
234
235 /**
236  * Shutdown nicely
237  *
238  * @param cls NULL
239  * @param tc the task context
240  */
241 static void
242 do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
243 {
244   struct DLLOperation *dll_op;
245   unsigned int nhost;
246
247   shutdown_task = GNUNET_SCHEDULER_NO_TASK;
248   if (GNUNET_SCHEDULER_NO_TASK != abort_task)
249     GNUNET_SCHEDULER_cancel (abort_task);
250   if (GNUNET_SCHEDULER_NO_TASK != register_hosts_task)
251     GNUNET_SCHEDULER_cancel (register_hosts_task);
252   if (NULL != reg_handle)
253     GNUNET_TESTBED_cancel_registration (reg_handle);
254   if (NULL != topology_op)
255     GNUNET_TESTBED_operation_cancel (topology_op);
256   for (nhost = 0; nhost < num_hosts; nhost++)
257     if (NULL != hosts[nhost])
258       GNUNET_TESTBED_host_destroy (hosts[nhost]);
259   GNUNET_free_non_null (hosts);
260   while (NULL != (dll_op = dll_op_head))
261   {
262     GNUNET_TESTBED_operation_cancel (dll_op->op);
263     GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
264     GNUNET_free (dll_op);
265   }
266   if (NULL != mc)
267     GNUNET_TESTBED_controller_disconnect (mc);
268   if (NULL != mc_proc)
269     GNUNET_TESTBED_controller_stop (mc_proc);
270   if (NULL != cfg)
271     GNUNET_CONFIGURATION_destroy (cfg);
272   GNUNET_SCHEDULER_shutdown (); /* Stop scheduler to shutdown testbed run */
273 }
274
275
276 /**
277  * abort task to run on test timed out
278  *
279  * @param cls NULL
280  * @param tc the task context
281  */
282 static void
283 do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
284 {
285   LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
286   abort_task = GNUNET_SCHEDULER_NO_TASK;
287   result = GNUNET_SYSERR;
288   if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
289     GNUNET_SCHEDULER_cancel (shutdown_task);
290   shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
291 }
292
293
294
295
296
297 /**
298  * Functions of this signature are called when a peer has been successfully
299  * started or stopped.
300  *
301  * @param cls the closure from GNUNET_TESTBED_peer_start/stop()
302  * @param emsg NULL on success; otherwise an error description
303  */
304 static void 
305 peer_churn_cb (void *cls, const char *emsg)
306 {
307   struct DLLOperation *dll_op = cls;
308   struct GNUNET_TESTBED_Operation *op;  
309   static unsigned int started_peers;
310
311   op = dll_op->op;
312   GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
313   GNUNET_free (dll_op);
314   if (NULL != emsg)
315   {
316     LOG (GNUNET_ERROR_TYPE_WARNING,
317          _("An operation has failed while starting peers\n"));
318     GNUNET_TESTBED_operation_done (op);
319     GNUNET_SCHEDULER_cancel (abort_task);
320     abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
321     return;
322   }
323   GNUNET_TESTBED_operation_done (op);
324   if (++started_peers == num_peers)
325   {
326     prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
327     printf ("%u peers started successfully in %.2f seconds\n",
328             num_peers, ((double) prof_time.rel_value) / 1000.00);
329     fflush (stdout);
330     result = GNUNET_OK;
331     if (0 == num_links)
332     {      
333       shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
334       return;
335     }
336     state = STATE_PEERS_LINKING;
337     /* Do overlay connect */
338     prof_start_time = GNUNET_TIME_absolute_get ();
339     topology_op =
340         GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peers,
341                                                    GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
342                                                    num_links,
343                                                    GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY,
344                                                    GNUNET_TESTBED_TOPOLOGY_OPTION_END);
345   }
346 }
347
348
349 /**
350  * Functions of this signature are called when a peer has been successfully
351  * created
352  *
353  * @param cls the closure from GNUNET_TESTBED_peer_create()
354  * @param peer the handle for the created peer; NULL on any error during
355  *          creation
356  * @param emsg NULL if peer is not NULL; else MAY contain the error description
357  */
358 static void 
359 peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
360 {
361   struct DLLOperation *dll_op = cls;
362   struct GNUNET_TESTBED_Peer **peer_ptr;
363   static unsigned int created_peers;
364   unsigned int peer_cnt;
365
366   if (NULL != emsg)
367   {
368     LOG (GNUNET_ERROR_TYPE_WARNING,
369          _("Creating a peer failed. Error: %s\n"), emsg);
370     GNUNET_TESTBED_operation_done (dll_op->op);
371     GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
372     GNUNET_free (dll_op);
373     GNUNET_SCHEDULER_cancel (abort_task);
374     abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
375     return;
376   }
377   peer_ptr = dll_op->cls;
378   GNUNET_assert (NULL == *peer_ptr);
379   *peer_ptr = peer;
380   GNUNET_TESTBED_operation_done (dll_op->op);
381   GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
382   GNUNET_free (dll_op);
383   if (++created_peers == num_peers)
384   {
385     prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);    
386     printf ("%u peers created successfully in %.2f seconds\n",
387             num_peers, ((double) prof_time.rel_value) / 1000.00);
388     fflush (stdout);
389     /* Now peers are to be started */
390     state = STATE_PEERS_STARTING;
391     prof_start_time = GNUNET_TIME_absolute_get ();
392     for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
393     {
394       dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
395       dll_op->op = GNUNET_TESTBED_peer_start (dll_op, peers[peer_cnt], 
396                                               &peer_churn_cb, dll_op);
397       GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op);
398     }
399   }
400 }
401
402
403 /**
404  * Function to print summary about how many overlay links we have made and how
405  * many failed
406  */
407 static void
408 print_overlay_links_summary ()
409 {
410   prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
411   printf ("\n%u links established in %.2f seconds\n",
412           established_links, ((double) prof_time.rel_value) / 1000.00);
413   printf ("%u links failed due to timeouts\n", failed_links);
414 }
415
416
417 /**
418  * Controller event callback
419  *
420  * @param cls NULL
421  * @param event the controller event
422  */
423 static void
424 controller_event_cb (void *cls,
425                      const struct GNUNET_TESTBED_EventInformation *event)
426 {
427   struct DLLOperation *dll_op;
428   struct GNUNET_TESTBED_Operation *op;
429
430   switch (state)
431   {
432   case STATE_SLAVES_STARTING:
433     switch (event->type)
434     {
435     case GNUNET_TESTBED_ET_OPERATION_FINISHED:
436       {
437         static unsigned int slaves_started;
438         unsigned int peer_cnt;
439         
440         dll_op = event->details.operation_finished.op_cls;
441         GNUNET_CONTAINER_DLL_remove (dll_op_head, dll_op_tail, dll_op);
442         GNUNET_free (dll_op);
443         op = event->details.operation_finished.operation;
444         if (NULL != event->details.operation_finished.emsg)
445         {
446           LOG (GNUNET_ERROR_TYPE_WARNING,
447                _("An operation has failed while starting slaves\n"));
448           GNUNET_TESTBED_operation_done (op);
449           GNUNET_SCHEDULER_cancel (abort_task);
450           abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
451           return;
452         }
453         GNUNET_TESTBED_operation_done (op);
454         /* Proceed to start peers */
455         if (++slaves_started == num_hosts - 1)
456         {
457           printf ("%u controllers started successfully\n", num_hosts);
458           fflush (stdout);
459           state = STATE_PEERS_CREATING;
460           prof_start_time = GNUNET_TIME_absolute_get ();
461           peers = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *)
462                                  * num_peers);
463           for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
464           {
465             dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
466             dll_op->cls = &peers[peer_cnt];
467             dll_op->op = GNUNET_TESTBED_peer_create (mc,
468                                                      hosts
469                                                      [peer_cnt % num_hosts],
470                                                      cfg,
471                                                      &peer_create_cb,
472                                                      dll_op);
473             GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op);
474           }
475         }
476       }
477       break;
478     default:
479       GNUNET_assert (0);
480     }
481     break;
482   case STATE_PEERS_STARTING:
483     switch (event->type)
484     {
485     case GNUNET_TESTBED_ET_OPERATION_FINISHED:
486       /* Control reaches here when peer start fails */
487     case GNUNET_TESTBED_ET_PEER_START:
488       /* we handle peer starts in peer_churn_cb */
489       break;
490     default:
491       GNUNET_assert (0);
492     }
493     break;
494   case STATE_PEERS_LINKING:
495    switch (event->type)
496     {
497     case GNUNET_TESTBED_ET_OPERATION_FINISHED:
498       /* Control reaches here when a peer linking operation fails */
499       if (NULL != event->details.operation_finished.emsg)
500       {
501         LOG (GNUNET_ERROR_TYPE_WARNING,
502              _("An operation has failed while linking\n"));
503         printf ("F");
504         fflush (stdout);
505         failed_links++;
506         if (++cont_fails > num_cont_fails)
507         {
508           printf ("\nAborting due to very high failure rate");
509           print_overlay_links_summary ();         
510           GNUNET_SCHEDULER_cancel (abort_task);
511           abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
512         }
513       }
514       break;
515     case GNUNET_TESTBED_ET_CONNECT:
516       {
517         if (0 != cont_fails)
518           cont_fails--;
519         if (0 == established_links)
520           printf ("Establishing links. Please wait\n");
521         printf (".");
522         fflush (stdout);
523         established_links++;
524         if ((established_links + failed_links) == num_links)
525         {
526           print_overlay_links_summary ();
527           result = GNUNET_OK;
528           shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
529         }
530       }
531       break;
532     default:
533       GNUNET_assert (0);
534     }
535     break;
536   default:
537     GNUNET_assert (0);
538   }
539 }
540
541
542 /**
543  * Task to register all hosts available in the global host list
544  *
545  * @param cls NULL
546  * @param tc the scheduler task context
547  */
548 static void
549 register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
550
551
552 /**
553  * Callback which will be called to after a host registration succeeded or failed
554  *
555  * @param cls the closure
556  * @param emsg the error message; NULL if host registration is successful
557  */
558 static void
559 host_registration_completion (void *cls, const char *emsg)
560 {
561   reg_handle = NULL;
562   if (NULL != emsg)
563   {
564     LOG (GNUNET_ERROR_TYPE_WARNING,
565          _("Host registration failed for a host. Error: %s\n"), emsg);
566     GNUNET_SCHEDULER_cancel (abort_task);
567     abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
568     return;
569   }
570   register_hosts_task = GNUNET_SCHEDULER_add_now (&register_hosts, NULL);
571 }
572
573
574 /**
575  * Task to register all hosts available in the global host list
576  *
577  * @param cls NULL
578  * @param tc the scheduler task context
579  */
580 static void
581 register_hosts (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
582 {
583   struct DLLOperation *dll_op;
584   static unsigned int reg_host;
585   unsigned int slave;
586
587   register_hosts_task = GNUNET_SCHEDULER_NO_TASK;  
588   if (reg_host == num_hosts - 1)
589   {
590     LOG (GNUNET_ERROR_TYPE_DEBUG,
591          "All hosts successfully registered\n");
592     /* Start slaves */
593     state = STATE_SLAVES_STARTING;
594     for (slave = 1; slave < num_hosts; slave++)
595     {
596       dll_op = GNUNET_malloc (sizeof (struct DLLOperation));
597       dll_op->op = GNUNET_TESTBED_controller_link (dll_op,
598                                                    mc,
599                                                    hosts[slave],
600                                                    hosts[0],
601                                                    cfg,
602                                                    GNUNET_YES);
603       GNUNET_CONTAINER_DLL_insert_tail (dll_op_head, dll_op_tail, dll_op);
604     }
605     return;
606   }
607   reg_handle = GNUNET_TESTBED_register_host (mc, hosts[++reg_host],
608                                              host_registration_completion,
609                                              NULL);
610 }
611
612
613 /**
614  * Callback to signal successfull startup of the controller process
615  *
616  * @param cls the closure from GNUNET_TESTBED_controller_start()
617  * @param config the configuration with which the controller has been started;
618  *          NULL if status is not GNUNET_OK
619  * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
620  *          GNUNET_TESTBED_controller_stop() shouldn't be called in this case
621  */
622 static void
623 status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int status)
624 {
625   GNUNET_SCHEDULER_cancel (abort_task);
626   if (GNUNET_OK != status)
627   {
628     mc_proc = NULL;
629     abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
630     return;
631   }
632   event_mask = 0;
633   event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START);
634   event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_STOP);
635   event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
636   event_mask |= (1LL << GNUNET_TESTBED_ET_DISCONNECT);
637   event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
638   mc = GNUNET_TESTBED_controller_connect (config, hosts[0], event_mask,
639                                           &controller_event_cb, NULL);
640   if (NULL == mc)
641   {
642     LOG (GNUNET_ERROR_TYPE_WARNING,
643          _("Unable to connect to master controller -- Check config\n"));
644     abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
645     return;
646   }
647   register_hosts_task = GNUNET_SCHEDULER_add_now (&register_hosts, NULL);
648   abort_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
649                                              &do_abort, NULL);
650 }
651
652
653 /**
654  * Main function that will be run by the scheduler.
655  *
656  * @param cls closure
657  * @param args remaining command-line arguments
658  * @param cfgfile name of the configuration file used (for saving, can be NULL!)
659  * @param config configuration
660  */
661 static void
662 run (void *cls, char *const *args, const char *cfgfile,
663      const struct GNUNET_CONFIGURATION_Handle *config)
664 {
665   unsigned int nhost;
666
667   if (NULL == args[0])
668   {
669     fprintf (stderr, _("No hosts-file specified on command line\n"));
670     return;
671   }
672   if (0 == num_peers)
673   {
674     result = GNUNET_OK;
675     return;
676   }
677   num_hosts = GNUNET_TESTBED_hosts_load_from_file (args[0], &hosts);
678   if (0 == num_hosts)
679   {
680     fprintf (stderr, _("No hosts loaded. Need atleast one host\n"));
681     return;
682   }
683   for (nhost = 0; nhost < num_hosts; nhost++)
684   {
685     if (GNUNET_YES != GNUNET_TESTBED_is_host_habitable (hosts[nhost]))
686     {
687       fprintf (stderr, _("Host %s cannot start testbed\n"),
688                GNUNET_TESTBED_host_get_hostname_ (hosts[nhost]));
689       break;
690     }
691   }
692   if (num_hosts != nhost)
693   {
694     fprintf (stderr, _("Exiting\n"));
695     shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
696     return;
697   }
698   cfg = GNUNET_CONFIGURATION_dup (config);
699   mc_proc = 
700       GNUNET_TESTBED_controller_start (GNUNET_TESTBED_host_get_hostname_ 
701                                        (hosts[0]),
702                                        hosts[0],
703                                        cfg,
704                                        status_cb,
705                                        NULL);
706   abort_task =
707       GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
708                                     (GNUNET_TIME_UNIT_SECONDS, 5), &do_abort,
709                                     NULL);
710 }
711
712
713 /**
714  * Main function.
715  *
716  * @return 0 on success
717  */
718 int
719 main (int argc, char *const *argv)
720 {
721   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
722     { 'p', "num-peers", "COUNT",
723       gettext_noop ("create COUNT number of peers"),
724       GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_peers },
725     { 'n', "num-links", "COUNT",
726       gettext_noop ("create COUNT number of random links"),
727       GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_links },
728     { 'e', "num-errors", "COUNT",
729       gettext_noop ("tolerate COUNT number of continious timeout failures"),
730       GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails },
731     GNUNET_GETOPT_OPTION_END
732   };
733   int ret;
734
735   if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
736     return 2;
737   
738   result = GNUNET_SYSERR;
739   ret =
740       GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler [OPTIONS] hosts-file",
741                           _("Profiler for testbed"),
742                           options, &run, NULL);
743   if (GNUNET_OK != ret)
744     return ret;
745   if (GNUNET_OK != result)
746     return 1;
747   return 0;
748 }