diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-09 18:03:03 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-05-09 18:03:03 +0000 |
commit | 380d6d885e12803bd972d47812e093f78ee859f8 (patch) | |
tree | a550ca50a4d42512c6b0d883ca4d33fdd82589ca /src/ats/perf_ats_solver.c | |
parent | db718fae66b0f4093730cac19b5d19d026ebf46e (diff) | |
download | gnunet-380d6d885e12803bd972d47812e093f78ee859f8.tar.gz gnunet-380d6d885e12803bd972d47812e093f78ee859f8.zip |
clean up for addresses and modification to perf to get values in averaging
Diffstat (limited to 'src/ats/perf_ats_solver.c')
-rw-r--r-- | src/ats/perf_ats_solver.c | 270 |
1 files changed, 85 insertions, 185 deletions
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 025fab721..066a7d4ec 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -38,47 +38,6 @@ | |||
38 | #define DEFAULT_ADDRESSES 10 | 38 | #define DEFAULT_ADDRESSES 10 |
39 | #define DEFAULT_ATS_COUNT 2 | 39 | #define DEFAULT_ATS_COUNT 2 |
40 | 40 | ||
41 | #define GNUPLOT_PROP_TEMPLATE "#!/usr/bin/gnuplot \n" \ | ||
42 | "set datafile separator ';' \n" \ | ||
43 | "set title \"Execution time Proportional solver \" \n" \ | ||
44 | "set xlabel \"Number of peers\" \n" \ | ||
45 | "set ylabel \"Execution time in us\" \n" \ | ||
46 | "set grid \n" | ||
47 | |||
48 | #define GNUPLOT_PROP_UPDATE_TEMPLATE "#!/usr/bin/gnuplot \n" \ | ||
49 | "set datafile separator ';' \n" \ | ||
50 | "set title \"Execution time Proportional solver with updated problem\" \n" \ | ||
51 | "set xlabel \"Number of peers\" \n" \ | ||
52 | "set ylabel \"Execution time in us\" \n" \ | ||
53 | "set grid \n" | ||
54 | |||
55 | #define GNUPLOT_MLP_TEMPLATE "#!/usr/bin/gnuplot \n" \ | ||
56 | "set datafile separator ';' \n" \ | ||
57 | "set title \"Execution time MLP solver \" \n" \ | ||
58 | "set xlabel \"Number of peers\" \n" \ | ||
59 | "set ylabel \"Execution time in us\" \n" \ | ||
60 | "set grid \n" | ||
61 | |||
62 | #define GNUPLOT_MLP_UPDATE_TEMPLATE "#!/usr/bin/gnuplot \n" \ | ||
63 | "set datafile separator ';' \n" \ | ||
64 | "set title \"Execution time MLP solver with updated problem\" \n" \ | ||
65 | "set xlabel \"Number of peers\" \n" \ | ||
66 | "set ylabel \"Execution time in us\" \n" \ | ||
67 | "set grid \n" | ||
68 | |||
69 | #define GNUPLOT_RIL_TEMPLATE "#!/usr/bin/gnuplot \n" \ | ||
70 | "set datafile separator ';' \n" \ | ||
71 | "set title \"Execution time RIL solver \" \n" \ | ||
72 | "set xlabel \"Number of peers\" \n" \ | ||
73 | "set ylabel \"Execution time in us\" \n" \ | ||
74 | "set grid \n" | ||
75 | |||
76 | #define GNUPLOT_RIL_UPDATE_TEMPLATE "#!/usr/bin/gnuplot \n" \ | ||
77 | "set datafile separator ';' \n" \ | ||
78 | "set title \"Execution time RIL solver with updated problem\" \n" \ | ||
79 | "set xlabel \"Number of peers\" \n" \ | ||
80 | "set ylabel \"Execution time in us\" \n" \ | ||
81 | "set grid \n" | ||
82 | 41 | ||
83 | /** | 42 | /** |
84 | * Handle for ATS address component | 43 | * Handle for ATS address component |
@@ -173,7 +132,7 @@ struct PerfHandle | |||
173 | /** | 132 | /** |
174 | * Create gnuplot file | 133 | * Create gnuplot file |
175 | */ | 134 | */ |
176 | int create_plot; | 135 | int create_datafile; |
177 | 136 | ||
178 | /** | 137 | /** |
179 | * Measure updates | 138 | * Measure updates |
@@ -211,6 +170,7 @@ struct PerfHandle | |||
211 | */ | 170 | */ |
212 | struct Iteration | 171 | struct Iteration |
213 | { | 172 | { |
173 | struct Result **results_array; | ||
214 | /** | 174 | /** |
215 | * Head of the linked list | 175 | * Head of the linked list |
216 | */ | 176 | */ |
@@ -630,6 +590,7 @@ solver_info_cb (void *cls, | |||
630 | /* Create new result */ | 590 | /* Create new result */ |
631 | tmp = GNUNET_new (struct Result); | 591 | tmp = GNUNET_new (struct Result); |
632 | ph.current_result = tmp; | 592 | ph.current_result = tmp; |
593 | ph.iterations_results[ph.current_iteration-1].results_array[ph.current_p -1] = tmp; | ||
633 | GNUNET_CONTAINER_DLL_insert_tail(ph.iterations_results[ph.current_iteration-1].result_head, | 594 | GNUNET_CONTAINER_DLL_insert_tail(ph.iterations_results[ph.current_iteration-1].result_head, |
634 | ph.iterations_results[ph.current_iteration-1].result_tail, tmp); | 595 | ph.iterations_results[ph.current_iteration-1].result_tail, tmp); |
635 | ph.current_result->addresses = ph.current_a; | 596 | ph.current_result->addresses = ph.current_a; |
@@ -810,122 +771,6 @@ solver_info_cb (void *cls, | |||
810 | } | 771 | } |
811 | } | 772 | } |
812 | 773 | ||
813 | static void | ||
814 | write_gnuplot_script (char * data_fn, int iteration, int full) | ||
815 | { | ||
816 | struct GNUNET_DISK_FileHandle *f; | ||
817 | char * gfn; | ||
818 | char *data; | ||
819 | char *iter_text; | ||
820 | char *template; | ||
821 | |||
822 | /* Write header */ | ||
823 | switch (ph.ats_mode) { | ||
824 | case MODE_PROPORTIONAL: | ||
825 | if (GNUNET_YES == full) | ||
826 | template = GNUPLOT_PROP_TEMPLATE; | ||
827 | else | ||
828 | template = GNUPLOT_PROP_UPDATE_TEMPLATE; | ||
829 | break; | ||
830 | case MODE_MLP: | ||
831 | if (GNUNET_YES == full) | ||
832 | template = GNUPLOT_MLP_TEMPLATE; | ||
833 | else | ||
834 | template = GNUPLOT_MLP_UPDATE_TEMPLATE; | ||
835 | break; | ||
836 | case MODE_RIL: | ||
837 | if (GNUNET_YES == full) | ||
838 | template = GNUPLOT_RIL_TEMPLATE; | ||
839 | else | ||
840 | template = GNUPLOT_RIL_UPDATE_TEMPLATE; | ||
841 | break; | ||
842 | default: | ||
843 | GNUNET_break (0); | ||
844 | return; | ||
845 | } | ||
846 | if (-1 == iteration) | ||
847 | GNUNET_asprintf (&iter_text, "%s_%u", "avg",ph.total_iterations); | ||
848 | else | ||
849 | GNUNET_asprintf (&iter_text, "%u", iteration); | ||
850 | if (GNUNET_YES == full) | ||
851 | { | ||
852 | GNUNET_asprintf (&gfn, "perf_%s_full_%s-%u_%u_%u.gnuplot", | ||
853 | ph.ats_string, | ||
854 | iter_text, | ||
855 | ph.N_peers_start, | ||
856 | ph.N_peers_end, | ||
857 | ph.N_address); | ||
858 | } | ||
859 | else | ||
860 | { | ||
861 | GNUNET_asprintf (&gfn, "perf_%s_updat_%s-%u_%u_%u.gnuplot", | ||
862 | ph.ats_string, | ||
863 | iter_text, | ||
864 | ph.N_peers_start, | ||
865 | ph.N_peers_end, | ||
866 | ph.N_address); | ||
867 | } | ||
868 | GNUNET_free (iter_text); | ||
869 | |||
870 | f = GNUNET_DISK_file_open (gfn, | ||
871 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, | ||
872 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
873 | if (NULL == f) | ||
874 | { | ||
875 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", gfn); | ||
876 | GNUNET_free (gfn); | ||
877 | return; | ||
878 | } | ||
879 | |||
880 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, template, strlen(template))) | ||
881 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
882 | |||
883 | data = NULL; | ||
884 | if (MODE_PROPORTIONAL == ph.ats_mode) | ||
885 | { | ||
886 | GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time to solve'\n" \ | ||
887 | "pause -1", | ||
888 | data_fn, 3); | ||
889 | } | ||
890 | else if (MODE_MLP == ph.ats_mode) | ||
891 | { | ||
892 | GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time to solve',\\\n" \ | ||
893 | "'%s' using 1:%u with lines title 'Time to setup',\\\n" | ||
894 | "'%s' using 1:%u with lines title 'Time to solve LP',\\\n" | ||
895 | "'%s' using 1:%u with lines title 'Total time to solve MLP'\n" \ | ||
896 | "pause -1", | ||
897 | data_fn, 3, | ||
898 | data_fn, 4, | ||
899 | data_fn, 5, | ||
900 | data_fn, 6); | ||
901 | } | ||
902 | else if (MODE_RIL == ph.ats_mode) | ||
903 | { | ||
904 | GNUNET_asprintf (&data, | ||
905 | "plot '%s' using 1:%u with lines title 'Total time to solve'\n" \ | ||
906 | "pause -1", | ||
907 | data_fn, 3); | ||
908 | } | ||
909 | |||
910 | if ((NULL != data) && | ||
911 | (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen(data)))) | ||
912 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
913 | "Cannot write data to plot file `%s'\n", | ||
914 | gfn); | ||
915 | GNUNET_free_non_null (data); | ||
916 | |||
917 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) | ||
918 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
919 | "Cannot close gnuplot file `%s'\n", | ||
920 | gfn); | ||
921 | else | ||
922 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
923 | "Data successfully written to plot file `%s'\n", | ||
924 | gfn); | ||
925 | GNUNET_free (gfn); | ||
926 | |||
927 | } | ||
928 | |||
929 | /** | 774 | /** |
930 | * Evaluate results for a specific iteration | 775 | * Evaluate results for a specific iteration |
931 | * | 776 | * |
@@ -953,7 +798,7 @@ evaluate (int iteration) | |||
953 | 798 | ||
954 | data_fn_full = NULL; | 799 | data_fn_full = NULL; |
955 | 800 | ||
956 | if (ph.create_plot) | 801 | if (ph.create_datafile) |
957 | { | 802 | { |
958 | if (-1 == iteration) | 803 | if (-1 == iteration) |
959 | GNUNET_asprintf (&iter_text, "%s", "avg"); | 804 | GNUNET_asprintf (&iter_text, "%s", "avg"); |
@@ -983,11 +828,10 @@ evaluate (int iteration) | |||
983 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 828 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
984 | "Cannot write data to log file `%s'\n", | 829 | "Cannot write data to log file `%s'\n", |
985 | data_fn_full); | 830 | data_fn_full); |
986 | write_gnuplot_script (data_fn_full, iteration, GNUNET_YES); | ||
987 | } | 831 | } |
988 | 832 | ||
989 | data_fn_update = NULL; | 833 | data_fn_update = NULL; |
990 | if ((ph.create_plot) && (GNUNET_YES == ph.measure_updates)) | 834 | if ((ph.create_datafile) && (GNUNET_YES == ph.measure_updates)) |
991 | { | 835 | { |
992 | if (-1 == iteration) | 836 | if (-1 == iteration) |
993 | GNUNET_asprintf (&iter_text, "%s", "avg"); | 837 | GNUNET_asprintf (&iter_text, "%s", "avg"); |
@@ -1018,7 +862,6 @@ evaluate (int iteration) | |||
1018 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 862 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1019 | "Cannot write data to log file `%s'\n", | 863 | "Cannot write data to log file `%s'\n", |
1020 | data_fn_update); | 864 | data_fn_update); |
1021 | write_gnuplot_script (data_fn_update, iteration, GNUNET_NO); | ||
1022 | } | 865 | } |
1023 | 866 | ||
1024 | next = ph.iterations_results[ph.current_iteration -1].result_head; | 867 | next = ph.iterations_results[ph.current_iteration -1].result_head; |
@@ -1123,7 +966,7 @@ evaluate (int iteration) | |||
1123 | GNUNET_asprintf (&str_d_mlp, "-1"); | 966 | GNUNET_asprintf (&str_d_mlp, "-1"); |
1124 | 967 | ||
1125 | data = NULL; | 968 | data = NULL; |
1126 | if (GNUNET_YES == ph.create_plot) | 969 | if (GNUNET_YES == ph.create_datafile) |
1127 | { | 970 | { |
1128 | 971 | ||
1129 | GNUNET_asprintf (&data, | 972 | GNUNET_asprintf (&data, |
@@ -1156,7 +999,7 @@ evaluate (int iteration) | |||
1156 | 999 | ||
1157 | GNUNET_CONTAINER_DLL_remove (ph.iterations_results[ph.current_iteration-1].result_head, | 1000 | GNUNET_CONTAINER_DLL_remove (ph.iterations_results[ph.current_iteration-1].result_head, |
1158 | ph.iterations_results[ph.current_iteration-1].result_tail, cur); | 1001 | ph.iterations_results[ph.current_iteration-1].result_tail, cur); |
1159 | GNUNET_free (cur); | 1002 | //GNUNET_free (cur); |
1160 | } | 1003 | } |
1161 | 1004 | ||
1162 | if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full))) | 1005 | if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full))) |
@@ -1176,8 +1019,8 @@ evaluate (int iteration) | |||
1176 | static void | 1019 | static void |
1177 | evaluate_average (void) | 1020 | evaluate_average (void) |
1178 | { | 1021 | { |
1179 | int c_o; | 1022 | int c_iteration; |
1180 | int c_i; | 1023 | int c_peer; |
1181 | 1024 | ||
1182 | struct GNUNET_DISK_FileHandle *f_full; | 1025 | struct GNUNET_DISK_FileHandle *f_full; |
1183 | struct GNUNET_DISK_FileHandle *f_update; | 1026 | struct GNUNET_DISK_FileHandle *f_update; |
@@ -1185,17 +1028,18 @@ evaluate_average (void) | |||
1185 | char * data_fn_full; | 1028 | char * data_fn_full; |
1186 | char * data_fn_update; | 1029 | char * data_fn_update; |
1187 | char * data; | 1030 | char * data; |
1031 | /* | ||
1188 | char * str_d_total; | 1032 | char * str_d_total; |
1189 | char * str_d_setup; | 1033 | char * str_d_setup; |
1190 | char * str_d_lp; | 1034 | char * str_d_lp; |
1191 | char * str_d_mlp; | 1035 | char * str_d_mlp; |
1192 | 1036 | */ | |
1193 | f_full = NULL; | 1037 | f_full = NULL; |
1194 | f_update = NULL; | 1038 | f_update = NULL; |
1195 | 1039 | ||
1196 | data_fn_full = NULL; | 1040 | data_fn_full = NULL; |
1197 | 1041 | ||
1198 | if (ph.create_plot) | 1042 | if (ph.create_datafile) |
1199 | { | 1043 | { |
1200 | GNUNET_asprintf (&data_fn_full, | 1044 | GNUNET_asprintf (&data_fn_full, |
1201 | "perf_%s_full_avg_%u-%u_%u_%u.data", | 1045 | "perf_%s_full_avg_%u-%u_%u_%u.data", |
@@ -1204,6 +1048,10 @@ evaluate_average (void) | |||
1204 | ph.N_peers_start, | 1048 | ph.N_peers_start, |
1205 | ph.N_peers_end, | 1049 | ph.N_peers_end, |
1206 | ph.N_address); | 1050 | ph.N_address); |
1051 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1052 | "Using data file `%s'\n", | ||
1053 | data_fn_full); | ||
1054 | |||
1207 | f_full = GNUNET_DISK_file_open (data_fn_full, | 1055 | f_full = GNUNET_DISK_file_open (data_fn_full, |
1208 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, | 1056 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, |
1209 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 1057 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
@@ -1215,16 +1063,20 @@ evaluate_average (void) | |||
1215 | GNUNET_free (data_fn_full); | 1063 | GNUNET_free (data_fn_full); |
1216 | return; | 1064 | return; |
1217 | } | 1065 | } |
1066 | |||
1067 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1068 | "Using update data file `%s'\n", | ||
1069 | data_fn_full); | ||
1070 | |||
1218 | data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n"; | 1071 | data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n"; |
1219 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_full, data, strlen(data))) | 1072 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_full, data, strlen(data))) |
1220 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1073 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1221 | "Cannot write data to log file `%s'\n", | 1074 | "Cannot write data to log file `%s'\n", |
1222 | data_fn_full); | 1075 | data_fn_full); |
1223 | write_gnuplot_script (data_fn_full, -1, GNUNET_YES); | ||
1224 | } | 1076 | } |
1225 | 1077 | ||
1226 | data_fn_update = NULL; | 1078 | data_fn_update = NULL; |
1227 | if ((ph.create_plot) && (GNUNET_YES == ph.measure_updates)) | 1079 | if ((ph.create_datafile) && (GNUNET_YES == ph.measure_updates)) |
1228 | { | 1080 | { |
1229 | GNUNET_asprintf (&data_fn_update, "perf_%s_update_avg_%u-%u_%u_%u.data", | 1081 | GNUNET_asprintf (&data_fn_update, "perf_%s_update_avg_%u-%u_%u_%u.data", |
1230 | ph.ats_string, | 1082 | ph.ats_string, |
@@ -1245,14 +1097,59 @@ evaluate_average (void) | |||
1245 | GNUNET_free (data_fn_full); | 1097 | GNUNET_free (data_fn_full); |
1246 | return; | 1098 | return; |
1247 | } | 1099 | } |
1100 | |||
1101 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1102 | "Using update data file `%s'\n", | ||
1103 | data_fn_update); | ||
1104 | |||
1248 | data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n"; | 1105 | data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n"; |
1249 | if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data))) | 1106 | if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data))) |
1250 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1107 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1251 | "Cannot write data to log file `%s'\n", | 1108 | "Cannot write data to log file `%s'\n", |
1252 | data_fn_update); | 1109 | data_fn_update); |
1253 | write_gnuplot_script (data_fn_update, -1, GNUNET_NO); | ||
1254 | } | 1110 | } |
1255 | 1111 | ||
1112 | /* NEW log */ | ||
1113 | for (c_peer = ph.N_peers_start; c_peer <= ph.N_peers_end; c_peer ++) | ||
1114 | { | ||
1115 | char * data_str; | ||
1116 | char * data_tmp; | ||
1117 | GNUNET_asprintf(&data_str, "%u;%u",c_peer, ph.N_address); | ||
1118 | for (c_iteration = 0; c_iteration < ph.total_iterations; c_iteration ++) | ||
1119 | { | ||
1120 | struct Result *cur_res; | ||
1121 | |||
1122 | cur_res = ph.iterations_results[c_iteration].results_array[c_peer -1]; | ||
1123 | fprintf (stderr, "P: %u I: %u: P %i A %i\n", c_peer, c_iteration, cur_res->peers, cur_res->addresses); | ||
1124 | fprintf (stderr, "D total: %llu\n", (long long unsigned int) cur_res->d_total.rel_value_us); | ||
1125 | |||
1126 | data_tmp = GNUNET_strdup (data_str); | ||
1127 | GNUNET_free (data_str); | ||
1128 | GNUNET_asprintf (&data_str, "%s;%llu", data_tmp, cur_res->d_total.rel_value_us); | ||
1129 | GNUNET_free (data_tmp); | ||
1130 | } | ||
1131 | data_tmp = GNUNET_strdup (data_str); | ||
1132 | GNUNET_free (data_str); | ||
1133 | GNUNET_asprintf (&data_str, "%s\n", data_tmp); | ||
1134 | GNUNET_free (data_tmp); | ||
1135 | |||
1136 | fprintf (stderr, "Result: %s\n", data_str); | ||
1137 | GNUNET_DISK_file_write (f_full, data_str, strlen(data_str)); | ||
1138 | GNUNET_free (data_str); | ||
1139 | } | ||
1140 | /* NEW log */ | ||
1141 | |||
1142 | if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full))) | ||
1143 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", | ||
1144 | data_fn_full); | ||
1145 | GNUNET_free_non_null (data_fn_full); | ||
1146 | |||
1147 | if ((NULL != f_update) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_update))) | ||
1148 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", | ||
1149 | data_fn_update); | ||
1150 | GNUNET_free_non_null (data_fn_update); | ||
1151 | |||
1152 | #if 0 | ||
1256 | for (c_o = 0; c_o < 2; c_o++) | 1153 | for (c_o = 0; c_o < 2; c_o++) |
1257 | { | 1154 | { |
1258 | if (0 == c_o) | 1155 | if (0 == c_o) |
@@ -1350,7 +1247,7 @@ evaluate_average (void) | |||
1350 | GNUNET_asprintf (&str_d_mlp, "-1"); | 1247 | GNUNET_asprintf (&str_d_mlp, "-1"); |
1351 | 1248 | ||
1352 | data = NULL; | 1249 | data = NULL; |
1353 | if (GNUNET_YES == ph.create_plot) | 1250 | if (GNUNET_YES == ph.create_datafile) |
1354 | { | 1251 | { |
1355 | GNUNET_asprintf (&data, | 1252 | GNUNET_asprintf (&data, |
1356 | "%u;%u;%s;%s;%s;%s\n", | 1253 | "%u;%u;%s;%s;%s;%s\n", |
@@ -1382,16 +1279,8 @@ evaluate_average (void) | |||
1382 | GNUNET_free_non_null (str_d_mlp); | 1279 | GNUNET_free_non_null (str_d_mlp); |
1383 | } | 1280 | } |
1384 | } | 1281 | } |
1282 | #endif | ||
1385 | 1283 | ||
1386 | if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full))) | ||
1387 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", | ||
1388 | data_fn_full); | ||
1389 | GNUNET_free_non_null (data_fn_full); | ||
1390 | |||
1391 | if ((NULL != f_update) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_update))) | ||
1392 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", | ||
1393 | data_fn_update); | ||
1394 | GNUNET_free_non_null (data_fn_update); | ||
1395 | } | 1284 | } |
1396 | 1285 | ||
1397 | /** | 1286 | /** |
@@ -1410,6 +1299,7 @@ perf_run_iteration (void) | |||
1410 | struct ATS_Address * cur_addr; | 1299 | struct ATS_Address * cur_addr; |
1411 | 1300 | ||
1412 | 1301 | ||
1302 | ph.iterations_results[ph.current_iteration-1].results_array = GNUNET_malloc ((count_p) * sizeof (struct Result *)); | ||
1413 | ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer)); | 1303 | ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer)); |
1414 | for (cp = 0; cp < count_p; cp++) | 1304 | for (cp = 0; cp < count_p; cp++) |
1415 | perf_create_peer (cp); | 1305 | perf_create_peer (cp); |
@@ -1527,6 +1417,7 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
1527 | unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount]; | 1417 | unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount]; |
1528 | unsigned long long quotas_out[GNUNET_ATS_NetworkTypeCount]; | 1418 | unsigned long long quotas_out[GNUNET_ATS_NetworkTypeCount]; |
1529 | int c; | 1419 | int c; |
1420 | int c2; | ||
1530 | 1421 | ||
1531 | /* Extract test name */ | 1422 | /* Extract test name */ |
1532 | if (NULL == (sep = (strstr (src_filename,".c")))) | 1423 | if (NULL == (sep = (strstr (src_filename,".c")))) |
@@ -1677,6 +1568,15 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
1677 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Unloading solver `%s'\n"), ph.ats_string); | 1568 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Unloading solver `%s'\n"), ph.ats_string); |
1678 | GNUNET_PLUGIN_unload (plugin, ph.solver); | 1569 | GNUNET_PLUGIN_unload (plugin, ph.solver); |
1679 | GNUNET_free (plugin); | 1570 | GNUNET_free (plugin); |
1571 | for (c = 0; c < ph.total_iterations; c++ ) | ||
1572 | { | ||
1573 | for (c2 = ph.N_peers_start; c2 < ph.N_peers_end; c2++ ) | ||
1574 | { | ||
1575 | GNUNET_free (ph.iterations_results[c].results_array[c2]); | ||
1576 | } | ||
1577 | GNUNET_free(ph.iterations_results[c].results_array); | ||
1578 | |||
1579 | } | ||
1680 | GNUNET_free (ph.iterations_results); | 1580 | GNUNET_free (ph.iterations_results); |
1681 | GNUNET_free (ph.averaged_full_result); | 1581 | GNUNET_free (ph.averaged_full_result); |
1682 | GNUNET_free (ph.averaged_update_result); | 1582 | GNUNET_free (ph.averaged_update_result); |
@@ -1700,7 +1600,7 @@ main (int argc, char *argv[]) | |||
1700 | ph.N_peers_end = 0; | 1600 | ph.N_peers_end = 0; |
1701 | ph.N_address = 0; | 1601 | ph.N_address = 0; |
1702 | ph.ats_string = NULL; | 1602 | ph.ats_string = NULL; |
1703 | ph.create_plot = GNUNET_NO; | 1603 | ph.create_datafile = GNUNET_NO; |
1704 | ph.measure_updates = GNUNET_NO; | 1604 | ph.measure_updates = GNUNET_NO; |
1705 | ph.total_iterations = 1; | 1605 | ph.total_iterations = 1; |
1706 | 1606 | ||
@@ -1720,9 +1620,9 @@ main (int argc, char *argv[]) | |||
1720 | { 'p', "percentage", NULL, | 1620 | { 'p', "percentage", NULL, |
1721 | gettext_noop ("update a fix percentage of addresses"), | 1621 | gettext_noop ("update a fix percentage of addresses"), |
1722 | 1, &GNUNET_GETOPT_set_uint, &ph.opt_update_percent }, | 1622 | 1, &GNUNET_GETOPT_set_uint, &ph.opt_update_percent }, |
1723 | { 'g', "gnuplot", NULL, | 1623 | { 'd', "data", NULL, |
1724 | gettext_noop ("create GNUplot file"), | 1624 | gettext_noop ("create data file"), |
1725 | 0, &GNUNET_GETOPT_set_one, &ph.create_plot}, | 1625 | 0, &GNUNET_GETOPT_set_one, &ph.create_datafile}, |
1726 | { 'u', "update", NULL, | 1626 | { 'u', "update", NULL, |
1727 | gettext_noop ("measure updates"), | 1627 | gettext_noop ("measure updates"), |
1728 | 0, &GNUNET_GETOPT_set_one, &ph.measure_updates}, | 1628 | 0, &GNUNET_GETOPT_set_one, &ph.measure_updates}, |