diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-10-26 15:59:50 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-10-26 15:59:50 +0000 |
commit | 9b141acb9c06621c4a2966c0b3c120f4f5276b0d (patch) | |
tree | d8c6190632cda559ad8fcc59ae11a089a4fee03d | |
parent | af79ffcec397c9283dfe3850b11fd0d7e06d53da (diff) | |
download | gnunet-9b141acb9c06621c4a2966c0b3c120f4f5276b0d.tar.gz gnunet-9b141acb9c06621c4a2966c0b3c120f4f5276b0d.zip |
added max path compression parameter to regex profiler
-rw-r--r-- | src/mesh/gnunet-regex-profiler.c | 221 |
1 files changed, 117 insertions, 104 deletions
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c index 622842332..f36a04ec6 100644 --- a/src/mesh/gnunet-regex-profiler.c +++ b/src/mesh/gnunet-regex-profiler.c | |||
@@ -338,6 +338,11 @@ static struct GNUNET_DISK_FileHandle *data_file; | |||
338 | */ | 338 | */ |
339 | static char *data_filename; | 339 | static char *data_filename; |
340 | 340 | ||
341 | /** | ||
342 | * Maximal path compression length. | ||
343 | */ | ||
344 | static unsigned int max_path_compression; | ||
345 | |||
341 | 346 | ||
342 | /******************************************************************************/ | 347 | /******************************************************************************/ |
343 | /****************************** DECLARATIONS ********************************/ | 348 | /****************************** DECLARATIONS ********************************/ |
@@ -515,7 +520,7 @@ stats_iterator (void *cls, const char *subsystem, const char *name, | |||
515 | GNUNET_snprintf (output_buffer, | 520 | GNUNET_snprintf (output_buffer, |
516 | sizeof (output_buffer), | 521 | sizeof (output_buffer), |
517 | "%p [%s] %llu %s\n", | 522 | "%p [%s] %llu %s\n", |
518 | peer, | 523 | peer, |
519 | subsystem, value, name); | 524 | subsystem, value, name); |
520 | if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) | 525 | if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) |
521 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); | 526 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); |
@@ -533,7 +538,7 @@ stats_iterator (void *cls, const char *subsystem, const char *name, | |||
533 | */ | 538 | */ |
534 | static void | 539 | static void |
535 | stats_cb (void *cls, | 540 | stats_cb (void *cls, |
536 | int success) | 541 | int success) |
537 | { | 542 | { |
538 | static unsigned int peer_cnt; | 543 | static unsigned int peer_cnt; |
539 | struct RegexPeer *peer = cls; | 544 | struct RegexPeer *peer = cls; |
@@ -541,8 +546,8 @@ stats_cb (void *cls, | |||
541 | if (GNUNET_OK != success) | 546 | if (GNUNET_OK != success) |
542 | { | 547 | { |
543 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 548 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
544 | "Getting statistics for peer %u failed!\n", | 549 | "Getting statistics for peer %u failed!\n", |
545 | peer->id); | 550 | peer->id); |
546 | return; | 551 | return; |
547 | } | 552 | } |
548 | 553 | ||
@@ -583,15 +588,15 @@ stats_connect_cb (void *cls, | |||
583 | peer->stats_handle = ca_result; | 588 | peer->stats_handle = ca_result; |
584 | 589 | ||
585 | peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle, | 590 | peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle, |
586 | NULL, | 591 | NULL, |
587 | &mesh_peer_connect_handler, | 592 | &mesh_peer_connect_handler, |
588 | &mesh_peer_disconnect_handler, | 593 | &mesh_peer_disconnect_handler, |
589 | peer); | 594 | peer); |
590 | 595 | ||
591 | peer->prof_start_time = GNUNET_TIME_absolute_get (); | 596 | peer->prof_start_time = GNUNET_TIME_absolute_get (); |
592 | 597 | ||
593 | GNUNET_MESH_peer_request_connect_by_string (peer->mesh_tunnel_handle, | 598 | GNUNET_MESH_peer_request_connect_by_string (peer->mesh_tunnel_handle, |
594 | peer->search_str); | 599 | peer->search_str); |
595 | } | 600 | } |
596 | 601 | ||
597 | 602 | ||
@@ -691,51 +696,51 @@ mesh_peer_connect_handler (void *cls, | |||
691 | else | 696 | else |
692 | { | 697 | { |
693 | prof_time = GNUNET_TIME_absolute_get_duration (peer->prof_start_time); | 698 | prof_time = GNUNET_TIME_absolute_get_duration (peer->prof_start_time); |
694 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 699 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
695 | "String %s successfully matched on peer %u after %s (%i/%i)\n", | 700 | "String %s successfully matched on peer %u after %s (%i/%i)\n", |
696 | peer->search_str, peer->id, GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), | 701 | peer->search_str, peer->id, GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), |
697 | peers_found, num_search_strings); | 702 | peers_found, num_search_strings); |
698 | 703 | ||
699 | if (NULL != data_file) | 704 | if (NULL != data_file) |
700 | { | 705 | { |
701 | size = | 706 | size = |
702 | GNUNET_snprintf (output_buffer, | 707 | GNUNET_snprintf (output_buffer, |
703 | sizeof (output_buffer), | 708 | sizeof (output_buffer), |
704 | "Peer: %u (%p)\nHost: %s\nPolicy file: %s\nSearch string: %s\nSearch duration: %s\n\n", | 709 | "Peer: %u (%p)\nHost: %s\nPolicy file: %s\nSearch string: %s\nSearch duration: %s\n\n", |
705 | peer->id, | 710 | peer->id, |
706 | peer, | 711 | peer, |
707 | GNUNET_TESTBED_host_get_hostname (peer->host_handle), | 712 | GNUNET_TESTBED_host_get_hostname (peer->host_handle), |
708 | peer->policy_file, | 713 | peer->policy_file, |
709 | peer->search_str, | 714 | peer->search_str, |
710 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); | 715 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); |
711 | 716 | ||
712 | if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) | 717 | if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) |
713 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); | 718 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); |
714 | } | 719 | } |
715 | 720 | ||
716 | if (NULL == GNUNET_STATISTICS_get (peer->stats_handle, "mesh", NULL, | 721 | if (NULL == GNUNET_STATISTICS_get (peer->stats_handle, "mesh", NULL, |
717 | GNUNET_TIME_UNIT_FOREVER_REL, | 722 | GNUNET_TIME_UNIT_FOREVER_REL, |
718 | NULL, | 723 | NULL, |
719 | &stats_iterator, peer)) | 724 | &stats_iterator, peer)) |
720 | { | 725 | { |
721 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 726 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
722 | "Could not get mesh statistics of peer %u!\n", peer->id); | 727 | "Could not get mesh statistics of peer %u!\n", peer->id); |
723 | } | 728 | } |
724 | if (NULL == GNUNET_STATISTICS_get (peer->stats_handle, "transport", NULL, | 729 | if (NULL == GNUNET_STATISTICS_get (peer->stats_handle, "transport", NULL, |
725 | GNUNET_TIME_UNIT_FOREVER_REL, | 730 | GNUNET_TIME_UNIT_FOREVER_REL, |
726 | NULL, | 731 | NULL, |
727 | &stats_iterator, peer)) | 732 | &stats_iterator, peer)) |
728 | { | 733 | { |
729 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 734 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
730 | "Could not get transport statistics of peer %u!\n", peer->id); | 735 | "Could not get transport statistics of peer %u!\n", peer->id); |
731 | } | 736 | } |
732 | if (NULL == GNUNET_STATISTICS_get (peer->stats_handle, "dht", NULL, | 737 | if (NULL == GNUNET_STATISTICS_get (peer->stats_handle, "dht", NULL, |
733 | GNUNET_TIME_UNIT_FOREVER_REL, | 738 | GNUNET_TIME_UNIT_FOREVER_REL, |
734 | &stats_cb, | 739 | &stats_cb, |
735 | &stats_iterator, peer)) | 740 | &stats_iterator, peer)) |
736 | { | 741 | { |
737 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 742 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
738 | "Could not get dht statistics of peer %u!\n", peer->id); | 743 | "Could not get dht statistics of peer %u!\n", peer->id); |
739 | } | 744 | } |
740 | } | 745 | } |
741 | 746 | ||
@@ -743,8 +748,8 @@ mesh_peer_connect_handler (void *cls, | |||
743 | { | 748 | { |
744 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); | 749 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); |
745 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 750 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
746 | "All strings successfully matched in %s\n", | 751 | "All strings successfully matched in %s\n", |
747 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); | 752 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); |
748 | printf ("All strings successfully matched. Shutting down.\n"); | 753 | printf ("All strings successfully matched. Shutting down.\n"); |
749 | fflush (stdout); | 754 | fflush (stdout); |
750 | 755 | ||
@@ -765,10 +770,10 @@ do_connect_by_string_timeout (void *cls, | |||
765 | const struct GNUNET_SCHEDULER_TaskContext * tc) | 770 | const struct GNUNET_SCHEDULER_TaskContext * tc) |
766 | { | 771 | { |
767 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 772 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
768 | "Finding matches to all strings did not succeed after %s.\n", | 773 | "Finding matches to all strings did not succeed after %s.\n", |
769 | GNUNET_STRINGS_relative_time_to_string (search_timeout, GNUNET_NO)); | 774 | GNUNET_STRINGS_relative_time_to_string (search_timeout, GNUNET_NO)); |
770 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 775 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
771 | "Found %i of %i strings\n", peers_found, num_search_strings); | 776 | "Found %i of %i strings\n", peers_found, num_search_strings); |
772 | 777 | ||
773 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 778 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
774 | } | 779 | } |
@@ -793,19 +798,19 @@ do_connect_by_string (void *cls, | |||
793 | peer->search_str = search_strings[search_cnt]; | 798 | peer->search_str = search_strings[search_cnt]; |
794 | 799 | ||
795 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 800 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
796 | "Searching for string \"%s\" on peer %d with file %s\n", | 801 | "Searching for string \"%s\" on peer %d with file %s\n", |
797 | peer->search_str, (search_cnt % num_peers), peer->policy_file); | 802 | peer->search_str, (search_cnt % num_peers), peer->policy_file); |
798 | 803 | ||
799 | /* First connect to stats service, then try connecting by string in stats_connect_cb */ | 804 | /* First connect to stats service, then try connecting by string in stats_connect_cb */ |
800 | peer->stats_op_handle = | 805 | peer->stats_op_handle = |
801 | GNUNET_TESTBED_service_connect (NULL, | 806 | GNUNET_TESTBED_service_connect (NULL, |
802 | peers->peer_handle, | 807 | peers->peer_handle, |
803 | "statistics", | 808 | "statistics", |
804 | &stats_connect_cb, | 809 | &stats_connect_cb, |
805 | peer, | 810 | peer, |
806 | &stats_ca, | 811 | &stats_ca, |
807 | &stats_da, | 812 | &stats_da, |
808 | peer); | 813 | peer); |
809 | } | 814 | } |
810 | 815 | ||
811 | search_timeout_task = GNUNET_SCHEDULER_add_delayed (search_timeout, | 816 | search_timeout_task = GNUNET_SCHEDULER_add_delayed (search_timeout, |
@@ -844,8 +849,8 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
844 | GNUNET_assert (NULL != peer->policy_file); | 849 | GNUNET_assert (NULL != peer->policy_file); |
845 | 850 | ||
846 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 851 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
847 | "Announcing regexes for peer %u with file %s\n", | 852 | "Announcing regexes for peer %u with file %s\n", |
848 | peer->id, peer->policy_file); | 853 | peer->id, peer->policy_file); |
849 | 854 | ||
850 | if (GNUNET_YES != GNUNET_DISK_file_test (peer->policy_file)) | 855 | if (GNUNET_YES != GNUNET_DISK_file_test (peer->policy_file)) |
851 | { | 856 | { |
@@ -879,9 +884,9 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
879 | data[offset] = '\0'; | 884 | data[offset] = '\0'; |
880 | regex = buf; | 885 | regex = buf; |
881 | GNUNET_assert (NULL != regex); | 886 | GNUNET_assert (NULL != regex); |
882 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s on peer %u \n", | 887 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Announcing regex: %s on peer %u \n", |
883 | regex, peer->id); | 888 | regex, peer->id); |
884 | GNUNET_MESH_announce_regex (peer->mesh_handle, regex); | 889 | GNUNET_MESH_announce_regex (peer->mesh_handle, regex, max_path_compression); |
885 | buf = &data[offset + 1]; | 890 | buf = &data[offset + 1]; |
886 | } | 891 | } |
887 | else if ((data[offset] == '\n') || (data[offset] == '\0')) | 892 | else if ((data[offset] == '\n') || (data[offset] == '\0')) |
@@ -892,12 +897,12 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
892 | if (++connected_mesh_handles == num_peers) | 897 | if (++connected_mesh_handles == num_peers) |
893 | { | 898 | { |
894 | printf ("\nWaiting %s before starting to search.\n", | 899 | printf ("\nWaiting %s before starting to search.\n", |
895 | GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES)); | 900 | GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES)); |
896 | fflush (stdout); | 901 | fflush (stdout); |
897 | 902 | ||
898 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 903 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
899 | "All mesh handles connected. Waiting %s before starting to search.\n", | 904 | "All mesh handles connected. Waiting %s before starting to search.\n", |
900 | GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES)); | 905 | GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES)); |
901 | 906 | ||
902 | search_task = GNUNET_SCHEDULER_add_delayed (search_delay, | 907 | search_task = GNUNET_SCHEDULER_add_delayed (search_delay, |
903 | &do_connect_by_string, NULL); | 908 | &do_connect_by_string, NULL); |
@@ -998,8 +1003,8 @@ peer_churn_cb (void *cls, const char *emsg) | |||
998 | { | 1003 | { |
999 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); | 1004 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); |
1000 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1005 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1001 | "All peers started successfully in %s\n", | 1006 | "All peers started successfully in %s\n", |
1002 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); | 1007 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); |
1003 | result = GNUNET_OK; | 1008 | result = GNUNET_OK; |
1004 | 1009 | ||
1005 | peer_handles = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *) * num_peers); | 1010 | peer_handles = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *) * num_peers); |
@@ -1017,7 +1022,7 @@ peer_churn_cb (void *cls, const char *emsg) | |||
1017 | GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, | 1022 | GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, |
1018 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | 1023 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, |
1019 | num_links, | 1024 | num_links, |
1020 | GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY, | 1025 | GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY, |
1021 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | 1026 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); |
1022 | if (NULL == topology_op) | 1027 | if (NULL == topology_op) |
1023 | { | 1028 | { |
@@ -1074,8 +1079,8 @@ peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg) | |||
1074 | { | 1079 | { |
1075 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); | 1080 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); |
1076 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1081 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1077 | "All peers created successfully in %s\n", | 1082 | "All peers created successfully in %s\n", |
1078 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); | 1083 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); |
1079 | /* Now peers are to be started */ | 1084 | /* Now peers are to be started */ |
1080 | state = STATE_PEERS_STARTING; | 1085 | state = STATE_PEERS_STARTING; |
1081 | prof_start_time = GNUNET_TIME_absolute_get (); | 1086 | prof_start_time = GNUNET_TIME_absolute_get (); |
@@ -1175,7 +1180,7 @@ controller_event_cb (void *cls, | |||
1175 | if (++slaves_started == num_hosts - 1) | 1180 | if (++slaves_started == num_hosts - 1) |
1176 | { | 1181 | { |
1177 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1182 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1178 | "All slaves started successfully\n"); | 1183 | "All slaves started successfully\n"); |
1179 | 1184 | ||
1180 | state = STATE_PEERS_CREATING; | 1185 | state = STATE_PEERS_CREATING; |
1181 | prof_start_time = GNUNET_TIME_absolute_get (); | 1186 | prof_start_time = GNUNET_TIME_absolute_get (); |
@@ -1217,16 +1222,16 @@ controller_event_cb (void *cls, | |||
1217 | { | 1222 | { |
1218 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1223 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1219 | _("An operation has failed while linking\n")); | 1224 | _("An operation has failed while linking\n")); |
1220 | printf ("F"); | 1225 | printf ("F"); |
1221 | fflush (stdout); | 1226 | fflush (stdout); |
1222 | retry_links++; | 1227 | retry_links++; |
1223 | 1228 | ||
1224 | if (++cont_fails > num_cont_fails) | 1229 | if (++cont_fails > num_cont_fails) |
1225 | { | 1230 | { |
1226 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1231 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1227 | "We have a very high peer linking failure rate: %u (threshold: %u)\n", | 1232 | "We have a very high peer linking failure rate: %u (threshold: %u)\n", |
1228 | cont_fails, | 1233 | cont_fails, |
1229 | num_cont_fails); | 1234 | num_cont_fails); |
1230 | } | 1235 | } |
1231 | } | 1236 | } |
1232 | /* We do no retries, consider this link as established */ | 1237 | /* We do no retries, consider this link as established */ |
@@ -1234,8 +1239,8 @@ controller_event_cb (void *cls, | |||
1234 | case GNUNET_TESTBED_ET_CONNECT: | 1239 | case GNUNET_TESTBED_ET_CONNECT: |
1235 | { | 1240 | { |
1236 | unsigned int peer_cnt; | 1241 | unsigned int peer_cnt; |
1237 | char output_buffer[512]; | 1242 | char output_buffer[512]; |
1238 | size_t size; | 1243 | size_t size; |
1239 | 1244 | ||
1240 | if (0 == established_links) | 1245 | if (0 == established_links) |
1241 | printf ("Establishing links ."); | 1246 | printf ("Establishing links ."); |
@@ -1246,32 +1251,35 @@ controller_event_cb (void *cls, | |||
1246 | } | 1251 | } |
1247 | if (++established_links == num_links) | 1252 | if (++established_links == num_links) |
1248 | { | 1253 | { |
1249 | fflush (stdout); | 1254 | fflush (stdout); |
1250 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); | 1255 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); |
1251 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1256 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1252 | "%u links established in %s\n", | 1257 | "%u links established in %s\n", |
1253 | num_links, | 1258 | num_links, |
1254 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); | 1259 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO)); |
1255 | result = GNUNET_OK; | 1260 | result = GNUNET_OK; |
1256 | GNUNET_free (peer_handles); | 1261 | GNUNET_free (peer_handles); |
1257 | 1262 | ||
1258 | if (NULL != data_file) | 1263 | if (NULL != data_file) |
1259 | { | 1264 | { |
1260 | size = | 1265 | size = |
1261 | GNUNET_snprintf (output_buffer, | 1266 | GNUNET_snprintf (output_buffer, |
1262 | sizeof (output_buffer), | 1267 | sizeof (output_buffer), |
1263 | "# of peers: %u\n# of links established: %u\nTime to establish links: %s\nLinking failures: %u\n\n", | 1268 | "# of peers: %u\n# of links established: %u\n" |
1264 | num_peers, | 1269 | "Time to establish links: %s\nLinking failures: %u\n" |
1265 | (established_links - cont_fails), | 1270 | "path compression length: %u\n", |
1266 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), | 1271 | num_peers, |
1267 | cont_fails); | 1272 | (established_links - cont_fails), |
1268 | 1273 | GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO), | |
1269 | if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) | 1274 | cont_fails, |
1270 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); | 1275 | max_path_compression); |
1271 | } | 1276 | |
1272 | 1277 | if (size != GNUNET_DISK_file_write (data_file, output_buffer, size)) | |
1278 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to write to file!\n"); | ||
1279 | } | ||
1280 | |||
1273 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1281 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1274 | "Connecting to mesh and statistics service...\n"); | 1282 | "Connecting to mesh and statistics service...\n"); |
1275 | for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) | 1283 | for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++) |
1276 | { | 1284 | { |
1277 | peers[peer_cnt].mesh_op_handle = | 1285 | peers[peer_cnt].mesh_op_handle = |
@@ -1292,8 +1300,8 @@ controller_event_cb (void *cls, | |||
1292 | } | 1300 | } |
1293 | break; | 1301 | break; |
1294 | default: | 1302 | default: |
1295 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1303 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1296 | "Unexpected controller_cb with state %i!\n", state); | 1304 | "Unexpected controller_cb with state %i!\n", state); |
1297 | GNUNET_assert (0); | 1305 | GNUNET_assert (0); |
1298 | } | 1306 | } |
1299 | } | 1307 | } |
@@ -1411,6 +1419,7 @@ status_cb (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, int stat | |||
1411 | &do_abort, NULL); | 1419 | &do_abort, NULL); |
1412 | } | 1420 | } |
1413 | 1421 | ||
1422 | |||
1414 | /** | 1423 | /** |
1415 | * Load search strings from given filename. One search string per line. | 1424 | * Load search strings from given filename. One search string per line. |
1416 | * | 1425 | * |
@@ -1481,6 +1490,7 @@ load_search_strings (const char *filename, char ***strings) | |||
1481 | return str_cnt; | 1490 | return str_cnt; |
1482 | } | 1491 | } |
1483 | 1492 | ||
1493 | |||
1484 | /** | 1494 | /** |
1485 | * Main function that will be run by the scheduler. | 1495 | * Main function that will be run by the scheduler. |
1486 | * | 1496 | * |
@@ -1533,16 +1543,16 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1533 | return; | 1543 | return; |
1534 | } | 1544 | } |
1535 | if ( (NULL != data_filename) && | 1545 | if ( (NULL != data_filename) && |
1536 | (NULL == (data_file = | 1546 | (NULL == (data_file = |
1537 | GNUNET_DISK_file_open (data_filename, | 1547 | GNUNET_DISK_file_open (data_filename, |
1538 | GNUNET_DISK_OPEN_READWRITE | | 1548 | GNUNET_DISK_OPEN_READWRITE | |
1539 | GNUNET_DISK_OPEN_TRUNCATE | | 1549 | GNUNET_DISK_OPEN_TRUNCATE | |
1540 | GNUNET_DISK_OPEN_CREATE, | 1550 | GNUNET_DISK_OPEN_CREATE, |
1541 | GNUNET_DISK_PERM_USER_READ | | 1551 | GNUNET_DISK_PERM_USER_READ | |
1542 | GNUNET_DISK_PERM_USER_WRITE))) ) | 1552 | GNUNET_DISK_PERM_USER_WRITE))) ) |
1543 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | 1553 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, |
1544 | "open", | 1554 | "open", |
1545 | data_filename); | 1555 | data_filename); |
1546 | if (GNUNET_YES != GNUNET_DISK_directory_test (args[1])) | 1556 | if (GNUNET_YES != GNUNET_DISK_directory_test (args[1])) |
1547 | { | 1557 | { |
1548 | fprintf (stderr, _("Specified policies directory does not exist. Exiting.\n")); | 1558 | fprintf (stderr, _("Specified policies directory does not exist. Exiting.\n")); |
@@ -1607,6 +1617,9 @@ main (int argc, char *const *argv) | |||
1607 | { 's', "search-delay", "DELAY", | 1617 | { 's', "search-delay", "DELAY", |
1608 | gettext_noop ("wait DELAY minutes before starting string search"), | 1618 | gettext_noop ("wait DELAY minutes before starting string search"), |
1609 | GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &search_delay }, | 1619 | GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &search_delay }, |
1620 | {'p', "max-path-compression", "MAX_PATH_COMPRESSION", | ||
1621 | gettext_noop ("maximum path compression length"), | ||
1622 | 1, &GNUNET_GETOPT_set_uint, &max_path_compression}, | ||
1610 | GNUNET_GETOPT_OPTION_END | 1623 | GNUNET_GETOPT_OPTION_END |
1611 | }; | 1624 | }; |
1612 | int ret; | 1625 | int ret; |