X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/29399b5261c3ff1e181eb75ee32d00aafeef5b26..3736e0252d96679e19cfbe41f3c09833d3734386:/src/surf/surf_routing_full.c diff --git a/src/surf/surf_routing_full.c b/src/surf/surf_routing_full.c index 1263e94e9f..cc9c5419c1 100644 --- a/src/surf/surf_routing_full.c +++ b/src/surf/surf_routing_full.c @@ -61,9 +61,9 @@ static xbt_dynar_t full_get_onelink_routes(AS_t rc) return ret; } -static void full_get_route(AS_t rc, +static void full_get_route_and_latency(AS_t rc, const char *src, const char *dst, - route_t res) + route_t res,double *lat) { /* set utils vars */ @@ -87,6 +87,8 @@ static void full_get_route(AS_t rc, res->dst_gateway = xbt_strdup(e_route->dst_gateway); xbt_dynar_foreach(e_route->link_list, cpt, link) { xbt_dynar_push(res->link_list, &link); + if (lat) + *lat += surf_network_model->extension.network.get_link_latency(link); } } } @@ -115,7 +117,7 @@ AS_t model_full_create(void) new_component->generic_routing.parse_route = model_full_set_route; new_component->generic_routing.parse_ASroute = model_full_set_route; - new_component->generic_routing.get_route = full_get_route; + new_component->generic_routing.get_route_and_latency = full_get_route_and_latency; new_component->generic_routing.get_onelink_routes = full_get_onelink_routes; new_component->generic_routing.finalize = full_finalize; @@ -154,7 +156,7 @@ void model_full_end(AS_t current_routing) } } -static int surf_pointer_resource_cmp(const void *a, const void *b) { +static int full_pointer_resource_cmp(const void *a, const void *b) { return a != b; } @@ -191,7 +193,7 @@ void model_full_set_route(AS_t rc, const char *src, xbt_assert(!xbt_dynar_compare( (void*)TO_ROUTE_FULL(*src_id, *dst_id)->link_list, (void*)link_route_to_test, - (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp), + (int_f_cpvoid_cpvoid_t) full_pointer_resource_cmp), "The route between \"%s\" and \"%s\" already exists. If you are trying to define a reverse route, you must set the symmetrical=no attribute to your routes tags.", src,dst); } else @@ -235,7 +237,7 @@ void model_full_set_route(AS_t rc, const char *src, xbt_assert(!xbt_dynar_compare( (void*)TO_ROUTE_FULL(*dst_id, *src_id)->link_list, (void*)link_route_to_test, - (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp), + (int_f_cpvoid_cpvoid_t) full_pointer_resource_cmp), "The route between \"%s\" and \"%s\" already exists", src,dst); } else @@ -249,6 +251,4 @@ void model_full_set_route(AS_t rc, const char *src, xbt_dynar_shrink(TO_ROUTE_FULL(*dst_id, *src_id)->link_list, 0); } } - - generic_free_route((route_t)route) ; }