diff options
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-service-ats-solver_mlp.c | 23 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats-solver_proportional.c | 9 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_performance.c | 2 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_reservations.c | 8 | ||||
-rw-r--r-- | src/ats/perf_ats_mlp.c | 70 | ||||
-rw-r--r-- | src/ats/test_ats_api_scheduling_block_and_reset.c | 105 | ||||
-rw-r--r-- | src/ats/test_ats_api_scheduling_init.c | 4 |
7 files changed, 135 insertions, 86 deletions
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c index 84cacd017..93c6839f8 100644 --- a/src/ats/gnunet-service-ats-solver_mlp.c +++ b/src/ats/gnunet-service-ats-solver_mlp.c | |||
@@ -1078,7 +1078,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1078 | else | 1078 | else |
1079 | { | 1079 | { |
1080 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); | 1080 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); |
1081 | duration_build.rel_value = 0; | 1081 | duration_build.rel_value_us = 0; |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | /* Run LP solver */ | 1084 | /* Run LP solver */ |
@@ -1107,10 +1107,15 @@ GAS_mlp_solve_problem (void *solver) | |||
1107 | mlp->ps.p_rows = glp_get_num_rows (mlp->p.prob); | 1107 | mlp->ps.p_rows = glp_get_num_rows (mlp->p.prob); |
1108 | mlp->ps.p_elements = mlp->p.num_elements; | 1108 | mlp->ps.p_elements = mlp->p.num_elements; |
1109 | 1109 | ||
1110 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Execution time: Build %llu ms, LP %llu ms, MLP %llu ms\n", | 1110 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1111 | (unsigned long long) duration_build.rel_value, | 1111 | "Execution time: Build %s\n", |
1112 | (unsigned long long) duration_lp.rel_value, | 1112 | GNUNET_STRINGS_relative_time_to_string (duration_build, GNUNET_NO)); |
1113 | (unsigned long long) duration_mlp.rel_value); | 1113 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1114 | "Execution time: LP %s\n", | ||
1115 | GNUNET_STRINGS_relative_time_to_string (duration_lp, GNUNET_NO)); | ||
1116 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1117 | "Execution time: MLP %s\n", | ||
1118 | GNUNET_STRINGS_relative_time_to_string (duration_mlp, GNUNET_NO)); | ||
1114 | 1119 | ||
1115 | /* Propagate result*/ | 1120 | /* Propagate result*/ |
1116 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) | 1121 | if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) |
@@ -1120,7 +1125,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1120 | if (GNUNET_YES == mlp->write_mip_mps) | 1125 | if (GNUNET_YES == mlp->write_mip_mps) |
1121 | { | 1126 | { |
1122 | /* Write problem to disk */ | 1127 | /* Write problem to disk */ |
1123 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.mps", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value); | 1128 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.mps", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value_us); |
1124 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); | 1129 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); |
1125 | glp_write_lp(mlp->p.prob, NULL, filename); | 1130 | glp_write_lp(mlp->p.prob, NULL, filename); |
1126 | GNUNET_free (filename); | 1131 | GNUNET_free (filename); |
@@ -1128,7 +1133,7 @@ GAS_mlp_solve_problem (void *solver) | |||
1128 | if (GNUNET_YES == mlp->write_mip_sol) | 1133 | if (GNUNET_YES == mlp->write_mip_sol) |
1129 | { | 1134 | { |
1130 | /* Write solution to disk */ | 1135 | /* Write solution to disk */ |
1131 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value); | 1136 | GNUNET_asprintf (&filename, "problem_p_%u_a%u_%llu.sol", mlp->p.num_peers, mlp->p.num_addresses, time.abs_value_us); |
1132 | glp_print_mip (mlp->p.prob, filename ); | 1137 | glp_print_mip (mlp->p.prob, filename ); |
1133 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); | 1138 | LOG (GNUNET_ERROR_TYPE_ERROR, "DUMP: %s \n", filename); |
1134 | GNUNET_free (filename); | 1139 | GNUNET_free (filename); |
@@ -1965,7 +1970,7 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1965 | mlp->control_param_lp.msg_lev = GLP_MSG_ALL; | 1970 | mlp->control_param_lp.msg_lev = GLP_MSG_ALL; |
1966 | #endif | 1971 | #endif |
1967 | mlp->control_param_lp.it_lim = max_iterations; | 1972 | mlp->control_param_lp.it_lim = max_iterations; |
1968 | mlp->control_param_lp.tm_lim = max_duration.rel_value; | 1973 | mlp->control_param_lp.tm_lim = max_duration.rel_value_us / 1000LL; |
1969 | 1974 | ||
1970 | /* Init MLP solving parameters */ | 1975 | /* Init MLP solving parameters */ |
1971 | glp_init_iocp(&mlp->control_param_mlp); | 1976 | glp_init_iocp(&mlp->control_param_mlp); |
@@ -1973,7 +1978,7 @@ GAS_mlp_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1973 | #if VERBOSE_GLPK | 1978 | #if VERBOSE_GLPK |
1974 | mlp->control_param_mlp.msg_lev = GLP_MSG_ALL; | 1979 | mlp->control_param_mlp.msg_lev = GLP_MSG_ALL; |
1975 | #endif | 1980 | #endif |
1976 | mlp->control_param_mlp.tm_lim = max_duration.rel_value; | 1981 | mlp->control_param_mlp.tm_lim = max_duration.rel_value_us / 1000LL; |
1977 | 1982 | ||
1978 | LOG (GNUNET_ERROR_TYPE_DEBUG, "solver ready\n"); | 1983 | LOG (GNUNET_ERROR_TYPE_DEBUG, "solver ready\n"); |
1979 | 1984 | ||
diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c index a48714855..1a1d5cad4 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.c +++ b/src/ats/gnunet-service-ats-solver_proportional.c | |||
@@ -596,13 +596,14 @@ find_best_address_it (void *cls, const struct GNUNET_HashCode * key, void *value | |||
596 | 596 | ||
597 | now = GNUNET_TIME_absolute_get(); | 597 | now = GNUNET_TIME_absolute_get(); |
598 | 598 | ||
599 | if (current->blocked_until.abs_value == GNUNET_TIME_absolute_max (now, current->blocked_until).abs_value) | 599 | if (current->blocked_until.abs_value_us == GNUNET_TIME_absolute_max (now, current->blocked_until).abs_value_us) |
600 | { | 600 | { |
601 | /* This address is blocked for suggestion */ | 601 | /* This address is blocked for suggestion */ |
602 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 602 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
603 | "Address %p blocked for suggestion for %llu ms \n", | 603 | "Address %p blocked for suggestion for %s \n", |
604 | current, | 604 | current, |
605 | GNUNET_TIME_absolute_get_difference(now, current->blocked_until).rel_value); | 605 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (now, current->blocked_until), |
606 | GNUNET_YES)); | ||
606 | return GNUNET_OK; | 607 | return GNUNET_OK; |
607 | } | 608 | } |
608 | if (GNUNET_NO == is_bandwidth_available_in_network (net)) | 609 | if (GNUNET_NO == is_bandwidth_available_in_network (net)) |
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index 4164e5f0d..f0986959c 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -582,7 +582,7 @@ GAS_handle_reservation_request (void *cls, struct GNUNET_SERVER_Client *client, | |||
582 | "RESERVATION_REQUEST"); | 582 | "RESERVATION_REQUEST"); |
583 | amount = (int32_t) ntohl (msg->amount); | 583 | amount = (int32_t) ntohl (msg->amount); |
584 | res_delay = GAS_reservations_reserve (&msg->peer, amount); | 584 | res_delay = GAS_reservations_reserve (&msg->peer, amount); |
585 | if (res_delay.rel_value > 0) | 585 | if (res_delay.rel_value_us > 0) |
586 | amount = 0; | 586 | amount = 0; |
587 | result.header.size = htons (sizeof (struct ReservationResultMessage)); | 587 | result.header.size = htons (sizeof (struct ReservationResultMessage)); |
588 | result.header.type = htons (GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT); | 588 | result.header.type = htons (GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT); |
diff --git a/src/ats/gnunet-service-ats_reservations.c b/src/ats/gnunet-service-ats_reservations.c index 3354c4e41..0b4948576 100644 --- a/src/ats/gnunet-service-ats_reservations.c +++ b/src/ats/gnunet-service-ats_reservations.c | |||
@@ -63,11 +63,13 @@ GAS_reservations_reserve (const struct GNUNET_PeerIdentity *peer, | |||
63 | if (amount >= 0) | 63 | if (amount >= 0) |
64 | { | 64 | { |
65 | ret = GNUNET_BANDWIDTH_tracker_get_delay (tracker, amount); | 65 | ret = GNUNET_BANDWIDTH_tracker_get_delay (tracker, amount); |
66 | if (ret.rel_value > 0) | 66 | if (ret.rel_value_us > 0) |
67 | { | 67 | { |
68 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 68 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
69 | "Delay to satisfy reservation for %d bytes is %llu ms\n", | 69 | "Delay to satisfy reservation for %d bytes is %s\n", |
70 | (int) amount, (unsigned long long) ret.rel_value); | 70 | (int) amount, |
71 | GNUNET_STRINGS_relative_time_to_string (ret, | ||
72 | GNUNET_YES)); | ||
71 | return ret; | 73 | return ret; |
72 | } | 74 | } |
73 | } | 75 | } |
diff --git a/src/ats/perf_ats_mlp.c b/src/ats/perf_ats_mlp.c index ada67fc94..5d370104b 100644 --- a/src/ats/perf_ats_mlp.c +++ b/src/ats/perf_ats_mlp.c | |||
@@ -366,39 +366,51 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
366 | } | 366 | } |
367 | if (GNUNET_NO == opt_numeric) | 367 | if (GNUNET_NO == opt_numeric) |
368 | { | 368 | { |
369 | fprintf (stderr, "Rebuild: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in ms) %04llu / %04llu / %04llu\n", | 369 | fprintf (stderr, |
370 | cp + 1, ca, | 370 | "Rebuild: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in us) %04llu / %04llu / %04llu\n", |
371 | (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", | 371 | cp + 1, ca, |
372 | (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", | 372 | (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", |
373 | (GLP_YES == full_lp_presolv) ? "YES" : "NO", | 373 | (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", |
374 | (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", | 374 | (GLP_YES == full_lp_presolv) ? "YES" : "NO", |
375 | (unsigned long long) full_build_dur.rel_value, (unsigned long long) full_lp_dur.rel_value, (unsigned long long) full_mip_dur.rel_value); | 375 | (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", |
376 | (unsigned long long) full_build_dur.rel_value_us, | ||
377 | (unsigned long long) full_lp_dur.rel_value_us, | ||
378 | (unsigned long long) full_mip_dur.rel_value_us); | ||
376 | if ((0 < opt_update_quantity) || (0 < opt_update_percent)) | 379 | if ((0 < opt_update_quantity) || (0 < opt_update_percent)) |
377 | fprintf (stderr, "Update : %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in ms) %04llu / %04llu / %04llu\n", | 380 | fprintf (stderr, |
378 | cp + 1, ca, | 381 | "Update: %03u peers each %02u addresses; rebuild: LP/MIP state [%3s/%3s] presolv [%3s/%3s], (build/LP/MIP in us) %04llu / %04llu / %04llu\n", |
379 | (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", | 382 | cp + 1, ca, |
380 | (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", | 383 | (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", |
381 | (GLP_YES == update_lp_presolv) ? "YES" : "NO", | 384 | (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", |
382 | (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", | 385 | (GLP_YES == update_lp_presolv) ? "YES" : "NO", |
383 | (unsigned long long) update_build_dur.rel_value, (unsigned long long) update_lp_dur.rel_value, (unsigned long long) update_mip_dur.rel_value); | 386 | (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", |
387 | (unsigned long long) update_build_dur.rel_value_us, | ||
388 | (unsigned long long) update_lp_dur.rel_value_us, | ||
389 | (unsigned long long) update_mip_dur.rel_value_us); | ||
384 | } | 390 | } |
385 | else | 391 | else |
386 | { | 392 | { |
387 | fprintf (stderr, "Rebuild;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", | 393 | fprintf (stderr, |
388 | cp + 1, ca, | 394 | "Rebuild;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", |
389 | (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", | 395 | cp + 1, ca, |
390 | (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", | 396 | (GNUNET_OK == full_lp_res) ? "OK" : "FAIL", |
391 | (GLP_YES == full_lp_presolv) ? "YES" : "NO", | 397 | (GNUNET_OK == full_mip_res) ? "OK" : "FAIL", |
392 | (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", | 398 | (GLP_YES == full_lp_presolv) ? "YES" : "NO", |
393 | (unsigned long long) full_build_dur.rel_value, (unsigned long long) full_lp_dur.rel_value, (unsigned long long) full_mip_dur.rel_value); | 399 | (GNUNET_OK == full_mip_presolv) ? "YES" : "NO", |
394 | if ((0 < opt_update_quantity) || (0 < opt_update_percent)) | 400 | (unsigned long long) full_build_dur.rel_value_us, |
395 | fprintf (stderr, "Update;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", | 401 | (unsigned long long) full_lp_dur.rel_value_us, |
396 | cp + 1, ca, | 402 | (unsigned long long) full_mip_dur.rel_value_us); |
397 | (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", | 403 | if ((0 < opt_update_quantity) || (0 < opt_update_percent)) |
398 | (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", | 404 | fprintf (stderr, |
399 | (GLP_YES == update_lp_presolv) ? "YES" : "NO", | 405 | "Update;%u;%u;%s;%s;%s;%s;%04llu;%04llu;%04llu\n", |
400 | (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", | 406 | cp + 1, ca, |
401 | (unsigned long long) update_build_dur.rel_value, (unsigned long long) update_lp_dur.rel_value, (unsigned long long) update_mip_dur.rel_value); | 407 | (GNUNET_OK == update_lp_res) ? "OK" : "FAIL", |
408 | (GNUNET_OK == update_mip_res) ? "OK" : "FAIL", | ||
409 | (GLP_YES == update_lp_presolv) ? "YES" : "NO", | ||
410 | (GNUNET_OK == update_mip_presolv) ? "YES" : "NO", | ||
411 | (unsigned long long) update_build_dur.rel_value_us, | ||
412 | (unsigned long long) update_lp_dur.rel_value_us, | ||
413 | (unsigned long long) update_mip_dur.rel_value_us); | ||
402 | } | 414 | } |
403 | } | 415 | } |
404 | } | 416 | } |
diff --git a/src/ats/test_ats_api_scheduling_block_and_reset.c b/src/ats/test_ats_api_scheduling_block_and_reset.c index b799a5de3..d5bd58031 100644 --- a/src/ats/test_ats_api_scheduling_block_and_reset.c +++ b/src/ats/test_ats_api_scheduling_block_and_reset.c | |||
@@ -150,44 +150,48 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
150 | if (3 == stage) | 150 | if (3 == stage) |
151 | { | 151 | { |
152 | /* Suggestion after resetting block interval */ | 152 | /* Suggestion after resetting block interval */ |
153 | reset_block_duration = GNUNET_TIME_absolute_get_difference(reset_block_start, GNUNET_TIME_absolute_get()); | 153 | reset_block_duration = GNUNET_TIME_absolute_get_difference (reset_block_start, |
154 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address suggestion after resetting blocking took about %llu ms!\n", | 154 | GNUNET_TIME_absolute_get()); |
155 | (long long unsigned int) reset_block_duration.rel_value); | 155 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
156 | if ((block_duration.rel_value <= (initial_duration.rel_value * 3)) || | 156 | "Address suggestion after resetting blocking took about %s!\n", |
157 | (initial_duration.rel_value <= (block_duration.rel_value * 3))) | 157 | GNUNET_STRINGS_relative_time_to_string (reset_block_duration, |
158 | GNUNET_YES)); | ||
159 | if ((block_duration.rel_value_us <= (initial_duration.rel_value_us * 3)) || | ||
160 | (initial_duration.rel_value_us <= (block_duration.rel_value_us * 3))) | ||
158 | { | 161 | { |
159 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 162 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
160 | "Address suggestion after resetting blocking (%llu ms) took about the same as initial suggestion (%llu ms)\n", | 163 | "Address suggestion after resetting blocking took about the same as initial suggestion (%s)\n", |
161 | (long long unsigned int) reset_block_duration.rel_value, | 164 | GNUNET_STRINGS_relative_time_to_string (initial_duration, |
162 | (long long unsigned int) initial_duration.rel_value); | 165 | GNUNET_YES)); |
163 | ret = 0; | 166 | ret = 0; |
164 | } | 167 | } |
165 | else | 168 | else |
166 | { | 169 | { |
167 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Address suggestion after resetting blocking (%llu ms) has too big difference to initial suggestion (%llu ms)\n", | 170 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
168 | (long long unsigned int) reset_block_duration.rel_value, | 171 | "Address suggestion after resetting blocking has too big difference to initial suggestion (%s)\n", |
169 | (long long unsigned int) initial_duration.rel_value); | 172 | GNUNET_STRINGS_relative_time_to_string (initial_duration, |
173 | GNUNET_YES)); | ||
170 | ret = 1; | 174 | ret = 1; |
171 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 175 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
172 | GNUNET_SCHEDULER_add_now (&end, NULL); | 176 | GNUNET_SCHEDULER_add_now (&end, NULL); |
173 | return; | 177 | return; |
174 | } | 178 | } |
175 | 179 | ||
176 | if (((initial_duration.rel_value * 3) <= block_duration.rel_value ) && | 180 | if (((initial_duration.rel_value_us * 3) <= block_duration.rel_value_us) && |
177 | ((reset_block_duration.rel_value * 3) <= block_duration.rel_value)) | 181 | ((reset_block_duration.rel_value_us * 3) <= block_duration.rel_value_us)) |
178 | { | 182 | { |
179 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address suggestion after resetting blocking (%llu ms) and initial suggestion (%llu ms) much faster than with blocking (%llu ms)\n", | 183 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
180 | (long long unsigned int) reset_block_duration.rel_value, | 184 | "Address suggestion after resetting blocking and initial suggestion (%llu us) much faster than with blocking (%llu us)\n", |
181 | (long long unsigned int) initial_duration.rel_value, | 185 | (unsigned long long) initial_duration.rel_value_us, |
182 | (long long unsigned int) block_duration.rel_value); | 186 | (unsigned long long) block_duration.rel_value_us); |
183 | ret = 0; | 187 | ret = 0; |
184 | } | 188 | } |
185 | else | 189 | else |
186 | { | 190 | { |
187 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Address suggestion after resetting blocking (%llu ms) and initial suggestion (%llu ms) not faster than with blocking (%llu ms)\n", | 191 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
188 | (long long unsigned int) reset_block_duration.rel_value, | 192 | "Address suggestion after resetting blocking and initial suggestion (%llu us) not faster than with blocking (%llu us)\n", |
189 | (long long unsigned int) initial_duration.rel_value, | 193 | (unsigned long long) initial_duration.rel_value_us, |
190 | (long long unsigned int) block_duration.rel_value); | 194 | (unsigned long long) block_duration.rel_value_us); |
191 | ret = 1; | 195 | ret = 1; |
192 | } | 196 | } |
193 | 197 | ||
@@ -200,18 +204,22 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
200 | { | 204 | { |
201 | /* Suggestion after block*/ | 205 | /* Suggestion after block*/ |
202 | block_duration = GNUNET_TIME_absolute_get_difference(block_start, GNUNET_TIME_absolute_get()); | 206 | block_duration = GNUNET_TIME_absolute_get_difference(block_start, GNUNET_TIME_absolute_get()); |
203 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Address suggestion was blocked for about %llu ms!\n", | 207 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
204 | (long long unsigned int) block_duration.rel_value); | 208 | "Address suggestion was blocked for about %s!\n", |
209 | GNUNET_STRINGS_relative_time_to_string (block_duration, | ||
210 | GNUNET_YES)); | ||
205 | 211 | ||
206 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) | 212 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) |
207 | { | 213 | { |
208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with correct address `%s'\n", stage, | 214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
215 | "Stage %u: Callback with correct address `%s'\n", stage, | ||
209 | GNUNET_i2s (&address->peer)); | 216 | GNUNET_i2s (&address->peer)); |
210 | ret = 0; | 217 | ret = 0; |
211 | } | 218 | } |
212 | else | 219 | else |
213 | { | 220 | { |
214 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with invalid address `%s'\n", stage, | 221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
222 | "Stage %u: Callback with invalid address `%s'\n", stage, | ||
215 | GNUNET_i2s (&address->peer)); | 223 | GNUNET_i2s (&address->peer)); |
216 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 224 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
217 | GNUNET_SCHEDULER_add_now (&end, NULL); | 225 | GNUNET_SCHEDULER_add_now (&end, NULL); |
@@ -220,7 +228,8 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
220 | 228 | ||
221 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) | 229 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) |
222 | { | 230 | { |
223 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info \n"); | 231 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
232 | "Stage %u: Callback with incorrect ats info \n"); | ||
224 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 233 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
225 | GNUNET_SCHEDULER_add_now (&end, NULL); | 234 | GNUNET_SCHEDULER_add_now (&end, NULL); |
226 | ret = 1; | 235 | ret = 1; |
@@ -237,13 +246,17 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
237 | /* Initial suggestion */ | 246 | /* Initial suggestion */ |
238 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) | 247 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) |
239 | { | 248 | { |
240 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with correct address `%s'\n", stage, | 249 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
250 | "Stage %u: Callback with correct address `%s'\n", | ||
251 | stage, | ||
241 | GNUNET_i2s (&address->peer)); | 252 | GNUNET_i2s (&address->peer)); |
242 | ret = 0; | 253 | ret = 0; |
243 | } | 254 | } |
244 | else | 255 | else |
245 | { | 256 | { |
246 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with invalid address `%s'\n", stage, | 257 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
258 | "Stage %u: Callback with invalid address `%s'\n", | ||
259 | stage, | ||
247 | GNUNET_i2s (&address->peer)); | 260 | GNUNET_i2s (&address->peer)); |
248 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 261 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
249 | GNUNET_SCHEDULER_add_now (&end, NULL); | 262 | GNUNET_SCHEDULER_add_now (&end, NULL); |
@@ -252,15 +265,20 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
252 | 265 | ||
253 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) | 266 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) |
254 | { | 267 | { |
255 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info \n"); | 268 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
269 | "Stage %u: Callback with incorrect ats info\n", | ||
270 | stage); | ||
256 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 271 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
257 | GNUNET_SCHEDULER_add_now (&end, NULL); | 272 | GNUNET_SCHEDULER_add_now (&end, NULL); |
258 | ret = 1; | 273 | ret = 1; |
259 | } | 274 | } |
260 | stage ++; | 275 | stage++; |
261 | initial_duration = GNUNET_TIME_absolute_get_difference(initial_start, GNUNET_TIME_absolute_get()); | 276 | initial_duration = GNUNET_TIME_absolute_get_difference(initial_start, GNUNET_TIME_absolute_get()); |
262 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Initial suggestion took about %llu ms\n", stage, | 277 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
263 | (long long unsigned int) block_duration.rel_value); | 278 | "Stage %u: Initial suggestion took about %s\n", |
279 | stage, | ||
280 | GNUNET_STRINGS_relative_time_to_string (block_duration, | ||
281 | GNUNET_YES)); | ||
264 | 282 | ||
265 | block_start = GNUNET_TIME_absolute_get(); | 283 | block_start = GNUNET_TIME_absolute_get(); |
266 | wait_task = GNUNET_SCHEDULER_add_delayed (WAIT, &request_task, NULL); | 284 | wait_task = GNUNET_SCHEDULER_add_delayed (WAIT, &request_task, NULL); |
@@ -270,22 +288,28 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
270 | /* Startup suggestion */ | 288 | /* Startup suggestion */ |
271 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) | 289 | if (GNUNET_OK == compare_addresses (address, session, &test_hello_address, test_session)) |
272 | { | 290 | { |
273 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with correct address `%s'\n", stage, | 291 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
292 | "Stage %u: Callback with correct address `%s'\n", | ||
293 | stage, | ||
274 | GNUNET_i2s (&address->peer)); | 294 | GNUNET_i2s (&address->peer)); |
275 | ret = 0; | 295 | ret = 0; |
276 | } | 296 | } |
277 | else | 297 | else |
278 | { | 298 | { |
279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stage %u: Callback with invalid address `%s'\n", stage, | 299 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
300 | "Stage %u: Callback with invalid address `%s'\n", | ||
301 | stage, | ||
280 | GNUNET_i2s (&address->peer)); | 302 | GNUNET_i2s (&address->peer)); |
281 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 303 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
282 | GNUNET_SCHEDULER_add_now (&end, NULL); | 304 | GNUNET_SCHEDULER_add_now (&end, NULL); |
283 | ret = 1; | 305 | ret = 1; |
284 | } | 306 | } |
285 | 307 | ||
286 | if (GNUNET_OK != compare_ats(atsi, ats_count, test_ats_info, test_ats_count)) | 308 | if (GNUNET_OK != compare_ats (atsi, ats_count, test_ats_info, test_ats_count)) |
287 | { | 309 | { |
288 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Stage %u: Callback with incorrect ats info \n"); | 310 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
311 | "Stage %u: Callback with incorrect ats info\n", | ||
312 | stage); | ||
289 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); | 313 | GNUNET_ATS_suggest_address_cancel (sched_ats, &p.id); |
290 | GNUNET_SCHEDULER_add_now (&end, NULL); | 314 | GNUNET_SCHEDULER_add_now (&end, NULL); |
291 | ret = 1; | 315 | ret = 1; |
@@ -312,7 +336,8 @@ run (void *cls, | |||
312 | sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); | 336 | sched_ats = GNUNET_ATS_scheduling_init (cfg, &address_suggest_cb, NULL); |
313 | if (sched_ats == NULL) | 337 | if (sched_ats == NULL) |
314 | { | 338 | { |
315 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not connect to ATS scheduling!\n"); | 339 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
340 | "Could not connect to ATS scheduling!\n"); | ||
316 | ret = 1; | 341 | ret = 1; |
317 | end (); | 342 | end (); |
318 | return; | 343 | return; |
@@ -321,14 +346,16 @@ run (void *cls, | |||
321 | /* Set up peer */ | 346 | /* Set up peer */ |
322 | if (GNUNET_SYSERR == GNUNET_CRYPTO_hash_from_string(PEERID0, &p.id.hashPubKey)) | 347 | if (GNUNET_SYSERR == GNUNET_CRYPTO_hash_from_string(PEERID0, &p.id.hashPubKey)) |
323 | { | 348 | { |
324 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not setup peer!\n"); | 349 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
350 | "Could not setup peer!\n"); | ||
325 | ret = GNUNET_SYSERR; | 351 | ret = GNUNET_SYSERR; |
326 | end (); | 352 | end (); |
327 | return; | 353 | return; |
328 | } | 354 | } |
329 | GNUNET_assert (0 == strcmp (PEERID0, GNUNET_i2s_full (&p.id))); | 355 | GNUNET_assert (0 == strcmp (PEERID0, GNUNET_i2s_full (&p.id))); |
330 | 356 | ||
331 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n", | 357 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
358 | "Created peer `%s'\n", | ||
332 | GNUNET_i2s_full(&p.id)); | 359 | GNUNET_i2s_full(&p.id)); |
333 | 360 | ||
334 | /* Prepare ATS Information */ | 361 | /* Prepare ATS Information */ |
diff --git a/src/ats/test_ats_api_scheduling_init.c b/src/ats/test_ats_api_scheduling_init.c index bd96a4df7..6d6505100 100644 --- a/src/ats/test_ats_api_scheduling_init.c +++ b/src/ats/test_ats_api_scheduling_init.c | |||
@@ -123,7 +123,9 @@ run (void *cls, | |||
123 | end_badly_now (); | 123 | end_badly_now (); |
124 | return; | 124 | return; |
125 | } | 125 | } |
126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting for %llu sec\n", (long long unsigned int) DELAY.rel_value); | 126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Waiting for %s\n", |
127 | GNUNET_STRINGS_relative_time_to_string (DELAY, | ||
128 | GNUNET_YES)); | ||
127 | wait_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &delay, NULL); | 129 | wait_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &delay, NULL); |
128 | } | 130 | } |
129 | 131 | ||