diff options
Diffstat (limited to 'src/nse/gnunet-nse-profiler.c')
-rw-r--r-- | src/nse/gnunet-nse-profiler.c | 380 |
1 files changed, 199 insertions, 181 deletions
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index a6b847f3a..12f5f37fb 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c | |||
@@ -36,14 +36,12 @@ | |||
36 | /** | 36 | /** |
37 | * Generic loggins shorthand | 37 | * Generic loggins shorthand |
38 | */ | 38 | */ |
39 | #define LOG(kind,...) \ | 39 | #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) |
40 | GNUNET_log (kind, __VA_ARGS__) | ||
41 | 40 | ||
42 | /** | 41 | /** |
43 | * Debug logging shorthand | 42 | * Debug logging shorthand |
44 | */ | 43 | */ |
45 | #define LOG_DEBUG(...) \ | 44 | #define LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) |
46 | LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) | ||
47 | 45 | ||
48 | 46 | ||
49 | /** | 47 | /** |
@@ -210,7 +208,7 @@ static char *data_filename; | |||
210 | * How long to wait before triggering next round? | 208 | * How long to wait before triggering next round? |
211 | * Default: 60 s. | 209 | * Default: 60 s. |
212 | */ | 210 | */ |
213 | static struct GNUNET_TIME_Relative wait_time = { 60 * 1000 }; | 211 | static struct GNUNET_TIME_Relative wait_time = {60 * 1000}; |
214 | 212 | ||
215 | /** | 213 | /** |
216 | * DLL head for operation list | 214 | * DLL head for operation list |
@@ -300,30 +298,34 @@ shutdown_task (void *cls) | |||
300 | */ | 298 | */ |
301 | static void | 299 | static void |
302 | handle_estimate (void *cls, | 300 | handle_estimate (void *cls, |
303 | struct GNUNET_TIME_Absolute timestamp, | 301 | struct GNUNET_TIME_Absolute timestamp, |
304 | double estimate, double std_dev) | 302 | double estimate, |
303 | double std_dev) | ||
305 | { | 304 | { |
306 | struct NSEPeer *peer = cls; | 305 | struct NSEPeer *peer = cls; |
307 | char output_buffer[512]; | 306 | char output_buffer[512]; |
308 | size_t size; | 307 | size_t size; |
309 | 308 | ||
310 | if (NULL == output_file) | 309 | if (NULL == output_file) |
311 | { | 310 | { |
312 | FPRINTF (stderr, | 311 | fprintf (stderr, |
313 | "Received network size estimate from peer %p. Size: %f std.dev. %f\n", | 312 | "Received network size estimate from peer %p. Size: %f std.dev. %f\n", |
314 | peer, estimate, std_dev); | 313 | peer, |
315 | return; | 314 | estimate, |
316 | } | 315 | std_dev); |
316 | return; | ||
317 | } | ||
317 | size = GNUNET_snprintf (output_buffer, | 318 | size = GNUNET_snprintf (output_buffer, |
318 | sizeof (output_buffer), | 319 | sizeof (output_buffer), |
319 | "%p %llu %llu %f %f %f\n", | 320 | "%p %llu %llu %f %f %f\n", |
320 | peer, peers_running, | 321 | peer, |
321 | (unsigned long long) timestamp.abs_value_us, | 322 | peers_running, |
322 | GNUNET_NSE_log_estimate_to_n (estimate), estimate, | 323 | (unsigned long long) timestamp.abs_value_us, |
323 | std_dev); | 324 | GNUNET_NSE_log_estimate_to_n (estimate), |
325 | estimate, | ||
326 | std_dev); | ||
324 | if (size != GNUNET_DISK_file_write (output_file, output_buffer, size)) | 327 | if (size != GNUNET_DISK_file_write (output_file, output_buffer, size)) |
325 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 328 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); |
326 | "Unable to write to file!\n"); | ||
327 | } | 329 | } |
328 | 330 | ||
329 | 331 | ||
@@ -338,8 +340,7 @@ handle_estimate (void *cls, | |||
338 | * @return service handle to return in 'op_result', NULL on error | 340 | * @return service handle to return in 'op_result', NULL on error |
339 | */ | 341 | */ |
340 | static void * | 342 | static void * |
341 | nse_connect_adapter (void *cls, | 343 | nse_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
342 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
343 | { | 344 | { |
344 | struct NSEPeer *current_peer = cls; | 345 | struct NSEPeer *current_peer = cls; |
345 | 346 | ||
@@ -355,8 +356,7 @@ nse_connect_adapter (void *cls, | |||
355 | * @param op_result service handle returned from the connect adapter | 356 | * @param op_result service handle returned from the connect adapter |
356 | */ | 357 | */ |
357 | static void | 358 | static void |
358 | nse_disconnect_adapter (void *cls, | 359 | nse_disconnect_adapter (void *cls, void *op_result) |
359 | void *op_result) | ||
360 | { | 360 | { |
361 | GNUNET_NSE_disconnect (op_result); | 361 | GNUNET_NSE_disconnect (op_result); |
362 | } | 362 | } |
@@ -389,9 +389,11 @@ stat_iterator (void *cls, | |||
389 | flag = strcasecmp (subsystem, "core"); | 389 | flag = strcasecmp (subsystem, "core"); |
390 | if (0 != flag) | 390 | if (0 != flag) |
391 | flag = 1; | 391 | flag = 1; |
392 | size = GNUNET_asprintf (&output_buffer, "%llu %llu %u\n", | 392 | size = GNUNET_asprintf (&output_buffer, |
393 | "%llu %llu %u\n", | ||
393 | now.abs_value_us / 1000LL / 1000LL, | 394 | now.abs_value_us / 1000LL / 1000LL, |
394 | value, flag); | 395 | value, |
396 | flag); | ||
395 | if (0 > size) | 397 | if (0 > size) |
396 | { | 398 | { |
397 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Error formatting output buffer.\n"); | 399 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Error formatting output buffer.\n"); |
@@ -419,8 +421,7 @@ stat_iterator (void *cls, | |||
419 | * @return service handle to return in 'op_result', NULL on error | 421 | * @return service handle to return in 'op_result', NULL on error |
420 | */ | 422 | */ |
421 | static void * | 423 | static void * |
422 | stat_connect_adapter (void *cls, | 424 | stat_connect_adapter (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg) |
423 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
424 | { | 425 | { |
425 | struct NSEPeer *peer = cls; | 426 | struct NSEPeer *peer = cls; |
426 | 427 | ||
@@ -440,12 +441,18 @@ stat_disconnect_adapter (void *cls, void *op_result) | |||
440 | { | 441 | { |
441 | struct NSEPeer *peer = cls; | 442 | struct NSEPeer *peer = cls; |
442 | 443 | ||
443 | GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch_cancel | 444 | GNUNET_break (GNUNET_OK == |
444 | (peer->sh, "core", "# peers connected", | 445 | GNUNET_STATISTICS_watch_cancel (peer->sh, |
445 | stat_iterator, peer)); | 446 | "core", |
446 | GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch_cancel | 447 | "# peers connected", |
447 | (peer->sh, "nse", "# peers connected", | 448 | stat_iterator, |
448 | stat_iterator, peer)); | 449 | peer)); |
450 | GNUNET_break (GNUNET_OK == | ||
451 | GNUNET_STATISTICS_watch_cancel (peer->sh, | ||
452 | "nse", | ||
453 | "# peers connected", | ||
454 | stat_iterator, | ||
455 | peer)); | ||
449 | GNUNET_STATISTICS_destroy (op_result, GNUNET_NO); | 456 | GNUNET_STATISTICS_destroy (op_result, GNUNET_NO); |
450 | peer->sh = NULL; | 457 | peer->sh = NULL; |
451 | } | 458 | } |
@@ -462,8 +469,10 @@ stat_disconnect_adapter (void *cls, void *op_result) | |||
462 | * operation has executed successfully. | 469 | * operation has executed successfully. |
463 | */ | 470 | */ |
464 | static void | 471 | static void |
465 | stat_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | 472 | stat_comp_cb (void *cls, |
466 | void *ca_result, const char *emsg ) | 473 | struct GNUNET_TESTBED_Operation *op, |
474 | void *ca_result, | ||
475 | const char *emsg) | ||
467 | { | 476 | { |
468 | struct GNUNET_STATISTICS_Handle *sh = ca_result; | 477 | struct GNUNET_STATISTICS_Handle *sh = ca_result; |
469 | struct NSEPeer *peer = cls; | 478 | struct NSEPeer *peer = cls; |
@@ -473,12 +482,16 @@ stat_comp_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
473 | GNUNET_break (0); | 482 | GNUNET_break (0); |
474 | return; | 483 | return; |
475 | } | 484 | } |
476 | GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch | 485 | GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch (sh, |
477 | (sh, "core", "# peers connected", | 486 | "core", |
478 | stat_iterator, peer)); | 487 | "# peers connected", |
479 | GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch | 488 | stat_iterator, |
480 | (sh, "nse", "# peers connected", | 489 | peer)); |
481 | stat_iterator, peer)); | 490 | GNUNET_break (GNUNET_OK == GNUNET_STATISTICS_watch (sh, |
491 | "nse", | ||
492 | "# peers connected", | ||
493 | stat_iterator, | ||
494 | peer)); | ||
482 | } | 495 | } |
483 | 496 | ||
484 | 497 | ||
@@ -500,29 +513,30 @@ connect_nse_service () | |||
500 | for (i = 0; i < num_peers_in_round[current_round]; i++) | 513 | for (i = 0; i < num_peers_in_round[current_round]; i++) |
501 | { | 514 | { |
502 | if ((num_peers_in_round[current_round] > connection_limit) && | 515 | if ((num_peers_in_round[current_round] > connection_limit) && |
503 | (0 != (i % (num_peers_in_round[current_round] / connection_limit)))) | 516 | (0 != (i % (num_peers_in_round[current_round] / connection_limit)))) |
504 | continue; | 517 | continue; |
505 | LOG_DEBUG ("Connecting to nse service of peer %d\n", i); | 518 | LOG_DEBUG ("Connecting to nse service of peer %d\n", i); |
506 | current_peer = GNUNET_new (struct NSEPeer); | 519 | current_peer = GNUNET_new (struct NSEPeer); |
507 | current_peer->daemon = daemons[i]; | 520 | current_peer->daemon = daemons[i]; |
508 | current_peer->nse_op | 521 | current_peer->nse_op = |
509 | = GNUNET_TESTBED_service_connect (NULL, | 522 | GNUNET_TESTBED_service_connect (NULL, |
510 | current_peer->daemon, | 523 | current_peer->daemon, |
511 | "nse", | 524 | "nse", |
512 | NULL, NULL, | 525 | NULL, |
513 | &nse_connect_adapter, | 526 | NULL, |
514 | &nse_disconnect_adapter, | 527 | &nse_connect_adapter, |
515 | current_peer); | 528 | &nse_disconnect_adapter, |
529 | current_peer); | ||
516 | if (NULL != data_file) | 530 | if (NULL != data_file) |
517 | current_peer->stat_op | 531 | current_peer->stat_op = |
518 | = GNUNET_TESTBED_service_connect (NULL, | 532 | GNUNET_TESTBED_service_connect (NULL, |
519 | current_peer->daemon, | 533 | current_peer->daemon, |
520 | "statistics", | 534 | "statistics", |
521 | stat_comp_cb, | 535 | stat_comp_cb, |
522 | current_peer, | 536 | current_peer, |
523 | &stat_connect_adapter, | 537 | &stat_connect_adapter, |
524 | &stat_disconnect_adapter, | 538 | &stat_disconnect_adapter, |
525 | current_peer); | 539 | current_peer); |
526 | GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, current_peer); | 540 | GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, current_peer); |
527 | if (++connections == connection_limit) | 541 | if (++connections == connection_limit) |
528 | break; | 542 | break; |
@@ -549,9 +563,7 @@ next_round (void *cls); | |||
549 | static void | 563 | static void |
550 | finish_round (void *cls) | 564 | finish_round (void *cls) |
551 | { | 565 | { |
552 | LOG (GNUNET_ERROR_TYPE_INFO, | 566 | LOG (GNUNET_ERROR_TYPE_INFO, "Have %u connections\n", total_connections); |
553 | "Have %u connections\n", | ||
554 | total_connections); | ||
555 | close_monitor_connections (); | 567 | close_monitor_connections (); |
556 | round_task = GNUNET_SCHEDULER_add_now (&next_round, NULL); | 568 | round_task = GNUNET_SCHEDULER_add_now (&next_round, NULL); |
557 | } | 569 | } |
@@ -565,12 +577,9 @@ finish_round (void *cls) | |||
565 | static void | 577 | static void |
566 | run_round () | 578 | run_round () |
567 | { | 579 | { |
568 | LOG_DEBUG ("Running round %u\n", | 580 | LOG_DEBUG ("Running round %u\n", current_round); |
569 | current_round); | ||
570 | connect_nse_service (); | 581 | connect_nse_service (); |
571 | GNUNET_SCHEDULER_add_delayed (wait_time, | 582 | GNUNET_SCHEDULER_add_delayed (wait_time, &finish_round, NULL); |
572 | &finish_round, | ||
573 | NULL); | ||
574 | } | 583 | } |
575 | 584 | ||
576 | 585 | ||
@@ -583,9 +592,7 @@ make_oplist_entry () | |||
583 | struct OpListEntry *entry; | 592 | struct OpListEntry *entry; |
584 | 593 | ||
585 | entry = GNUNET_new (struct OpListEntry); | 594 | entry = GNUNET_new (struct OpListEntry); |
586 | GNUNET_CONTAINER_DLL_insert_tail (oplist_head, | 595 | GNUNET_CONTAINER_DLL_insert_tail (oplist_head, oplist_tail, entry); |
587 | oplist_tail, | ||
588 | entry); | ||
589 | return entry; | 596 | return entry; |
590 | } | 597 | } |
591 | 598 | ||
@@ -599,7 +606,7 @@ make_oplist_entry () | |||
599 | */ | 606 | */ |
600 | static void | 607 | static void |
601 | manage_service_cb (void *cls, | 608 | manage_service_cb (void *cls, |
602 | struct GNUNET_TESTBED_Operation *op, | 609 | struct GNUNET_TESTBED_Operation *op, |
603 | const char *emsg) | 610 | const char *emsg) |
604 | { | 611 | { |
605 | struct OpListEntry *entry = cls; | 612 | struct OpListEntry *entry = cls; |
@@ -613,9 +620,7 @@ manage_service_cb (void *cls, | |||
613 | } | 620 | } |
614 | GNUNET_assert (0 != entry->delta); | 621 | GNUNET_assert (0 != entry->delta); |
615 | peers_running += entry->delta; | 622 | peers_running += entry->delta; |
616 | GNUNET_CONTAINER_DLL_remove (oplist_head, | 623 | GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry); |
617 | oplist_tail, | ||
618 | entry); | ||
619 | GNUNET_free (entry); | 624 | GNUNET_free (entry); |
620 | if (num_peers_in_round[current_round] == peers_running) | 625 | if (num_peers_in_round[current_round] == peers_running) |
621 | run_round (); | 626 | run_round (); |
@@ -633,7 +638,7 @@ adjust_running_peers () | |||
633 | unsigned int i; | 638 | unsigned int i; |
634 | 639 | ||
635 | /* start peers if we have too few */ | 640 | /* start peers if we have too few */ |
636 | for (i=peers_running;i<num_peers_in_round[current_round];i++) | 641 | for (i = peers_running; i < num_peers_in_round[current_round]; i++) |
637 | { | 642 | { |
638 | entry = make_oplist_entry (); | 643 | entry = make_oplist_entry (); |
639 | entry->delta = 1; | 644 | entry->delta = 1; |
@@ -645,16 +650,16 @@ adjust_running_peers () | |||
645 | 1); | 650 | 1); |
646 | } | 651 | } |
647 | /* stop peers if we have too many */ | 652 | /* stop peers if we have too many */ |
648 | for (i=num_peers_in_round[current_round];i<peers_running;i++) | 653 | for (i = num_peers_in_round[current_round]; i < peers_running; i++) |
649 | { | 654 | { |
650 | entry = make_oplist_entry (); | 655 | entry = make_oplist_entry (); |
651 | entry->delta = -1; | 656 | entry->delta = -1; |
652 | entry->op = GNUNET_TESTBED_peer_manage_service (NULL, | 657 | entry->op = GNUNET_TESTBED_peer_manage_service (NULL, |
653 | daemons[i], | 658 | daemons[i], |
654 | "nse", | 659 | "nse", |
655 | &manage_service_cb, | 660 | &manage_service_cb, |
656 | entry, | 661 | entry, |
657 | 0); | 662 | 0); |
658 | } | 663 | } |
659 | } | 664 | } |
660 | 665 | ||
@@ -697,19 +702,19 @@ next_round (void *cls) | |||
697 | */ | 702 | */ |
698 | static void | 703 | static void |
699 | master_controller_cb (void *cls, | 704 | master_controller_cb (void *cls, |
700 | const struct GNUNET_TESTBED_EventInformation *event) | 705 | const struct GNUNET_TESTBED_EventInformation *event) |
701 | { | 706 | { |
702 | switch (event->type) | 707 | switch (event->type) |
703 | { | 708 | { |
704 | case GNUNET_TESTBED_ET_CONNECT: | 709 | case GNUNET_TESTBED_ET_CONNECT: |
705 | total_connections++; | 710 | total_connections++; |
706 | break; | 711 | break; |
707 | case GNUNET_TESTBED_ET_DISCONNECT: | 712 | case GNUNET_TESTBED_ET_DISCONNECT: |
708 | total_connections--; | 713 | total_connections--; |
709 | break; | 714 | break; |
710 | default: | 715 | default: |
711 | break; | 716 | break; |
712 | } | 717 | } |
713 | } | 718 | } |
714 | 719 | ||
715 | 720 | ||
@@ -761,7 +766,9 @@ test_master (void *cls, | |||
761 | * @param cfg configuration handle | 766 | * @param cfg configuration handle |
762 | */ | 767 | */ |
763 | static void | 768 | static void |
764 | run (void *cls, char *const *args, const char *cfgfile, | 769 | run (void *cls, |
770 | char *const *args, | ||
771 | const char *cfgfile, | ||
765 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 772 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
766 | { | 773 | { |
767 | char *tok; | 774 | char *tok; |
@@ -777,46 +784,43 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
777 | return; | 784 | return; |
778 | } | 785 | } |
779 | for (tok = strtok (num_peer_spec, ","); NULL != tok; tok = strtok (NULL, ",")) | 786 | for (tok = strtok (num_peer_spec, ","); NULL != tok; tok = strtok (NULL, ",")) |
787 | { | ||
788 | if (1 != sscanf (tok, "%u", &num)) | ||
780 | { | 789 | { |
781 | if (1 != sscanf (tok, "%u", &num)) | 790 | fprintf (stderr, "You need to specify numbers, not `%s'\n", tok); |
782 | { | 791 | return; |
783 | fprintf (stderr, "You need to specify numbers, not `%s'\n", tok); | ||
784 | return; | ||
785 | } | ||
786 | if (0 == num) | ||
787 | { | ||
788 | fprintf (stderr, "Refusing to run a round with 0 peers\n"); | ||
789 | return; | ||
790 | } | ||
791 | GNUNET_array_append (num_peers_in_round, num_rounds, num); | ||
792 | num_peers = GNUNET_MAX (num_peers, num); | ||
793 | } | 792 | } |
794 | if (0 == num_peers) | 793 | if (0 == num) |
795 | { | 794 | { |
796 | fprintf (stderr, "Refusing to run a testbed with no rounds\n"); | 795 | fprintf (stderr, "Refusing to run a round with 0 peers\n"); |
797 | return; | 796 | return; |
798 | } | 797 | } |
799 | if ( (NULL != data_filename) && | 798 | GNUNET_array_append (num_peers_in_round, num_rounds, num); |
800 | (NULL == (data_file = | 799 | num_peers = GNUNET_MAX (num_peers, num); |
801 | GNUNET_DISK_file_open (data_filename, | 800 | } |
802 | GNUNET_DISK_OPEN_READWRITE | | 801 | if (0 == num_peers) |
803 | GNUNET_DISK_OPEN_TRUNCATE | | 802 | { |
804 | GNUNET_DISK_OPEN_CREATE, | 803 | fprintf (stderr, "Refusing to run a testbed with no rounds\n"); |
805 | GNUNET_DISK_PERM_USER_READ | | 804 | return; |
806 | GNUNET_DISK_PERM_USER_WRITE))) ) | 805 | } |
807 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | 806 | if ((NULL != data_filename) && |
808 | "open", | 807 | (NULL == |
809 | data_filename); | 808 | (data_file = GNUNET_DISK_file_open (data_filename, |
810 | 809 | GNUNET_DISK_OPEN_READWRITE | | |
811 | if ( (NULL != output_filename) && | 810 | GNUNET_DISK_OPEN_TRUNCATE | |
812 | (NULL == (output_file = | 811 | GNUNET_DISK_OPEN_CREATE, |
813 | GNUNET_DISK_file_open (output_filename, | 812 | GNUNET_DISK_PERM_USER_READ | |
814 | GNUNET_DISK_OPEN_READWRITE | | 813 | GNUNET_DISK_PERM_USER_WRITE)))) |
815 | GNUNET_DISK_OPEN_CREATE, | 814 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", data_filename); |
816 | GNUNET_DISK_PERM_USER_READ | | 815 | |
817 | GNUNET_DISK_PERM_USER_WRITE))) ) | 816 | if ((NULL != output_filename) && |
818 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", | 817 | (NULL == |
819 | output_filename); | 818 | (output_file = GNUNET_DISK_file_open (output_filename, |
819 | GNUNET_DISK_OPEN_READWRITE | | ||
820 | GNUNET_DISK_OPEN_CREATE, | ||
821 | GNUNET_DISK_PERM_USER_READ | | ||
822 | GNUNET_DISK_PERM_USER_WRITE)))) | ||
823 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", output_filename); | ||
820 | event_mask = 0LL; | 824 | event_mask = 0LL; |
821 | event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START); | 825 | event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_START); |
822 | event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_STOP); | 826 | event_mask |= (1LL << GNUNET_TESTBED_ET_PEER_STOP); |
@@ -827,9 +831,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
827 | num_peers, | 831 | num_peers, |
828 | event_mask, | 832 | event_mask, |
829 | master_controller_cb, | 833 | master_controller_cb, |
830 | NULL, /* master_controller_cb cls */ | 834 | NULL, /* master_controller_cb cls */ |
831 | &test_master, | 835 | &test_master, |
832 | NULL); /* test_master cls */ | 836 | NULL); /* test_master cls */ |
833 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | 837 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
834 | } | 838 | } |
835 | 839 | ||
@@ -842,56 +846,70 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
842 | int | 846 | int |
843 | main (int argc, char *const *argv) | 847 | main (int argc, char *const *argv) |
844 | { | 848 | { |
845 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 849 | struct GNUNET_GETOPT_CommandLineOption options[] = |
846 | GNUNET_GETOPT_option_uint ('C', | 850 | {GNUNET_GETOPT_option_uint ( |
847 | "connections", | 851 | 'C', |
848 | "COUNT", | 852 | "connections", |
849 | gettext_noop ("limit to the number of connections to NSE services, 0 for none"), | 853 | "COUNT", |
850 | &connection_limit), | 854 | gettext_noop ( |
851 | GNUNET_GETOPT_option_string ('d', | 855 | "limit to the number of connections to NSE services, 0 for none"), |
852 | "details", | 856 | &connection_limit), |
853 | "FILENAME", | 857 | GNUNET_GETOPT_option_string ( |
854 | gettext_noop ("name of the file for writing connection information and statistics"), | 858 | 'd', |
855 | &data_filename), | 859 | "details", |
856 | 860 | "FILENAME", | |
857 | GNUNET_GETOPT_option_string ('H', | 861 | gettext_noop ( |
858 | "hosts", | 862 | "name of the file for writing connection information and statistics"), |
859 | "FILENAME", | 863 | &data_filename), |
860 | gettext_noop ("name of the file with the login information for the testbed"), | 864 | |
861 | &hosts_file), | 865 | GNUNET_GETOPT_option_string ( |
862 | 866 | 'H', | |
863 | GNUNET_GETOPT_option_string ('o', | 867 | "hosts", |
864 | "output", | 868 | "FILENAME", |
865 | "FILENAME", | 869 | gettext_noop ( |
866 | gettext_noop ("name of the file for writing the main results"), | 870 | "name of the file with the login information for the testbed"), |
867 | &output_filename), | 871 | &hosts_file), |
868 | 872 | ||
869 | 873 | GNUNET_GETOPT_option_string ( | |
870 | GNUNET_GETOPT_option_string ('p', | 874 | 'o', |
871 | "peers", | 875 | "output", |
872 | "NETWORKSIZESPEC", | 876 | "FILENAME", |
873 | gettext_noop ("Number of peers to run in each round, separated by commas"), | 877 | gettext_noop ("name of the file for writing the main results"), |
874 | &num_peer_spec), | 878 | &output_filename), |
875 | 879 | ||
876 | GNUNET_GETOPT_option_increment_uint ('V', | 880 | |
877 | "verbose", | 881 | GNUNET_GETOPT_option_string ( |
878 | gettext_noop ("be verbose (print progress information)"), | 882 | 'p', |
879 | &verbose), | 883 | "peers", |
880 | 884 | "NETWORKSIZESPEC", | |
881 | GNUNET_GETOPT_option_relative_time ('w', | 885 | gettext_noop ( |
882 | "wait", | 886 | "Number of peers to run in each round, separated by commas"), |
883 | "DELAY", | 887 | &num_peer_spec), |
884 | gettext_noop ("delay between rounds"), | 888 | |
885 | &wait_time), | 889 | GNUNET_GETOPT_option_increment_uint ( |
886 | GNUNET_GETOPT_OPTION_END | 890 | 'V', |
887 | }; | 891 | "verbose", |
892 | gettext_noop ("be verbose (print progress information)"), | ||
893 | &verbose), | ||
894 | |||
895 | GNUNET_GETOPT_option_relative_time ('w', | ||
896 | "wait", | ||
897 | "DELAY", | ||
898 | gettext_noop ("delay between rounds"), | ||
899 | &wait_time), | ||
900 | GNUNET_GETOPT_OPTION_END}; | ||
888 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 901 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
889 | return 2; | 902 | return 2; |
890 | if (GNUNET_OK != | 903 | if ( |
891 | GNUNET_PROGRAM_run (argc, argv, "nse-profiler", | 904 | GNUNET_OK != |
892 | gettext_noop | 905 | GNUNET_PROGRAM_run (argc, |
893 | ("Measure quality and performance of the NSE service."), | 906 | argv, |
894 | options, &run, NULL)) | 907 | "nse-profiler", |
908 | gettext_noop ( | ||
909 | "Measure quality and performance of the NSE service."), | ||
910 | options, | ||
911 | &run, | ||
912 | NULL)) | ||
895 | ok = 1; | 913 | ok = 1; |
896 | return ok; | 914 | return ok; |
897 | } | 915 | } |