don't break unless debugging
[oweals/gnunet.git] / src / nse / nse-profiler.c
1 /*
2      This file is part of GNUnet.
3      (C) 2011 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  * @file nse/nse-profiler.c
22  *
23  * @brief Profiling driver for the network size estimation service.
24  *        Generally, the profiler starts a given number of peers,
25  *        then churns some off, waits a certain amount of time, then
26  *        churns again, and repeats.
27  */
28 #include "platform.h"
29 #include "gnunet_testing_lib.h"
30 #include "gnunet_nse_service.h"
31
32 #define VERBOSE GNUNET_NO
33
34 struct NSEPeer
35 {
36   struct NSEPeer *prev;
37
38   struct NSEPeer *next;
39
40   struct GNUNET_TESTING_Daemon *daemon;
41
42   struct GNUNET_NSE_Handle *nse_handle;
43 };
44
45 struct StatsContext
46 {
47   GNUNET_SCHEDULER_Task task;
48   GNUNET_SCHEDULER_TaskIdentifier *task_id;
49   void *task_cls;
50   unsigned long long total_nse_bytes;
51 };
52
53 static struct NSEPeer *peer_head;
54
55 static struct NSEPeer *peer_tail;
56
57 /**
58  * How long until we give up on connecting the peers?
59  */
60 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1500)
61
62 static int ok;
63
64 /**
65  * Be verbose
66  */
67 static int verbose;
68
69 /**
70  * Total number of peers in the test.
71  */
72 static unsigned long long num_peers;
73
74 /**
75  * Global configuration file
76  */
77 static struct GNUNET_CONFIGURATION_Handle *testing_cfg;
78
79 /**
80  * Total number of currently running peers.
81  */
82 static unsigned long long peers_running;
83
84 /**
85  * Current round we are in.
86  */
87 static unsigned long long current_round;
88
89 /**
90  * Peers desired in the next round.
91  */
92 static unsigned long long peers_next_round;
93
94 /**
95  * Maximum number of connections to NSE services.
96  */
97 static unsigned long long connection_limit;
98
99 /**
100  * Total number of connections in the whole network.
101  */
102 static unsigned int total_connections;
103
104 /**
105  * The currently running peer group.
106  */
107 static struct GNUNET_TESTING_PeerGroup *pg;
108
109 /**
110  * File to report results to.
111  */
112 static struct GNUNET_DISK_FileHandle *output_file;
113
114 /**
115  * File to log connection info, statistics to.
116  */
117 static struct GNUNET_DISK_FileHandle *data_file;
118
119 /**
120  * How many data points to capture before triggering next round?
121  */
122 static struct GNUNET_TIME_Relative wait_time;
123
124 /**
125  * Task called to disconnect peers.
126  */
127 static GNUNET_SCHEDULER_TaskIdentifier disconnect_task;
128
129 /**
130  * Task called to shutdown test.
131  */
132 static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle;
133
134 /**
135  * Task used to churn the network.
136  */
137 static GNUNET_SCHEDULER_TaskIdentifier churn_task;
138
139 static char *topology_file;
140
141 static char *data_filename;
142
143 static uint64_t clock_skew;
144
145 /**
146  * Check whether peers successfully shut down.
147  */
148 static void
149 shutdown_callback (void *cls, const char *emsg)
150 {
151   if (emsg != NULL)
152     {
153 #if VERBOSE
154       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n");
155 #endif
156       if (ok == 0)
157         ok = 666;
158     }
159   else
160     {
161 #if VERBOSE
162       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
163                   "All peers successfully shut down!\n");
164 #endif
165       ok = 0;
166     }
167 }
168
169 static void
170 shutdown_task (void *cls,
171                const struct GNUNET_SCHEDULER_TaskContext *tc)
172 {
173   struct NSEPeer *pos;
174 #if VERBOSE
175   fprintf(stderr, "Ending test.\n");
176 #endif
177
178   if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
179     {
180       GNUNET_SCHEDULER_cancel(disconnect_task);
181       disconnect_task = GNUNET_SCHEDULER_NO_TASK;
182     }
183   while (NULL != (pos = peer_head))
184     {
185       if (pos->nse_handle != NULL)
186         GNUNET_NSE_disconnect(pos->nse_handle);
187       GNUNET_CONTAINER_DLL_remove(peer_head, peer_tail, pos);
188       GNUNET_free(pos);
189     }
190
191   if (data_file != NULL)
192     GNUNET_DISK_file_close(data_file);
193   GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
194 }
195
196 /**
197  * Callback to call when network size estimate is updated.
198  *
199  * @param cls closure
200  * @param timestamp server timestamp
201  * @param estimate the value of the current network size estimate
202  * @param std_dev standard deviation (rounded down to nearest integer)
203  *                of the size estimation values seen
204  *
205  */
206 static void
207 handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, double estimate, double std_dev)
208 {
209   struct NSEPeer *peer = cls;
210   char *output_buffer;
211   size_t size;
212
213   if (output_file != NULL)
214     {
215       size = GNUNET_asprintf(&output_buffer, 
216                              "%s %u %llu %f %f %f\n",
217                              GNUNET_i2s(&peer->daemon->id),
218                              peers_running,
219                              timestamp.abs_value,
220                              pow(2, estimate),
221                              estimate, 
222                              std_dev);
223       if (size != GNUNET_DISK_file_write(output_file, output_buffer, size))
224         GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 
225                    "Unable to write to file!\n");
226       GNUNET_free (output_buffer);
227     }
228   else
229     fprintf(stderr,
230             "Received network size estimate from peer %s. Size: %f std.dev. %f\n", 
231             GNUNET_i2s(&peer->daemon->id),
232             estimate,
233             std_dev);
234
235 }
236
237 static void
238 connect_nse_service (void *cls,
239                      const struct GNUNET_SCHEDULER_TaskContext *tc)
240 {
241   struct NSEPeer *current_peer;
242   unsigned int i;
243
244 #if VERBOSE
245   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
246               "Connecting to nse service of peers\n");
247 #endif
248   for (i = 0; i < num_peers; i++)
249     {
250       if ((connection_limit > 0) && (i % (num_peers / connection_limit) != 0))
251         continue;
252 #if VERBOSE
253       GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "nse-profiler: connecting to nse service of peer %d\n", i);
254 #endif
255       current_peer = GNUNET_malloc(sizeof(struct NSEPeer));
256       current_peer->daemon = GNUNET_TESTING_daemon_get(pg, i);
257       if (GNUNET_YES == GNUNET_TESTING_daemon_running(GNUNET_TESTING_daemon_get(pg, i)))
258         {
259           current_peer->nse_handle = GNUNET_NSE_connect (current_peer->daemon->cfg,
260                                                          &handle_estimate, 
261                                                          current_peer);
262           GNUNET_assert(current_peer->nse_handle != NULL);
263         }
264       GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, current_peer);
265     }
266 }
267
268
269 static void
270 churn_peers (void *cls,
271              const struct GNUNET_SCHEDULER_TaskContext *tc);
272
273
274 /**
275  * Continuation called by the "get_all" and "get" functions.
276  *
277  * @param cls struct StatsContext
278  * @param success GNUNET_OK if statistics were
279  *        successfully obtained, GNUNET_SYSERR if not.
280  */
281 static void 
282 stats_finished_callback (void *cls, int success)
283 {
284   struct StatsContext *stats_context = (struct StatsContext *)cls;
285   char *buf;
286   int buf_len;
287
288   if ((GNUNET_OK == success) && (data_file != NULL)) /* Stats lookup successful, write out data */
289     {
290       buf = NULL;
291       buf_len = GNUNET_asprintf(&buf,
292                                 "TOTAL_NSE_BYTES: %u\n", 
293                                 stats_context->total_nse_bytes);
294       if (buf_len > 0)
295         {
296           GNUNET_DISK_file_write(data_file, buf, buf_len);
297         }
298       GNUNET_free_non_null(buf);
299     }
300
301   if (stats_context->task != NULL)
302     *stats_context->task_id = GNUNET_SCHEDULER_add_now(stats_context->task,
303                                                        stats_context->task_cls);
304   GNUNET_free(stats_context);
305 }
306
307
308 /**
309  * Callback function to process statistic values.
310  *
311  * @param cls struct StatsContext
312  * @param peer the peer the statistics belong to
313  * @param subsystem name of subsystem that created the statistic
314  * @param name the name of the datum
315  * @param value the current value
316  * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
317  * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
318  */
319 static int 
320 statistics_iterator (void *cls,
321                      const struct GNUNET_PeerIdentity *peer,
322                      const char *subsystem,
323                      const char *name,
324                      uint64_t value,
325                      int is_persistent)
326 {
327   struct StatsContext *stats_context = cls;
328
329   if ((0 == strstr(subsystem, "nse")) && (0 == strstr(name, "# flood messages received")))
330     {
331       stats_context->total_nse_bytes += value;
332     }
333
334   return GNUNET_OK;
335 }
336
337
338 /**
339  * @param cls struct StatsContext
340  * @param tc task context
341  */
342 static void
343 get_statistics (void *cls,
344                 const struct GNUNET_SCHEDULER_TaskContext *tc)
345 {
346   struct StatsContext *stats_context = cls;
347
348   GNUNET_TESTING_get_statistics(pg, 
349                                 &stats_finished_callback, 
350                                 &statistics_iterator, 
351                                 stats_context);
352 }
353
354
355 static void
356 disconnect_nse_peers (void *cls,
357                       const struct GNUNET_SCHEDULER_TaskContext *tc)
358 {
359   struct NSEPeer *pos;
360   char *buf;
361   struct StatsContext *stats_context;
362   disconnect_task = GNUNET_SCHEDULER_NO_TASK;
363   pos = peer_head;
364
365   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
366               "disconnecting nse service of peers\n");
367   while (NULL != (pos = peer_head))
368     {
369       if (pos->nse_handle != NULL)
370         {
371           GNUNET_NSE_disconnect(pos->nse_handle);
372           pos->nse_handle = NULL;
373         }
374       GNUNET_CONTAINER_DLL_remove(peer_head, peer_tail, pos);
375       GNUNET_free(pos);
376     }
377
378   GNUNET_asprintf(&buf, 
379                   "round%llu", 
380                   current_round);
381   if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (testing_cfg, 
382                                                           "nse-profiler",
383                                                           buf, 
384                                                           &peers_next_round))
385     {
386       current_round++;
387       GNUNET_assert(churn_task == GNUNET_SCHEDULER_NO_TASK);
388       churn_task = GNUNET_SCHEDULER_add_now(&churn_peers, NULL);
389     }
390   else /* No more rounds, let's shut it down! */
391     {
392       stats_context = GNUNET_malloc(sizeof(struct StatsContext));
393       GNUNET_SCHEDULER_cancel(shutdown_handle);
394       shutdown_handle = GNUNET_SCHEDULER_NO_TASK;
395       stats_context->task = &shutdown_task;
396       stats_context->task_cls = NULL;
397       stats_context->task_id = &shutdown_handle;
398       GNUNET_SCHEDULER_add_now(&get_statistics, stats_context);
399       //shutdown_handle = GNUNET_SCHEDULER_add_now(&shutdown_task, NULL);
400     }
401   GNUNET_free(buf);
402 }
403
404
405 /**
406  * Prototype of a function that will be called when a
407  * particular operation was completed the testing library.
408  *
409  * @param cls unused
410  * @param emsg NULL on success
411  */
412 static void 
413 topology_output_callback (void *cls, const char *emsg)
414 {
415   struct StatsContext *stats_context;
416   stats_context = GNUNET_malloc(sizeof(struct StatsContext));
417
418   disconnect_task = GNUNET_SCHEDULER_add_delayed(wait_time, &disconnect_nse_peers, NULL);
419   GNUNET_SCHEDULER_add_now(&connect_nse_service, NULL);
420 }
421
422
423 /**
424  * Prototype of a function that will be called when a
425  * particular operation was completed the testing library.
426  *
427  * @param cls closure
428  * @param emsg NULL on success
429  */
430 static void
431 churn_callback (void *cls, const char *emsg)
432 {
433   char *temp_output_file;
434
435   if (emsg == NULL) /* Everything is okay! */
436     {
437       peers_running = peers_next_round;
438       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
439                   "Round %lu, churn finished successfully.\n",
440                   current_round);
441       GNUNET_assert(disconnect_task == GNUNET_SCHEDULER_NO_TASK);
442       GNUNET_asprintf(&temp_output_file, 
443                       "%s_%lu.dot",
444                       topology_file, 
445                       current_round);
446       GNUNET_TESTING_peergroup_topology_to_file(pg,
447                                                 temp_output_file,
448                                                 &topology_output_callback,
449                                                 NULL);
450       GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
451                  "Writing topology to file %s\n",
452                  temp_output_file);
453       GNUNET_free(temp_output_file);
454     }
455   else
456     {
457       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
458                   "Round %lu, churn FAILED!!\n",
459                   current_round);
460       GNUNET_SCHEDULER_cancel(shutdown_handle);
461       GNUNET_SCHEDULER_add_now(&shutdown_task, NULL);
462     }
463 }
464
465
466 static void
467 churn_peers (void *cls,
468              const struct GNUNET_SCHEDULER_TaskContext *tc)
469 {
470   /* peers_running = GNUNET_TESTING_daemons_running(pg); */
471   churn_task = GNUNET_SCHEDULER_NO_TASK;
472   if (peers_next_round == peers_running)
473     {
474       /* Nothing to do... */
475       GNUNET_SCHEDULER_add_now(&connect_nse_service, NULL);
476       GNUNET_assert(disconnect_task == GNUNET_SCHEDULER_NO_TASK);
477       disconnect_task = GNUNET_SCHEDULER_add_delayed(wait_time, 
478                                                      &disconnect_nse_peers, NULL);
479       GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
480                  "Round %lu, doing nothing!\n", 
481                  current_round);
482     }
483   else
484     {
485       if (peers_next_round > num_peers)
486         {
487           GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 
488                      "Asked to turn on more peers than we have!!\n");
489           GNUNET_SCHEDULER_cancel(shutdown_handle);
490           GNUNET_SCHEDULER_add_now(&shutdown_task, NULL);
491         }
492       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
493                   "Round %lu, turning off %lu peers, turning on %lu peers!\n",
494                   current_round,
495                   (peers_running > peers_next_round) ? peers_running
496                       - peers_next_round : 0,
497                   (peers_next_round > peers_running) ? peers_next_round
498                       - peers_running : 0);
499       GNUNET_TESTING_daemons_churn (pg, "nse",
500                                     (peers_running > peers_next_round) ? peers_running
501                                         - peers_next_round
502                                         : 0,
503                                     (peers_next_round > peers_running) ? peers_next_round
504                                         - peers_running
505                                         : 0, wait_time, &churn_callback,
506                                     NULL);
507     }
508 }
509
510
511 static void
512 nse_started_cb(void *cls, const char *emsg)
513 {
514   GNUNET_SCHEDULER_add_now(&connect_nse_service, NULL);
515   disconnect_task = GNUNET_SCHEDULER_add_delayed(wait_time, &disconnect_nse_peers, NULL);
516 }
517
518 static void
519 my_cb (void *cls,
520        const char *emsg)
521 {
522   char *buf;
523   int buf_len;
524   if (emsg != NULL)
525     {
526       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
527                   "Peergroup callback called with error, aborting test!\n");
528       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error from testing: `%s'\n");
529       ok = 1;
530       GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
531       return;
532     }
533 #if VERBOSE
534   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
535               "Peer Group started successfully, connecting to NSE service for each peer!\n");
536 #endif
537   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
538               "Have %u connections\n", total_connections);
539   if (data_file != NULL)
540     {
541       buf = NULL;
542       buf_len = GNUNET_asprintf(&buf, 
543                                 "CONNECTIONS_0: %u\n",
544                                 total_connections);
545       if (buf_len > 0)
546         GNUNET_DISK_file_write(data_file, buf, buf_len);
547       GNUNET_free (buf);
548     }
549   peers_running = GNUNET_TESTING_daemons_running(pg);
550   GNUNET_TESTING_daemons_start_service (pg,
551                                         "nse",
552                                         wait_time,
553                                         &nse_started_cb,
554                                         NULL);
555
556 }
557
558 /**
559  * Function that will be called whenever two daemons are connected by
560  * the testing library.
561  *
562  * @param cls closure
563  * @param first peer id for first daemon
564  * @param second peer id for the second daemon
565  * @param distance distance between the connected peers
566  * @param first_cfg config for the first daemon
567  * @param second_cfg config for the second daemon
568  * @param first_daemon handle for the first daemon
569  * @param second_daemon handle for the second daemon
570  * @param emsg error message (NULL on success)
571  */
572 static void 
573 connect_cb (void *cls,
574             const struct GNUNET_PeerIdentity *first,
575             const struct GNUNET_PeerIdentity *second,
576             uint32_t distance,
577             const struct GNUNET_CONFIGURATION_Handle *first_cfg,
578             const struct GNUNET_CONFIGURATION_Handle *second_cfg,
579             struct GNUNET_TESTING_Daemon *first_daemon,
580             struct GNUNET_TESTING_Daemon *second_daemon,
581             const char *emsg)
582 {
583   if (emsg == NULL)
584     total_connections++;
585 }
586
587
588 static void
589 run (void *cls,
590      char *const *args,
591      const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
592 {
593   char *temp_str;
594   unsigned long long temp_wait;
595   struct GNUNET_TESTING_Host *hosts;
596
597   ok = 1;
598   testing_cfg = GNUNET_CONFIGURATION_create();
599   GNUNET_assert(GNUNET_OK == GNUNET_CONFIGURATION_load(testing_cfg, cfgfile));
600 #if VERBOSE
601   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting daemons.\n");
602   GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
603                                            "use_progressbars",
604                                            "YES");
605 #endif
606   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (testing_cfg, 
607                                                           "testing",
608                                                           "num_peers", &num_peers))
609     {
610       GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Option TESTING:NUM_PEERS is required!\n");
611       return;
612     }
613
614   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (testing_cfg, 
615                                                           "nse-profiler", 
616                                                           "wait_time",
617                                                           &temp_wait))
618     {
619       GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 
620                  "Option nse-profiler:wait_time is required!\n");
621       return;
622     }
623
624   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (testing_cfg, 
625                                                           "nse-profiler", "connection_limit",
626                                                           &connection_limit))
627     {
628       connection_limit = 0;
629     }
630
631   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (testing_cfg, 
632                                                           "nse-profiler", "topology_output_file", 
633                                                           &topology_file))
634     {
635       GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 
636                  "Option nse-profiler:topology_output_file is required!\n");
637       return;
638     }
639
640   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (testing_cfg, 
641                                                           "nse-profiler", "data_output_file",
642                                                           &data_filename))
643     {
644       GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 
645                  "Option nse-profiler:data_output_file is required!\n");
646       return;
647     }
648
649   if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (testing_cfg, 
650                                                           "nse-profiler", 
651                                                           "skew_clock"))
652     {
653       GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
654                  "Setting our clock as skewed...\n");
655       clock_skew = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK, 
656                                             GNUNET_TIME_UNIT_MINUTES.rel_value);
657     }
658
659
660   data_file = GNUNET_DISK_file_open (data_filename,
661                                      GNUNET_DISK_OPEN_READWRITE
662                                      | GNUNET_DISK_OPEN_CREATE,
663                                      GNUNET_DISK_PERM_USER_READ |
664                                      GNUNET_DISK_PERM_USER_WRITE);
665   if (data_file == NULL)
666     GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 
667                "Failed to open %s for output!\n", 
668                data_filename);
669   GNUNET_free(data_filename);
670
671   wait_time = GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, temp_wait);
672
673   if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string(cfg,
674                                                           "nse-profiler", 
675                                                           "output_file",
676                                                           &temp_str))
677     {
678       output_file = GNUNET_DISK_file_open (temp_str, GNUNET_DISK_OPEN_READWRITE
679                                                       | GNUNET_DISK_OPEN_CREATE,
680                                                       GNUNET_DISK_PERM_USER_READ |
681                                                       GNUNET_DISK_PERM_USER_WRITE);
682       if (output_file == NULL)
683         GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 
684                    "Failed to open %s for output!\n",
685                    temp_str);
686     }
687   GNUNET_free_non_null(temp_str);
688
689   hosts = GNUNET_TESTING_hosts_load (testing_cfg);
690
691   pg = GNUNET_TESTING_peergroup_start(testing_cfg,
692                                       num_peers,
693                                       TIMEOUT,
694                                       &connect_cb,
695                                       &my_cb, NULL,
696                                       hosts);
697   GNUNET_assert (pg != NULL);
698   shutdown_handle = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever(),
699                                                   &shutdown_task,
700                                                   NULL);
701 }
702
703
704
705 /**
706  * nse-profiler command line options
707  */
708 static struct GNUNET_GETOPT_CommandLineOption options[] = {
709   {'V', "verbose", NULL,
710    gettext_noop ("be verbose (print progress information)"),
711    0, &GNUNET_GETOPT_set_one, &verbose},
712   GNUNET_GETOPT_OPTION_END
713 };
714
715
716 int
717 main (int argc, char *argv[])
718 {
719   int ret;
720
721   GNUNET_log_setup ("nse-profiler",
722 #if VERBOSE
723                     "DEBUG",
724 #else
725                     "WARNING",
726 #endif
727                     NULL);
728   ret = 1;
729   GNUNET_PROGRAM_run (argc,
730                       argv, "nse-profiler", gettext_noop
731                       ("Run a test of the NSE service."),
732                       options, &run, &ok);
733 #if REMOVE_DIR
734   GNUNET_DISK_directory_remove ("/tmp/nse-profiler");
735 #endif
736   return ret;
737 }
738
739 /* end of nse-profiler.c */