aboutsummaryrefslogtreecommitdiff
path: root/src/ats/perf_ats_solver.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-01-28 10:04:12 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-01-28 10:04:12 +0000
commitec310a9a392987e8ddcaf14266f104d73a678b03 (patch)
treeca9dd16f5e95aad70c4ccfa899232b419de147d7 /src/ats/perf_ats_solver.c
parente4d89c9377aef71f0460d1ee1dcaaa6aa4ef6a05 (diff)
downloadgnunet-ec310a9a392987e8ddcaf14266f104d73a678b03.tar.gz
gnunet-ec310a9a392987e8ddcaf14266f104d73a678b03.zip
improved benchmark output
Diffstat (limited to 'src/ats/perf_ats_solver.c')
-rw-r--r--src/ats/perf_ats_solver.c291
1 files changed, 170 insertions, 121 deletions
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c
index c42ddf44b..1aac4f703 100644
--- a/src/ats/perf_ats_solver.c
+++ b/src/ats/perf_ats_solver.c
@@ -183,7 +183,7 @@ struct PerfHandle
183 /** 183 /**
184 * Number of iterations 184 * Number of iterations
185 */ 185 */
186 int iterations; 186 int total_iterations;
187 187
188 /** 188 /**
189 * Current iteration 189 * Current iteration
@@ -199,6 +199,11 @@ struct PerfHandle
199 * Is a bulk operation running? 199 * Is a bulk operation running?
200 */ 200 */
201 int expecting_solution; 201 int expecting_solution;
202
203 /**
204 * Was the problem just updates?
205 */
206 int performed_update;
202}; 207};
203 208
204/** 209/**
@@ -635,10 +640,15 @@ solver_info_cb (void *cls,
635 ph.current_result->d_lp = GNUNET_TIME_UNIT_FOREVER_REL; 640 ph.current_result->d_lp = GNUNET_TIME_UNIT_FOREVER_REL;
636 ph.current_result->d_mlp = GNUNET_TIME_UNIT_FOREVER_REL; 641 ph.current_result->d_mlp = GNUNET_TIME_UNIT_FOREVER_REL;
637 ph.current_result->info = add; 642 ph.current_result->info = add;
638 if (add == GAS_INFO_UPDATED) 643 if ((add == GAS_INFO_UPDATED) || (GNUNET_YES == ph.performed_update))
644 {
639 ph.current_result->update = GNUNET_YES; 645 ph.current_result->update = GNUNET_YES;
646 }
640 else 647 else
648 {
641 ph.current_result->update = GNUNET_NO; 649 ph.current_result->update = GNUNET_NO;
650 }
651
642 } 652 }
643 return; 653 return;
644 case GAS_OP_SOLVE_STOP: 654 case GAS_OP_SOLVE_STOP:
@@ -834,7 +844,7 @@ write_gnuplot_script (char * data_fn, int iteration, int full)
834 return; 844 return;
835 } 845 }
836 if (-1 == iteration) 846 if (-1 == iteration)
837 GNUNET_asprintf (&iter_text, "%s_%u", "avg",ph.iterations); 847 GNUNET_asprintf (&iter_text, "%s_%u", "avg",ph.total_iterations);
838 else 848 else
839 GNUNET_asprintf (&iter_text, "%u", iteration); 849 GNUNET_asprintf (&iter_text, "%u", iteration);
840 if (GNUNET_YES == full) 850 if (GNUNET_YES == full)
@@ -1022,9 +1032,13 @@ evaluate (int iteration)
1022 1032
1023 /* Print log */ 1033 /* Print log */
1024 if (GNUNET_NO == cur->update) 1034 if (GNUNET_NO == cur->update)
1035 {
1025 cur_res = &ph.averaged_full_result[cur->peers - ph.N_peers_start]; 1036 cur_res = &ph.averaged_full_result[cur->peers - ph.N_peers_start];
1037 }
1026 else 1038 else
1039 {
1027 cur_res = &ph.averaged_update_result[cur->peers - ph.N_peers_start]; 1040 cur_res = &ph.averaged_update_result[cur->peers - ph.N_peers_start];
1041 }
1028 1042
1029 cur_res->peers = cur->peers; 1043 cur_res->peers = cur->peers;
1030 cur_res->addresses = cur->addresses; 1044 cur_res->addresses = cur->addresses;
@@ -1048,12 +1062,12 @@ evaluate (int iteration)
1048 if (GNUNET_YES == cur->valid) 1062 if (GNUNET_YES == cur->valid)
1049 cur_res->d_total.rel_value_us += cur->d_total.rel_value_us; 1063 cur_res->d_total.rel_value_us += cur->d_total.rel_value_us;
1050 fprintf (stderr, 1064 fprintf (stderr,
1051 "Total time to solve %s for %u peers %u addresses: %llu us\n", 1065 "Total time to solve %s for %u peers %u addresses: %llu us\n",
1052 (GNUNET_YES == cur->update) ? "updated" : "full", 1066 (GNUNET_YES == cur->update) ? "updated" : "full",
1053 cur->peers, cur->addresses, (unsigned long long) cur->d_total.rel_value_us); 1067 cur->peers, cur->addresses,
1068 (unsigned long long) cur->d_total.rel_value_us);
1054 GNUNET_asprintf(&str_d_total, 1069 GNUNET_asprintf(&str_d_total,
1055 "%llu", 1070 "%llu", (unsigned long long) cur->d_total.rel_value_us);
1056 (unsigned long long) cur->d_total.rel_value_us);
1057 } 1071 }
1058 else 1072 else
1059 GNUNET_asprintf(&str_d_total, "-1"); 1073 GNUNET_asprintf(&str_d_total, "-1");
@@ -1065,11 +1079,14 @@ evaluate (int iteration)
1065 cur_res->d_setup.rel_value_us += cur->d_setup.rel_value_us; 1079 cur_res->d_setup.rel_value_us += cur->d_setup.rel_value_us;
1066 fprintf (stderr, "Total time to setup %s %u peers %u addresses: %llu us\n", 1080 fprintf (stderr, "Total time to setup %s %u peers %u addresses: %llu us\n",
1067 (GNUNET_YES == cur->update) ? "updated" : "full", 1081 (GNUNET_YES == cur->update) ? "updated" : "full",
1068 cur->peers, cur->addresses, (unsigned long long )cur->d_setup.rel_value_us); 1082 cur->peers, cur->addresses,
1069 GNUNET_asprintf(&str_d_setup, "%llu", (unsigned long long )cur->d_setup.rel_value_us); 1083 (unsigned long long) cur->d_setup.rel_value_us);
1084 GNUNET_asprintf(&str_d_setup, "%llu",
1085 (unsigned long long )cur->d_setup.rel_value_us);
1070 } 1086 }
1071 else 1087 else
1072 GNUNET_asprintf(&str_d_setup, "-1"); 1088 GNUNET_asprintf(&str_d_setup, "-1");
1089
1073 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us) 1090 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us)
1074 { 1091 {
1075 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_lp.rel_value_us) 1092 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_lp.rel_value_us)
@@ -1077,17 +1094,17 @@ evaluate (int iteration)
1077 if (GNUNET_YES == cur->valid) 1094 if (GNUNET_YES == cur->valid)
1078 cur_res->d_lp.rel_value_us += cur->d_lp.rel_value_us; 1095 cur_res->d_lp.rel_value_us += cur->d_lp.rel_value_us;
1079 fprintf (stderr, 1096 fprintf (stderr,
1080 "Total time to solve %s LP for %u peers %u addresses: %llu us\n", 1097 "Total time to solve %s LP for %u peers %u addresses: %llu us\n",
1081 (GNUNET_YES == cur->update) ? "updated" : "full", 1098 (GNUNET_YES == cur->update) ? "updated" : "full",
1082 cur->peers, 1099 cur->peers,
1083 cur->addresses, 1100 cur->addresses,
1084 (unsigned long long )cur->d_lp.rel_value_us); 1101 (unsigned long long )cur->d_lp.rel_value_us);
1085 GNUNET_asprintf (&str_d_lp, 1102 GNUNET_asprintf (&str_d_lp,
1086 "%llu", 1103 "%llu", (unsigned long long )cur->d_lp.rel_value_us);
1087 (unsigned long long )cur->d_lp.rel_value_us);
1088 } 1104 }
1089 else 1105 else
1090 GNUNET_asprintf (&str_d_lp, "-1"); 1106 GNUNET_asprintf (&str_d_lp, "-1");
1107
1091 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us) 1108 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us)
1092 { 1109 {
1093 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_mlp.rel_value_us) 1110 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_mlp.rel_value_us)
@@ -1097,10 +1114,10 @@ evaluate (int iteration)
1097 1114
1098 fprintf (stderr, "Total time to solve %s MLP for %u peers %u addresses: %llu us\n", 1115 fprintf (stderr, "Total time to solve %s MLP for %u peers %u addresses: %llu us\n",
1099 (GNUNET_YES == cur->update) ? "updated" : "full", 1116 (GNUNET_YES == cur->update) ? "updated" : "full",
1100 cur->peers, cur->addresses, (unsigned long long )cur->d_mlp.rel_value_us); 1117 cur->peers, cur->addresses,
1118 (unsigned long long )cur->d_mlp.rel_value_us);
1101 GNUNET_asprintf (&str_d_mlp, 1119 GNUNET_asprintf (&str_d_mlp,
1102 "%llu", 1120 "%llu", (unsigned long long )cur->d_mlp.rel_value_us);
1103 (unsigned long long )cur->d_mlp.rel_value_us);
1104 } 1121 }
1105 else 1122 else
1106 GNUNET_asprintf (&str_d_mlp, "-1"); 1123 GNUNET_asprintf (&str_d_mlp, "-1");
@@ -1159,10 +1176,12 @@ evaluate (int iteration)
1159static void 1176static void
1160evaluate_average (void) 1177evaluate_average (void)
1161{ 1178{
1162 int c; 1179 int c_o;
1180 int c_i;
1163 1181
1164 struct GNUNET_DISK_FileHandle *f_full; 1182 struct GNUNET_DISK_FileHandle *f_full;
1165 struct GNUNET_DISK_FileHandle *f_update; 1183 struct GNUNET_DISK_FileHandle *f_update;
1184 struct Result *cur;
1166 char * data_fn_full; 1185 char * data_fn_full;
1167 char * data_fn_update; 1186 char * data_fn_update;
1168 char * data; 1187 char * data;
@@ -1181,7 +1200,7 @@ evaluate_average (void)
1181 GNUNET_asprintf (&data_fn_full, 1200 GNUNET_asprintf (&data_fn_full,
1182 "perf_%s_full_avg_%u-%u_%u_%u.data", 1201 "perf_%s_full_avg_%u-%u_%u_%u.data",
1183 ph.ats_string, 1202 ph.ats_string,
1184 ph.iterations, 1203 ph.total_iterations,
1185 ph.N_peers_start, 1204 ph.N_peers_start,
1186 ph.N_peers_end, 1205 ph.N_peers_end,
1187 ph.N_address); 1206 ph.N_address);
@@ -1209,7 +1228,7 @@ evaluate_average (void)
1209 { 1228 {
1210 GNUNET_asprintf (&data_fn_update, "perf_%s_update_avg_%u-%u_%u_%u.data", 1229 GNUNET_asprintf (&data_fn_update, "perf_%s_update_avg_%u-%u_%u_%u.data",
1211 ph.ats_string, 1230 ph.ats_string,
1212 ph.iterations, 1231 ph.total_iterations,
1213 ph.N_peers_start, 1232 ph.N_peers_start,
1214 ph.N_peers_end, 1233 ph.N_peers_end,
1215 ph.N_address); 1234 ph.N_address);
@@ -1234,110 +1253,131 @@ evaluate_average (void)
1234 write_gnuplot_script (data_fn_update, -1, GNUNET_NO); 1253 write_gnuplot_script (data_fn_update, -1, GNUNET_NO);
1235 } 1254 }
1236 1255
1237 for (c = 0; c <= ph.N_peers_end - ph.N_peers_start; c++) 1256 for (c_o = 0; c_o < 2; c_o++)
1238 { 1257 {
1239 struct Result *cur = &ph.averaged_full_result[c]; 1258 if (0 == c_o)
1240
1241 str_d_total = NULL;
1242 str_d_setup = NULL;
1243 str_d_lp = NULL;
1244 str_d_mlp = NULL;
1245
1246 if (0 >= cur->valid)
1247 {
1248 fprintf (stderr, 1259 fprintf (stderr,
1249 "No valid results for %s for %u peers %u addresses!\n", 1260 "Duration for a full solution averaged over %i iterations\n",
1250 (GNUNET_YES == cur->update) ? "updated" : "full", 1261 ph.total_iterations);
1251 cur->peers, cur->addresses); 1262 if (1 == c_o)
1252 continue;
1253 }
1254
1255 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_total.rel_value_us)
1256 {
1257 fprintf (stderr, 1263 fprintf (stderr,
1258 "Average total time from %u iterations to solve %s for %u peers %u addresses: %llu us\n", 1264 "Duration for a full solution averaged over %i iterations\n",
1259 cur->valid, 1265 ph.total_iterations);
1260 (GNUNET_YES == cur->update) ? "updated" : "full",
1261 cur->peers, cur->addresses,
1262 (unsigned long long) cur->d_total.rel_value_us / cur->valid);
1263 GNUNET_asprintf(&str_d_total, "%llu",
1264 (unsigned long long) cur->d_total.rel_value_us / cur->valid);
1265 }
1266 else
1267 GNUNET_asprintf (&str_d_total, "-1");
1268 1266
1269 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_setup.rel_value_us) 1267 for (c_i = 0; c_i <= ph.N_peers_end - ph.N_peers_start; c_i++)
1270 { 1268 {
1271 fprintf (stderr, 1269 if (0 == c_o)
1272 "Average total time from %u iterations to setup for %u peers %u addresses: %llu us\n", 1270 {
1273 cur->valid, cur->peers, cur->addresses, 1271 cur = &ph.averaged_full_result[c_i];
1274 (unsigned long long) cur->d_setup.rel_value_us / cur->valid); 1272 }
1275 GNUNET_asprintf(&str_d_setup, "%llu", 1273 else if ((GNUNET_YES == ph.measure_updates) && (1 == c_o))
1276 (unsigned long long) cur->d_setup.rel_value_us / cur->valid); 1274 {
1275 cur = &ph.averaged_update_result[c_i];
1276 }
1277 else
1278 break;
1277 1279
1278 } 1280 str_d_total = NULL;
1279 else 1281 str_d_setup = NULL;
1280 GNUNET_asprintf (&str_d_setup, "-1"); 1282 str_d_lp = NULL;
1283 str_d_mlp = NULL;
1281 1284
1282 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us) 1285 if (0 >= cur->valid)
1283 { 1286 {
1284 fprintf (stderr, 1287 fprintf (stderr,
1285 "Average total time from %u iterations to solve lp %s for %u peers %u addresses: %llu us\n", 1288 "No valid results for %s for %u peers %u addresses!\n",
1286 cur->valid, 1289 (GNUNET_YES == cur->update) ? "updated" : "full",
1287 (GNUNET_YES == cur->update) ? "updated" : "full", 1290 cur->peers, cur->addresses);
1288 cur->peers, cur->addresses, 1291 continue;
1289 (unsigned long long) cur->d_lp.rel_value_us / cur->valid); 1292 }
1290 GNUNET_asprintf(&str_d_lp, "%llu",
1291 (unsigned long long) cur->d_lp.rel_value_us / ph.iterations);
1292 }
1293 else
1294 GNUNET_asprintf (&str_d_lp, "-1");
1295 1293
1296 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us) 1294 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_total.rel_value_us)
1297 { 1295 {
1298 fprintf (stderr, 1296 fprintf (stderr,
1299 "Average total time from %u iterations to solve mlp %s for %u peers %u addresses: %llu us\n", 1297 "Average total time from %u iterations to solve %s for %u peers %u addresses: %llu us\n",
1300 cur->valid, 1298 cur->valid,
1301 (GNUNET_YES == cur->update) ? "updated" : "full", 1299 (GNUNET_YES == cur->update) ? "updated" : "full",
1302 cur->peers, cur->addresses, 1300 cur->peers, cur->addresses,
1303 (unsigned long long) cur->d_mlp.rel_value_us / cur->valid); 1301 (unsigned long long) cur->d_total.rel_value_us / cur->valid);
1304 GNUNET_asprintf(&str_d_mlp, "%llu", 1302 GNUNET_asprintf(&str_d_total, "%llu",
1305 (unsigned long long) cur->d_mlp.rel_value_us / cur->valid); 1303 (unsigned long long) cur->d_total.rel_value_us / cur->valid);
1306 } 1304 }
1307 else 1305 else
1308 GNUNET_asprintf (&str_d_mlp, "-1"); 1306 GNUNET_asprintf (&str_d_total, "-1");
1309 1307
1310 data = NULL; 1308 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_setup.rel_value_us)
1311 if (GNUNET_YES == ph.create_plot)
1312 {
1313 GNUNET_asprintf (&data,
1314 "%u;%u;%s;%s;%s;%s\n",
1315 cur->peers, cur->addresses,
1316 str_d_total,
1317 str_d_setup,
1318 str_d_lp,
1319 str_d_mlp);
1320 if (cur->update == GNUNET_NO)
1321 { 1309 {
1322 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data, strlen(data))) 1310 fprintf (stderr,
1323 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1311 "Average total time from %u iterations to setup for %u peers %u addresses: %llu us\n",
1324 "Cannot write data to log file `%s'\n", 1312 cur->valid, cur->peers, cur->addresses,
1325 data_fn_full); 1313 (unsigned long long) cur->d_setup.rel_value_us / cur->valid);
1314 GNUNET_asprintf(&str_d_setup, "%llu",
1315 (unsigned long long) cur->d_setup.rel_value_us / cur->valid);
1316
1326 } 1317 }
1327 if ((cur->update == GNUNET_YES) && (NULL != f_update)) 1318 else
1319 GNUNET_asprintf (&str_d_setup, "-1");
1320
1321 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us)
1328 { 1322 {
1329 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data))) 1323 fprintf (stderr,
1330 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1324 "Average total time from %u iterations to solve lp %s for %u peers %u addresses: %llu us\n",
1331 "Cannot write data to log file `%s'\n", 1325 cur->valid,
1332 data_fn_update); 1326 (GNUNET_YES == cur->update) ? "updated" : "full",
1327 cur->peers, cur->addresses,
1328 (unsigned long long) cur->d_lp.rel_value_us / cur->valid);
1329 GNUNET_asprintf(&str_d_lp, "%llu",
1330 (unsigned long long) cur->d_lp.rel_value_us / ph.total_iterations);
1333 } 1331 }
1334 GNUNET_free (data); 1332 else
1335 } 1333 GNUNET_asprintf (&str_d_lp, "-1");
1336 1334
1337 GNUNET_free_non_null (str_d_total); 1335 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us)
1338 GNUNET_free_non_null (str_d_setup); 1336 {
1339 GNUNET_free_non_null (str_d_lp); 1337 fprintf (stderr,
1340 GNUNET_free_non_null (str_d_mlp); 1338 "Average total time from %u iterations to solve mlp %s for %u peers %u addresses: %llu us\n",
1339 cur->valid,
1340 (GNUNET_YES == cur->update) ? "updated" : "full",
1341 cur->peers, cur->addresses,
1342 (unsigned long long) cur->d_mlp.rel_value_us / cur->valid);
1343 GNUNET_asprintf(&str_d_mlp, "%llu",
1344 (unsigned long long) cur->d_mlp.rel_value_us / cur->valid);
1345 }
1346 else
1347 GNUNET_asprintf (&str_d_mlp, "-1");
1348
1349 data = NULL;
1350 if (GNUNET_YES == ph.create_plot)
1351 {
1352 GNUNET_asprintf (&data,
1353 "%u;%u;%s;%s;%s;%s\n",
1354 cur->peers, cur->addresses,
1355 str_d_total,
1356 str_d_setup,
1357 str_d_lp,
1358 str_d_mlp);
1359 if (cur->update == GNUNET_NO)
1360 {
1361 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data, strlen(data)))
1362 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1363 "Cannot write data to log file `%s'\n",
1364 data_fn_full);
1365 }
1366 if ((cur->update == GNUNET_YES) && (NULL != f_update))
1367 {
1368 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data)))
1369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1370 "Cannot write data to log file `%s'\n",
1371 data_fn_update);
1372 }
1373 GNUNET_free (data);
1374 }
1375
1376 GNUNET_free_non_null (str_d_total);
1377 GNUNET_free_non_null (str_d_setup);
1378 GNUNET_free_non_null (str_d_lp);
1379 GNUNET_free_non_null (str_d_mlp);
1380 }
1341 } 1381 }
1342 1382
1343 if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full))) 1383 if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full)))
@@ -1371,7 +1411,7 @@ perf_run_iteration (void)
1371 for (cp = 0; cp < count_p; cp++) 1411 for (cp = 0; cp < count_p; cp++)
1372 perf_create_peer (cp); 1412 perf_create_peer (cp);
1373 GNUNET_log(GNUNET_ERROR_TYPE_INFO, 1413 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
1374 "Iteration %u of %u, added %u peers\n", ph.current_iteration, ph.iterations, cp); 1414 "Iteration %u of %u, added %u peers\n", ph.current_iteration, ph.total_iterations, cp);
1375 1415
1376 for (cp = 0; cp < count_p; cp++) 1416 for (cp = 0; cp < count_p; cp++)
1377 { 1417 {
@@ -1417,6 +1457,7 @@ perf_run_iteration (void)
1417 "Updating problem with %u peers and %u addresses\n", cp + 1, ca); 1457 "Updating problem with %u peers and %u addresses\n", cp + 1, ca);
1418 1458
1419 ph.expecting_solution = GNUNET_YES; 1459 ph.expecting_solution = GNUNET_YES;
1460 ph.performed_update = GNUNET_YES;
1420 if (GNUNET_NO == ph.bulk_running) 1461 if (GNUNET_NO == ph.bulk_running)
1421 { 1462 {
1422 ph.bulk_running = GNUNET_YES; 1463 ph.bulk_running = GNUNET_YES;
@@ -1426,6 +1467,7 @@ perf_run_iteration (void)
1426 ph.bulk_running = GNUNET_NO; 1467 ph.bulk_running = GNUNET_NO;
1427 ph.env.sf.s_bulk_stop (ph.solver); 1468 ph.env.sf.s_bulk_stop (ph.solver);
1428 /* Problem is solved by the solver here due to unlocking */ 1469 /* Problem is solved by the solver here due to unlocking */
1470 ph.performed_update = GNUNET_NO;
1429 ph.expecting_solution = GNUNET_NO; 1471 ph.expecting_solution = GNUNET_NO;
1430 } 1472 }
1431 GNUNET_assert (GNUNET_NO == ph.bulk_running); 1473 GNUNET_assert (GNUNET_NO == ph.bulk_running);
@@ -1533,10 +1575,10 @@ run (void *cls, char * const *args, const char *cfgfile,
1533 1575
1534 if (ph.N_peers_start != ph.N_peers_end) 1576 if (ph.N_peers_start != ph.N_peers_end)
1535 fprintf (stderr, "Benchmarking solver `%s' with %u to %u peers and %u addresses in %u iterations\n", 1577 fprintf (stderr, "Benchmarking solver `%s' with %u to %u peers and %u addresses in %u iterations\n",
1536 ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address, ph.iterations); 1578 ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address, ph.total_iterations);
1537 else 1579 else
1538 fprintf (stderr, "Benchmarking solver `%s' with %u peers and %u addresses in %u iterations\n", 1580 fprintf (stderr, "Benchmarking solver `%s' with %u peers and %u addresses in %u iterations\n",
1539 ph.ats_string, ph.N_peers_end, ph.N_address, ph.iterations); 1581 ph.ats_string, ph.N_peers_end, ph.N_address, ph.total_iterations);
1540 1582
1541 if (0 == ph.opt_update_percent) 1583 if (0 == ph.opt_update_percent)
1542 ph.opt_update_percent = DEFAULT_UPDATE_PERCENTAGE; 1584 ph.opt_update_percent = DEFAULT_UPDATE_PERCENTAGE;
@@ -1558,9 +1600,8 @@ run (void *cls, char * const *args, const char *cfgfile,
1558 } 1600 }
1559 1601
1560 /* Create array of DLL to store results for iterations */ 1602 /* Create array of DLL to store results for iterations */
1561 ph.iterations_results = GNUNET_malloc (sizeof (struct Iteration) * ph.iterations); 1603 ph.iterations_results = GNUNET_malloc (sizeof (struct Iteration) * ph.total_iterations);
1562 ph.averaged_full_result = GNUNET_malloc (sizeof (struct Result) * ((ph.N_peers_end + 1) - ph.N_peers_start)); 1604 ph.averaged_full_result = GNUNET_malloc (sizeof (struct Result) * ((ph.N_peers_end + 1) - ph.N_peers_start));
1563 ph.averaged_update_result = GNUNET_malloc (sizeof (struct Result) * ((ph.N_peers_end + 1) - ph.N_peers_start));
1564 for (c = 0; c <= ph.N_peers_end - ph.N_peers_start; c++) 1605 for (c = 0; c <= ph.N_peers_end - ph.N_peers_start; c++)
1565 { 1606 {
1566 ph.averaged_full_result[c].d_setup = GNUNET_TIME_UNIT_FOREVER_REL; 1607 ph.averaged_full_result[c].d_setup = GNUNET_TIME_UNIT_FOREVER_REL;
@@ -1568,6 +1609,14 @@ run (void *cls, char * const *args, const char *cfgfile,
1568 ph.averaged_full_result[c].d_lp = GNUNET_TIME_UNIT_FOREVER_REL; 1609 ph.averaged_full_result[c].d_lp = GNUNET_TIME_UNIT_FOREVER_REL;
1569 ph.averaged_full_result[c].d_mlp = GNUNET_TIME_UNIT_FOREVER_REL; 1610 ph.averaged_full_result[c].d_mlp = GNUNET_TIME_UNIT_FOREVER_REL;
1570 } 1611 }
1612 ph.averaged_update_result = GNUNET_malloc (sizeof (struct Result) * ((ph.N_peers_end + 1) - ph.N_peers_start));
1613 for (c = 0; c <= ph.N_peers_end - ph.N_peers_start; c++)
1614 {
1615 ph.averaged_update_result[c].d_setup = GNUNET_TIME_UNIT_FOREVER_REL;
1616 ph.averaged_update_result[c].d_total = GNUNET_TIME_UNIT_FOREVER_REL;
1617 ph.averaged_update_result[c].d_lp = GNUNET_TIME_UNIT_FOREVER_REL;
1618 ph.averaged_update_result[c].d_mlp = GNUNET_TIME_UNIT_FOREVER_REL;
1619 }
1571 1620
1572 /* Load solver */ 1621 /* Load solver */
1573 ph.env.cfg = solver_cfg; 1622 ph.env.cfg = solver_cfg;
@@ -1605,7 +1654,7 @@ run (void *cls, char * const *args, const char *cfgfile,
1605 } 1654 }
1606 1655
1607 /* Do the benchmark */ 1656 /* Do the benchmark */
1608 for (ph.current_iteration = 1; ph.current_iteration <= ph.iterations; ph.current_iteration++) 1657 for (ph.current_iteration = 1; ph.current_iteration <= ph.total_iterations; ph.current_iteration++)
1609 { 1658 {
1610 perf_run_iteration (); 1659 perf_run_iteration ();
1611 evaluate (ph.current_iteration); 1660 evaluate (ph.current_iteration);
@@ -1641,7 +1690,7 @@ main (int argc, char *argv[])
1641 ph.ats_string = NULL; 1690 ph.ats_string = NULL;
1642 ph.create_plot = GNUNET_NO; 1691 ph.create_plot = GNUNET_NO;
1643 ph.measure_updates = GNUNET_NO; 1692 ph.measure_updates = GNUNET_NO;
1644 ph.iterations = 1; 1693 ph.total_iterations = 1;
1645 1694
1646 static struct GNUNET_GETOPT_CommandLineOption options[] = { 1695 static struct GNUNET_GETOPT_CommandLineOption options[] = {
1647 { 'a', "addresses", NULL, 1696 { 'a', "addresses", NULL,
@@ -1655,7 +1704,7 @@ main (int argc, char *argv[])
1655 1, &GNUNET_GETOPT_set_uint, &ph.N_peers_end }, 1704 1, &GNUNET_GETOPT_set_uint, &ph.N_peers_end },
1656 { 'i', "iterations", NULL, 1705 { 'i', "iterations", NULL,
1657 gettext_noop ("number of iterations used for averaging (default: 1)"), 1706 gettext_noop ("number of iterations used for averaging (default: 1)"),
1658 1, &GNUNET_GETOPT_set_uint, &ph.iterations }, 1707 1, &GNUNET_GETOPT_set_uint, &ph.total_iterations },
1659 { 'p', "percentage", NULL, 1708 { 'p', "percentage", NULL,
1660 gettext_noop ("update a fix percentage of addresses"), 1709 gettext_noop ("update a fix percentage of addresses"),
1661 1, &GNUNET_GETOPT_set_uint, &ph.opt_update_percent }, 1710 1, &GNUNET_GETOPT_set_uint, &ph.opt_update_percent },