aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-05-05 15:07:34 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-05-05 15:07:34 +0000
commit8bcdff5d767e60d678a2eff637ae84d71665883e (patch)
treee9ac6a02561fcd9338e357aa9dc51a34d8e77010 /src
parent5b96946e6dcb61d9b32227bc510f2a8ea0a96893 (diff)
downloadgnunet-8bcdff5d767e60d678a2eff637ae84d71665883e.tar.gz
gnunet-8bcdff5d767e60d678a2eff637ae84d71665883e.zip
improved logging for eval tool
fix for proportional solver: reset calculated quota after assigning
Diffstat (limited to 'src')
-rw-r--r--src/ats/gnunet-ats-solver-eval.c35
-rw-r--r--src/ats/plugin_ats_proportional.c43
2 files changed, 62 insertions, 16 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c
index 7a74833e8..c1ab82991 100644
--- a/src/ats/gnunet-ats-solver-eval.c
+++ b/src/ats/gnunet-ats-solver-eval.c
@@ -230,7 +230,7 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l)
230 } 230 }
231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t Active = %i\n", log_a->active); 231 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t Active = %i\n", log_a->active);
232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW in = %llu\n", ntohl(log_a->assigned_bw_in.value__)); 232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW in = %llu\n", ntohl(log_a->assigned_bw_in.value__));
233 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW out = %llu\n", ntohl(log_a->assigned_bw_out.value__)); 233 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t BW out = %llu\n", ntohl(log_a->assigned_bw_out.value__));
234 234
235 GNUNET_CONTAINER_DLL_insert_tail (log_p->addr_head, log_p->addr_tail, log_a); 235 GNUNET_CONTAINER_DLL_insert_tail (log_p->addr_head, log_p->addr_tail, log_a);
236 } 236 }
@@ -345,22 +345,22 @@ GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l, int add_time_s
345 cur->pid = log_p->id; 345 cur->pid = log_p->id;
346 346
347 if (GNUNET_YES == add_time_stamp) 347 if (GNUNET_YES == add_time_stamp)
348 GNUNET_asprintf (&filename, "%s%s%s_%s_%u_%u_%llu.log", 348 GNUNET_asprintf (&filename, "%s%s%s_%s_p%u_a%u_%llu.log",
349 (GNUNET_YES == use_dir) ? output_dir : "", 349 (GNUNET_YES == use_dir) ? output_dir : "",
350 (GNUNET_YES == use_dir) ? DIR_SEPARATOR_STR : "", 350 (GNUNET_YES == use_dir) ? DIR_SEPARATOR_STR : "",
351 e->log_prefix, 351 e->log_prefix,
352 opt_solver, 352 opt_solver,
353 cur->aid,
354 cur->pid, 353 cur->pid,
354 cur->aid,
355 l->head->timestamp.abs_value_us); 355 l->head->timestamp.abs_value_us);
356 else 356 else
357 GNUNET_asprintf (&filename, "%s%s%s_%s_%u_%u.log", 357 GNUNET_asprintf (&filename, "%s%s%s_%s_p%u_a%u.log",
358 (GNUNET_YES == use_dir) ? output_dir : "", 358 (GNUNET_YES == use_dir) ? output_dir : "",
359 (GNUNET_YES == use_dir) ? DIR_SEPARATOR_STR : "", 359 (GNUNET_YES == use_dir) ? DIR_SEPARATOR_STR : "",
360 e->log_prefix, 360 e->log_prefix,
361 opt_solver, 361 opt_solver,
362 cur->aid, 362 cur->pid,
363 cur->pid); 363 cur->aid);
364 364
365 fprintf (stderr, "Add writing log data for peer %llu address %llu to file `%s'\n", 365 fprintf (stderr, "Add writing log data for peer %llu address %llu to file `%s'\n",
366 cur->pid, cur->aid, filename); 366 cur->pid, cur->aid, filename);
@@ -2131,13 +2131,19 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op)
2131 GNUNET_ATS_solver_generate_property_stop (pg); 2131 GNUNET_ATS_solver_generate_property_stop (pg);
2132 } 2132 }
2133 2133
2134 GNUNET_CONTAINER_DLL_remove(p->addr_head, p->addr_tail, a);
2135 GNUNET_CONTAINER_multipeermap_remove (sh->addresses, &p->peer_id, a->ats_addr); 2134 GNUNET_CONTAINER_multipeermap_remove (sh->addresses, &p->peer_id, a->ats_addr);
2136 2135
2137 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Removing address %u for peer %u\n", 2136 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Removing address %u for peer %u\n",
2138 op->address_id, op->peer_id); 2137 op->address_id, op->peer_id);
2139 2138
2140 sh->env.sf.s_del (sh->solver, a->ats_addr, GNUNET_NO); 2139 sh->env.sf.s_del (sh->solver, a->ats_addr, GNUNET_NO);
2140
2141 if (NULL != l)
2142 {
2143 GNUNET_ATS_solver_logging_now (l);
2144 }
2145 GNUNET_CONTAINER_DLL_remove(p->addr_head, p->addr_tail, a);
2146
2141 GNUNET_free_non_null(a->ats_addr->atsi); 2147 GNUNET_free_non_null(a->ats_addr->atsi);
2142 GNUNET_free (a->ats_addr); 2148 GNUNET_free (a->ats_addr);
2143 GNUNET_free (a); 2149 GNUNET_free (a);
@@ -2252,10 +2258,12 @@ enforce_start_request (struct GNUNET_ATS_TEST_Operation *op)
2252 res = sh->env.sf.s_get (sh->solver, &p->peer_id); 2258 res = sh->env.sf.s_get (sh->solver, &p->peer_id);
2253 if (NULL != res) 2259 if (NULL != res)
2254 { 2260 {
2255 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requesting address for peer %u: %llu %llu\n", 2261 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Suggested address for peer %u: %llu %llu\n",
2256 op->peer_id, 2262 op->peer_id,
2257 ntohl(res->assigned_bw_in.value__), 2263 ntohl(res->assigned_bw_in.value__),
2258 ntohl(res->assigned_bw_out.value__)); 2264 ntohl(res->assigned_bw_out.value__));
2265 if (NULL != l)
2266 GNUNET_ATS_solver_logging_now (l);
2259 } 2267 }
2260} 2268}
2261 2269
@@ -2276,6 +2284,12 @@ enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op)
2276 op->peer_id); 2284 op->peer_id);
2277 2285
2278 sh->env.sf.s_get_stop (sh->solver, &p->peer_id); 2286 sh->env.sf.s_get_stop (sh->solver, &p->peer_id);
2287
2288 if (NULL != l)
2289 {
2290 GNUNET_ATS_solver_logging_now (l);
2291 }
2292
2279} 2293}
2280 2294
2281static void enforce_episode (struct Episode *ep) 2295static void enforce_episode (struct Episode *ep)
@@ -2782,10 +2796,13 @@ solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address)
2782 "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n", 2796 "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n",
2783 GNUNET_i2s (&address->peer), 2797 GNUNET_i2s (&address->peer),
2784 address, 2798 address,
2785 (unsigned int) ntohl (address->assigned_bw_out.value__), 2799 (unsigned int) ntohl (address->assigned_bw_out.value__),
2786 (unsigned int) ntohl (address->assigned_bw_in.value__)); 2800 (unsigned int) ntohl (address->assigned_bw_in.value__));
2787 /*if (GNUNET_YES == ph.bulk_running) 2801 /*if (GNUNET_YES == ph.bulk_running)
2788 GNUNET_break (0);*/ 2802 GNUNET_break (0);*/
2803 if (NULL != l)
2804 GNUNET_ATS_solver_logging_now (l);
2805
2789 return; 2806 return;
2790} 2807}
2791 2808
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c
index 77c7315aa..5798fd82e 100644
--- a/src/ats/plugin_ats_proportional.c
+++ b/src/ats/plugin_ats_proportional.c
@@ -573,13 +573,15 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s,
573 unsigned long long assigned_quota_out = 0; 573 unsigned long long assigned_quota_out = 0;
574 574
575 575
576 LOG(GNUNET_ERROR_TYPE_DEBUG, 576 LOG(GNUNET_ERROR_TYPE_INFO,
577 "Recalculate quota for network type `%s' for %u addresses (in/out): %llu/%llu \n", 577 "Recalculate quota for network type `%s' for %u addresses (in/out): %llu/%llu \n",
578 net->desc, net->active_addresses, net->total_quota_in, 578 net->desc, net->active_addresses, net->total_quota_in,
579 net->total_quota_in); 579 net->total_quota_in);
580 580
581 if (net->active_addresses == 0) 581 if (net->active_addresses == 0)
582 {
582 return; /* no addresses to update */ 583 return; /* no addresses to update */
584 }
583 585
584 /* Idea 586 /* Idea
585 * Assign every peer in network minimum Bandwidth 587 * Assign every peer in network minimum Bandwidth
@@ -641,7 +643,7 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s,
641 assigned_quota_out = min_bw 643 assigned_quota_out = min_bw
642 + ((cur_pref / total_prefs) * remaining_quota_out); 644 + ((cur_pref / total_prefs) * remaining_quota_out);
643 645
644 LOG(GNUNET_ERROR_TYPE_DEBUG, 646 LOG (GNUNET_ERROR_TYPE_INFO,
645 "New quota for peer `%s' with preference (cur/total) %.3f/%.3f (in/out): %llu / %llu\n", 647 "New quota for peer `%s' with preference (cur/total) %.3f/%.3f (in/out): %llu / %llu\n",
646 GNUNET_i2s (&cur->addr->peer), cur_pref, total_prefs, 648 GNUNET_i2s (&cur->addr->peer), cur_pref, total_prefs,
647 assigned_quota_in, assigned_quota_out); 649 assigned_quota_in, assigned_quota_out);
@@ -829,7 +831,20 @@ propagate_bandwidth (struct GAS_PROPORTIONAL_Handle *s,
829 (cur->addr->assigned_bw_out.value__ != asi->calculated_quota_out_NBO) ) 831 (cur->addr->assigned_bw_out.value__ != asi->calculated_quota_out_NBO) )
830 { 832 {
831 cur->addr->assigned_bw_in.value__ = asi->calculated_quota_in_NBO; 833 cur->addr->assigned_bw_in.value__ = asi->calculated_quota_in_NBO;
832 cur->addr->assigned_bw_out.value__ = asi->calculated_quota_in_NBO; 834 cur->addr->assigned_bw_out.value__ = asi->calculated_quota_out_NBO;
835
836 /* Reset for next iteration */
837 asi->calculated_quota_in_NBO = htonl (0);
838 asi->calculated_quota_out_NBO = htonl (0);
839
840 LOG (GNUNET_ERROR_TYPE_DEBUG,
841 "Bandwidth for %s address %p for peer `%s' changed to %u/%u\n",
842 (GNUNET_NO == cur->addr->active) ? "inactive" : "active",
843 cur->addr,
844 GNUNET_i2s (&cur->addr->peer),
845 ntohl (cur->addr->assigned_bw_in.value__),
846 ntohl (cur->addr->assigned_bw_out.value__ ));
847
833 /* Notify on change */ 848 /* Notify on change */
834 if ((GNUNET_YES == cur->addr->active) && (cur->addr != address_except)) 849 if ((GNUNET_YES == cur->addr->active) && (cur->addr != address_except))
835 s->bw_changed (s->bw_changed_cls, cur->addr); 850 s->bw_changed (s->bw_changed_cls, cur->addr);
@@ -856,6 +871,11 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s,
856 871
857 if (NULL != n) 872 if (NULL != n)
858 { 873 {
874 LOG (GNUNET_ERROR_TYPE_INFO,
875 "Redistributing bandwidth in network %s with %u active and %u total addresses\n",
876 GNUNET_ATS_print_network_type(n->type),
877 n->active_addresses, n->total_addresses);
878
859 if (NULL != s->env->info_cb) 879 if (NULL != s->env->info_cb)
860 s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_START, 880 s->env->info_cb(s->env->info_cb_cls, GAS_OP_SOLVE_START,
861 GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); 881 GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE);
@@ -1174,6 +1194,7 @@ GAS_proportional_get_preferred_address (void *solver,
1174 prev->active = GNUNET_NO; /* No active any longer */ 1194 prev->active = GNUNET_NO; /* No active any longer */
1175 prev->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ 1195 prev->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */
1176 prev->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ 1196 prev->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */
1197
1177 if (GNUNET_SYSERR == addresse_decrement (s, net_prev, GNUNET_NO, GNUNET_YES)) 1198 if (GNUNET_SYSERR == addresse_decrement (s, net_prev, GNUNET_NO, GNUNET_YES))
1178 GNUNET_break(0); 1199 GNUNET_break(0);
1179 distribute_bandwidth_in_network (s, net_prev, NULL); 1200 distribute_bandwidth_in_network (s, net_prev, NULL);
@@ -1212,18 +1233,24 @@ GAS_proportional_stop_get_preferred_address (void *solver,
1212 GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multipeermap_remove (s->requests, peer, 1233 GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multipeermap_remove (s->requests, peer,
1213 NULL)); 1234 NULL));
1214 1235
1215 cur = get_active_address (s, 1236 cur = get_active_address (s, s->addresses, peer);
1216 s->addresses, peer);
1217 if (NULL != cur) 1237 if (NULL != cur)
1218 { 1238 {
1239 LOG(GNUNET_ERROR_TYPE_INFO,
1240 "Disabling %s address %p for peer `%s'\n",
1241 (GNUNET_NO == cur->active) ? "inactive" : "active", cur,
1242 GNUNET_i2s (&cur->peer));
1243
1219 /* Disabling current address */ 1244 /* Disabling current address */
1220 asi = cur->solver_information; 1245 asi = cur->solver_information;
1221 cur_net = asi->network ; 1246 cur_net = asi->network ;
1222 cur->active = GNUNET_NO; /* No active any longer */ 1247 cur->active = GNUNET_NO; /* No active any longer */
1223 cur->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */ 1248 cur->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */
1224 cur->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */ 1249 cur->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */
1250
1225 if (GNUNET_SYSERR == addresse_decrement (s, cur_net, GNUNET_NO, GNUNET_YES)) 1251 if (GNUNET_SYSERR == addresse_decrement (s, cur_net, GNUNET_NO, GNUNET_YES))
1226 GNUNET_break(0); 1252 GNUNET_break(0);
1253
1227 distribute_bandwidth_in_network (s, cur_net, NULL ); 1254 distribute_bandwidth_in_network (s, cur_net, NULL );
1228 } 1255 }
1229 return; 1256 return;
@@ -1304,6 +1331,8 @@ GAS_proportional_address_delete (void *solver, struct ATS_Address *address,
1304 address->active = GNUNET_NO; 1331 address->active = GNUNET_NO;
1305 address->assigned_bw_in = BANDWIDTH_ZERO; 1332 address->assigned_bw_in = BANDWIDTH_ZERO;
1306 address->assigned_bw_out = BANDWIDTH_ZERO; 1333 address->assigned_bw_out = BANDWIDTH_ZERO;
1334 asi->calculated_quota_in_NBO = htonl (0);
1335 asi->calculated_quota_out_NBO = htonl (0);
1307 1336
1308 if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES)) 1337 if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES))
1309 GNUNET_break(0); 1338 GNUNET_break(0);
@@ -1604,8 +1633,8 @@ GAS_proportional_address_add (void *solver, struct ATS_Address *address,
1604 1633
1605 asi = GNUNET_new (struct AddressSolverInformation); 1634 asi = GNUNET_new (struct AddressSolverInformation);
1606 asi->network = net; 1635 asi->network = net;
1607 asi->calculated_quota_in_NBO = 0; 1636 asi->calculated_quota_in_NBO = htonl (0);
1608 asi->calculated_quota_out_NBO = 0; 1637 asi->calculated_quota_out_NBO = htonl (0);
1609 aw->addr->solver_information = asi; 1638 aw->addr->solver_information = asi;
1610 1639
1611 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (s->requests, &address->peer)) 1640 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (s->requests, &address->peer))