aboutsummaryrefslogtreecommitdiff
path: root/src/ats/perf_ats_solver.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-05-12 20:01:32 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-05-12 20:01:32 +0000
commit72f0b708d9e177fe54d10c0414db77c9578aa5cd (patch)
treef802f2c084b22342eae99fe69704b6858c5f3f0a /src/ats/perf_ats_solver.c
parent116e346f3d01eaede6f48ef8aa0c9e03c71b0c19 (diff)
downloadgnunet-72f0b708d9e177fe54d10c0414db77c9578aa5cd.tar.gz
gnunet-72f0b708d9e177fe54d10c0414db77c9578aa5cd.zip
logging improvement for perf tool
intopt presolver support + cfg option
Diffstat (limited to 'src/ats/perf_ats_solver.c')
-rw-r--r--src/ats/perf_ats_solver.c266
1 files changed, 33 insertions, 233 deletions
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c
index 197414a6d..3f0c3e49d 100644
--- a/src/ats/perf_ats_solver.c
+++ b/src/ats/perf_ats_solver.c
@@ -75,16 +75,6 @@ struct PerfHandle
75 struct Iteration *iterations_results; 75 struct Iteration *iterations_results;
76 76
77 /** 77 /**
78 * Array to store averaged full solution result with length #peers
79 */
80 struct Result *averaged_full_result;
81
82 /**
83 * Array to store averaged updated solution result with length #peers
84 */
85 struct Result *averaged_update_result;
86
87 /**
88 * The current result 78 * The current result
89 */ 79 */
90 struct Result *current_result; 80 struct Result *current_result;
@@ -171,15 +161,7 @@ struct PerfHandle
171struct Iteration 161struct Iteration
172{ 162{
173 struct Result **results_array; 163 struct Result **results_array;
174 /**
175 * Head of the linked list
176 */
177 struct Result *result_head;
178 164
179 /**
180 * Tail of the linked list
181 */
182 struct Result *result_tail;
183}; 165};
184 166
185 167
@@ -337,8 +319,6 @@ end_now (int res)
337 319
338 GNUNET_free_non_null (ph.peers); 320 GNUNET_free_non_null (ph.peers);
339 GNUNET_free_non_null (ph.iterations_results); 321 GNUNET_free_non_null (ph.iterations_results);
340 GNUNET_free_non_null (ph.averaged_full_result);
341 GNUNET_free_non_null (ph.averaged_update_result);
342 322
343 GAS_normalization_stop (); 323 GAS_normalization_stop ();
344 ret = res; 324 ret = res;
@@ -380,7 +360,7 @@ perf_update_address (struct ATS_Address *cur)
380 abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100); 360 abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
381 rel_val = (100 + (double) abs_val) / 100; 361 rel_val = (100 + (double) abs_val) / 100;
382 362
383 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 363 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
384 "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n", 364 "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n",
385 GNUNET_i2s (&cur->peer), cur, 365 GNUNET_i2s (&cur->peer), cur,
386 "GNUNET_ATS_QUALITY_NET_DELAY", 366 "GNUNET_ATS_QUALITY_NET_DELAY",
@@ -393,7 +373,7 @@ perf_update_address (struct ATS_Address *cur)
393 abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10); 373 abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10);
394 rel_val = (100 + (double) abs_val) / 100; 374 rel_val = (100 + (double) abs_val) / 100;
395 375
396 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 376 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
397 "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n", 377 "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n",
398 GNUNET_i2s (&cur->peer), cur, "GNUNET_ATS_QUALITY_NET_DISTANCE", 378 GNUNET_i2s (&cur->peer), cur, "GNUNET_ATS_QUALITY_NET_DISTANCE",
399 abs_val, rel_val); 379 abs_val, rel_val);
@@ -603,9 +583,10 @@ solver_info_cb (void *cls,
603 /* Create new result */ 583 /* Create new result */
604 tmp = GNUNET_new (struct Result); 584 tmp = GNUNET_new (struct Result);
605 ph.current_result = tmp; 585 ph.current_result = tmp;
606 ph.iterations_results[ph.current_iteration-1].results_array[ph.current_p -1] = tmp; 586 ph.iterations_results[ph.current_iteration-1].results_array[ph.current_p] = tmp;
587 /*
607 GNUNET_CONTAINER_DLL_insert_tail(ph.iterations_results[ph.current_iteration-1].result_head, 588 GNUNET_CONTAINER_DLL_insert_tail(ph.iterations_results[ph.current_iteration-1].result_head,
608 ph.iterations_results[ph.current_iteration-1].result_tail, tmp); 589 ph.iterations_results[ph.current_iteration-1].result_tail, tmp);*/
609 ph.current_result->addresses = ph.current_a; 590 ph.current_result->addresses = ph.current_a;
610 ph.current_result->peers = ph.current_p; 591 ph.current_result->peers = ph.current_p;
611 ph.current_result->s_total = GNUNET_TIME_absolute_get(); 592 ph.current_result->s_total = GNUNET_TIME_absolute_get();
@@ -792,113 +773,17 @@ solver_info_cb (void *cls,
792static void 773static void
793evaluate (int iteration) 774evaluate (int iteration)
794{ 775{
795 struct GNUNET_DISK_FileHandle *f_full;
796 struct GNUNET_DISK_FileHandle *f_update;
797 char * data_fn_full;
798 char * data_fn_update;
799 char * data;
800 struct Result *cur; 776 struct Result *cur;
801 struct Result *next; 777 int cp;
802 struct Result *cur_res;
803 char * str_d_total;
804 char * str_d_setup;
805 char * str_d_lp;
806 char * str_d_mlp;
807 char * iter_text;
808
809 f_full = NULL;
810 f_update = NULL;
811
812 data_fn_full = NULL;
813
814 if (ph.create_datafile)
815 {
816 if (-1 == iteration)
817 GNUNET_asprintf (&iter_text, "%s", "avg");
818 else
819 GNUNET_asprintf (&iter_text, "%u", iteration);
820 GNUNET_asprintf (&data_fn_full,
821 "perf_%s_full_%s_%u_%u_%u.data",
822 ph.ats_string,
823 iter_text,
824 ph.N_peers_start,
825 ph.N_peers_end,
826 ph.N_address);
827 GNUNET_free (iter_text);
828 f_full = GNUNET_DISK_file_open (data_fn_full,
829 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
830 GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
831 if (NULL == f_full)
832 {
833 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
834 "Cannot open gnuplot file `%s'\n",
835 data_fn_full);
836 GNUNET_free (data_fn_full);
837 return;
838 }
839 data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n";
840 if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_full, data, strlen(data)))
841 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
842 "Cannot write data to log file `%s'\n",
843 data_fn_full);
844 }
845
846 data_fn_update = NULL;
847 if ((ph.create_datafile) && (GNUNET_YES == ph.measure_updates))
848 {
849 if (-1 == iteration)
850 GNUNET_asprintf (&iter_text, "%s", "avg");
851 else
852 GNUNET_asprintf (&iter_text, "%u", iteration);
853 GNUNET_asprintf (&data_fn_update, "perf_%s_update_i%u_%u_%u_%u.data",
854 ph.ats_string,
855 iter_text,
856 ph.N_peers_start,
857 ph.N_peers_end,
858 ph.N_address);
859 GNUNET_free (iter_text);
860 f_update = GNUNET_DISK_file_open (data_fn_update,
861 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
862 GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
863 if (NULL == f_update)
864 {
865 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
866 "Cannot open gnuplot file `%s'\n", data_fn_update);
867 GNUNET_free (data_fn_update);
868 if (NULL != f_full)
869 GNUNET_DISK_file_close (f_full);
870 GNUNET_free (data_fn_full);
871 return;
872 }
873 data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n";
874 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data)))
875 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
876 "Cannot write data to log file `%s'\n",
877 data_fn_update);
878 }
879 778
880 next = ph.iterations_results[ph.current_iteration -1].result_head; 779 for (cp = ph.N_peers_start; cp <= ph.N_peers_end; cp ++)
881 while (NULL != (cur = next))
882 { 780 {
883 next = cur->next; 781 cur = ph.iterations_results[ph.current_iteration-1].results_array[cp];
884 str_d_total = NULL; 782 if (0 == cp)
885 str_d_setup = NULL; 783 continue;
886 str_d_lp = NULL; 784 if (NULL == cur)
887 str_d_mlp = NULL; 785 GNUNET_break (0);
888
889 /* Print log */
890 if (GNUNET_NO == cur->update)
891 {
892 cur_res = &ph.averaged_full_result[cur->peers - ph.N_peers_start];
893 }
894 else
895 {
896 cur_res = &ph.averaged_update_result[cur->peers - ph.N_peers_start];
897 }
898 786
899 cur_res->peers = cur->peers;
900 cur_res->addresses = cur->addresses;
901 cur_res->update = cur->update;
902 787
903 if (GNUNET_NO == cur->valid) 788 if (GNUNET_NO == cur->valid)
904 { 789 {
@@ -908,131 +793,54 @@ evaluate (int iteration)
908 cur->peers, cur->addresses, "Failed to solve!"); 793 cur->peers, cur->addresses, "Failed to solve!");
909 continue; 794 continue;
910 } 795 }
911 else 796
912 cur_res->valid ++;
913 797
914 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_total.rel_value_us) 798 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_total.rel_value_us)
915 { 799 {
916 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_total.rel_value_us) 800 fprintf (stderr,
917 cur_res->d_total.rel_value_us = 0;
918 if (GNUNET_YES == cur->valid)
919 cur_res->d_total.rel_value_us += cur->d_total.rel_value_us;
920 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
921 "Total time to solve %s for %u peers %u addresses: %llu us\n", 801 "Total time to solve %s for %u peers %u addresses: %llu us\n",
922 (GNUNET_YES == cur->update) ? "updated" : "full", 802 (GNUNET_YES == cur->update) ? "updated" : "full",
923 cur->peers, cur->addresses, 803 cur->peers, cur->addresses,
924 (unsigned long long) cur->d_total.rel_value_us); 804 (unsigned long long) cur->d_total.rel_value_us);
925 GNUNET_asprintf(&str_d_total,
926 "%llu", (unsigned long long) cur->d_total.rel_value_us);
927 } 805 }
928 else 806
929 GNUNET_asprintf(&str_d_total, "-1"); 807
930 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_setup.rel_value_us) 808 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_setup.rel_value_us)
931 { 809 {
932 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_setup.rel_value_us)
933 cur_res->d_setup.rel_value_us = 0;
934 if (GNUNET_YES == cur->valid)
935 cur_res->d_setup.rel_value_us += cur->d_setup.rel_value_us;
936 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 810 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
937 "Total time to setup %s %u peers %u addresses: %llu us\n", 811 "Total time to setup %s %u peers %u addresses: %llu us\n",
938 (GNUNET_YES == cur->update) ? "updated" : "full", 812 (GNUNET_YES == cur->update) ? "updated" : "full",
939 cur->peers, cur->addresses, 813 cur->peers, cur->addresses,
940 (unsigned long long) cur->d_setup.rel_value_us); 814 (unsigned long long) cur->d_setup.rel_value_us);
941 GNUNET_asprintf(&str_d_setup, "%llu",
942 (unsigned long long )cur->d_setup.rel_value_us);
943 } 815 }
944 else
945 GNUNET_asprintf(&str_d_setup, "-1");
946 816
947 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us) 817 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us)
948 { 818 {
949 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_lp.rel_value_us)
950 cur_res->d_lp.rel_value_us = 0;
951 if (GNUNET_YES == cur->valid)
952 cur_res->d_lp.rel_value_us += cur->d_lp.rel_value_us;
953 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 819 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
954 "Total time to solve %s LP for %u peers %u addresses: %llu us\n", 820 "Total time to solve %s LP for %u peers %u addresses: %llu us\n",
955 (GNUNET_YES == cur->update) ? "updated" : "full", 821 (GNUNET_YES == cur->update) ? "updated" : "full",
956 cur->peers, 822 cur->peers,
957 cur->addresses, 823 cur->addresses,
958 (unsigned long long )cur->d_lp.rel_value_us); 824 (unsigned long long )cur->d_lp.rel_value_us);
959 GNUNET_asprintf (&str_d_lp,
960 "%llu", (unsigned long long )cur->d_lp.rel_value_us);
961 } 825 }
962 else
963 GNUNET_asprintf (&str_d_lp, "-1");
964 826
965 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us) 827 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us)
966 { 828 {
967 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_mlp.rel_value_us)
968 cur_res->d_mlp.rel_value_us = 0;
969 if (GNUNET_YES == cur->valid)
970 cur_res->d_mlp.rel_value_us += cur->d_mlp.rel_value_us;
971
972 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 829 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
973 "Total time to solve %s MLP for %u peers %u addresses: %llu us\n", 830 "Total time to solve %s MLP for %u peers %u addresses: %llu us\n",
974 (GNUNET_YES == cur->update) ? "updated" : "full", 831 (GNUNET_YES == cur->update) ? "updated" : "full",
975 cur->peers, cur->addresses, 832 cur->peers, cur->addresses,
976 (unsigned long long )cur->d_mlp.rel_value_us); 833 (unsigned long long )cur->d_mlp.rel_value_us);
977 GNUNET_asprintf (&str_d_mlp,
978 "%llu", (unsigned long long )cur->d_mlp.rel_value_us);
979 }
980 else
981 GNUNET_asprintf (&str_d_mlp, "-1");
982
983 data = NULL;
984 if (GNUNET_YES == ph.create_datafile)
985 {
986
987 GNUNET_asprintf (&data,
988 "%u;%u;%s;%s;%s;%s\n",
989 cur->peers, cur->addresses,
990 str_d_total,
991 str_d_setup,
992 str_d_lp,
993 str_d_mlp);
994 if (cur->update == GNUNET_NO)
995 {
996 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data, strlen(data)))
997 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
998 "Cannot write data to log file `%s'\n",
999 data_fn_full);
1000 }
1001 if ((cur->update == GNUNET_YES) && (NULL != f_update))
1002 {
1003 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data)))
1004 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1005 "Cannot write data to log file `%s'\n",
1006 data_fn_update);
1007 }
1008 GNUNET_free (data);
1009 } 834 }
1010 GNUNET_free_non_null (str_d_total);
1011 GNUNET_free_non_null (str_d_setup);
1012 GNUNET_free_non_null (str_d_lp);
1013 GNUNET_free_non_null (str_d_mlp);
1014
1015 GNUNET_CONTAINER_DLL_remove (ph.iterations_results[ph.current_iteration-1].result_head,
1016 ph.iterations_results[ph.current_iteration-1].result_tail, cur);
1017 //GNUNET_free (cur);
1018 } 835 }
1019 836
1020 if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full)))
1021 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
1022 data_fn_full);
1023 GNUNET_free_non_null (data_fn_full);
1024
1025 if ((NULL != f_update) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_update)))
1026 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
1027 data_fn_update);
1028 GNUNET_free_non_null (data_fn_update);
1029} 837}
1030 838
1031/** 839/**
1032 * Evaluate average results for all iterations 840 * Evaluate average results for all iterations
1033 */ 841 */
1034static void 842static void
1035evaluate_average (void) 843write_all_iterations (void)
1036{ 844{
1037 int c_iteration; 845 int c_iteration;
1038 int c_peer; 846 int c_peer;
@@ -1133,10 +941,14 @@ evaluate_average (void)
1133 struct Result *cur_res; 941 struct Result *cur_res;
1134 942
1135 //fprintf (stderr, "P: %u I: %u == %p \n", c_peer, c_iteration, cur_res); 943 //fprintf (stderr, "P: %u I: %u == %p \n", c_peer, c_iteration, cur_res);
1136 cur_res = ph.iterations_results[c_iteration].results_array[c_peer -1]; 944 cur_res = ph.iterations_results[c_iteration].results_array[c_peer];
945 if (c_peer == 0)
946 continue;
947 if (NULL == cur_res)
948 continue;
949
1137 //fprintf (stderr, "P: %u I: %u: P %i A %i\n", c_peer, c_iteration, cur_res->peers, cur_res->addresses); 950 //fprintf (stderr, "P: %u I: %u: P %i A %i\n", c_peer, c_iteration, cur_res->peers, cur_res->addresses);
1138 fprintf (stderr, "D total: %llu\n", (long long unsigned int) cur_res->d_total.rel_value_us); 951 //fprintf (stderr, "D total: %llu\n", (long long unsigned int) cur_res->d_total.rel_value_us);
1139 fprintf (stderr, "D total: %llu\n", (long long unsigned int) cur_res->d_total.rel_value_us);
1140 952
1141 data_tmp = GNUNET_strdup (data_str); 953 data_tmp = GNUNET_strdup (data_str);
1142 GNUNET_free (data_str); 954 GNUNET_free (data_str);
@@ -1149,7 +961,8 @@ evaluate_average (void)
1149 GNUNET_free (data_tmp); 961 GNUNET_free (data_tmp);
1150 962
1151 fprintf (stderr, "Result: %s\n", data_str); 963 fprintf (stderr, "Result: %s\n", data_str);
1152 GNUNET_DISK_file_write (f_full, data_str, strlen(data_str)); 964 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data_str, strlen(data_str)))
965 GNUNET_break (0);
1153 GNUNET_free (data_str); 966 GNUNET_free (data_str);
1154 } 967 }
1155 968
@@ -1180,7 +993,7 @@ perf_run_iteration (void)
1180 struct ATS_Address * cur_addr; 993 struct ATS_Address * cur_addr;
1181 uint32_t net; 994 uint32_t net;
1182 995
1183 ph.iterations_results[ph.current_iteration-1].results_array = GNUNET_malloc ((count_p) * sizeof (struct Result *)); 996 ph.iterations_results[ph.current_iteration-1].results_array = GNUNET_malloc ((count_p + 1) * sizeof (struct Result *));
1184 ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer)); 997 ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer));
1185 for (cp = 0; cp < count_p; cp++) 998 for (cp = 0; cp < count_p; cp++)
1186 perf_create_peer (cp); 999 perf_create_peer (cp);
@@ -1364,6 +1177,7 @@ run (void *cls, char * const *args, const char *cfgfile,
1364 if (0 == ph.N_address) 1177 if (0 == ph.N_address)
1365 ph.N_address = DEFAULT_ADDRESSES; 1178 ph.N_address = DEFAULT_ADDRESSES;
1366 1179
1180
1367 if (ph.N_peers_start != ph.N_peers_end) 1181 if (ph.N_peers_start != ph.N_peers_end)
1368 fprintf (stderr, "Benchmarking solver `%s' with %u to %u peers and %u addresses in %u iterations\n", 1182 fprintf (stderr, "Benchmarking solver `%s' with %u to %u peers and %u addresses in %u iterations\n",
1369 ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address, ph.total_iterations); 1183 ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address, ph.total_iterations);
@@ -1392,22 +1206,6 @@ run (void *cls, char * const *args, const char *cfgfile,
1392 1206
1393 /* Create array of DLL to store results for iterations */ 1207 /* Create array of DLL to store results for iterations */
1394 ph.iterations_results = GNUNET_malloc (sizeof (struct Iteration) * ph.total_iterations); 1208 ph.iterations_results = GNUNET_malloc (sizeof (struct Iteration) * ph.total_iterations);
1395 ph.averaged_full_result = GNUNET_malloc (sizeof (struct Result) * ((ph.N_peers_end + 1) - ph.N_peers_start));
1396 for (c = 0; c <= ph.N_peers_end - ph.N_peers_start; c++)
1397 {
1398 ph.averaged_full_result[c].d_setup = GNUNET_TIME_UNIT_FOREVER_REL;
1399 ph.averaged_full_result[c].d_total = GNUNET_TIME_UNIT_FOREVER_REL;
1400 ph.averaged_full_result[c].d_lp = GNUNET_TIME_UNIT_FOREVER_REL;
1401 ph.averaged_full_result[c].d_mlp = GNUNET_TIME_UNIT_FOREVER_REL;
1402 }
1403 ph.averaged_update_result = GNUNET_malloc (sizeof (struct Result) * ((ph.N_peers_end + 1) - ph.N_peers_start));
1404 for (c = 0; c <= ph.N_peers_end - ph.N_peers_start; c++)
1405 {
1406 ph.averaged_update_result[c].d_setup = GNUNET_TIME_UNIT_FOREVER_REL;
1407 ph.averaged_update_result[c].d_total = GNUNET_TIME_UNIT_FOREVER_REL;
1408 ph.averaged_update_result[c].d_lp = GNUNET_TIME_UNIT_FOREVER_REL;
1409 ph.averaged_update_result[c].d_mlp = GNUNET_TIME_UNIT_FOREVER_REL;
1410 }
1411 1209
1412 /* Load solver */ 1210 /* Load solver */
1413 ph.env.cfg = solver_cfg; 1211 ph.env.cfg = solver_cfg;
@@ -1452,7 +1250,8 @@ run (void *cls, char * const *args, const char *cfgfile,
1452 evaluate (ph.current_iteration); 1250 evaluate (ph.current_iteration);
1453 fprintf (stderr, "Iteration %u of %u done\n", ph.current_iteration, ph.total_iterations); 1251 fprintf (stderr, "Iteration %u of %u done\n", ph.current_iteration, ph.total_iterations);
1454 } 1252 }
1455 evaluate_average (); 1253 if (ph.create_datafile)
1254 write_all_iterations ();
1456 1255
1457 /* Unload solver*/ 1256 /* Unload solver*/
1458 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Unloading solver `%s'\n"), ph.ats_string); 1257 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Unloading solver `%s'\n"), ph.ats_string);
@@ -1462,14 +1261,15 @@ run (void *cls, char * const *args, const char *cfgfile,
1462 { 1261 {
1463 for (c2 = ph.N_peers_start; c2 < ph.N_peers_end; c2++ ) 1262 for (c2 = ph.N_peers_start; c2 < ph.N_peers_end; c2++ )
1464 { 1263 {
1264 if (0 == c2)
1265 continue;
1465 GNUNET_free (ph.iterations_results[c].results_array[c2]); 1266 GNUNET_free (ph.iterations_results[c].results_array[c2]);
1466 } 1267 }
1467 GNUNET_free(ph.iterations_results[c].results_array); 1268 GNUNET_free(ph.iterations_results[c].results_array);
1468 1269
1469 } 1270 }
1470 GNUNET_free (ph.iterations_results); 1271 GNUNET_free (ph.iterations_results);
1471 GNUNET_free (ph.averaged_full_result); 1272
1472 GNUNET_free (ph.averaged_update_result);
1473 GNUNET_CONFIGURATION_destroy (solver_cfg); 1273 GNUNET_CONFIGURATION_destroy (solver_cfg);
1474 GNUNET_STATISTICS_destroy (ph.stat, GNUNET_NO); 1274 GNUNET_STATISTICS_destroy (ph.stat, GNUNET_NO);
1475 ph.solver = NULL; 1275 ph.solver = NULL;