From: Martin Quinson Date: Tue, 15 Nov 2011 01:01:25 +0000 (+0100) Subject: kill routing_get_route(), use routing_get_route_and_latency() instead X-Git-Tag: exp_20120216~281 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5679feeea5b84a6058073ce48ddfbc5be9f23e54 kill routing_get_route(), use routing_get_route_and_latency() instead --- diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index 75090b8f03..b0ac44e0a9 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -138,7 +138,8 @@ static void instr_user_srcdst_variable(double time, double value, InstrUserVariable what) { - xbt_dynar_t route = routing_get_route (src, dst); + xbt_dynar_t route; + routing_get_route_and_latency (src, dst, &route,NULL,1); unsigned int i; void *link; xbt_dynar_foreach (route, i, link) { diff --git a/src/instr/instr_routing.c b/src/instr/instr_routing.c index e75817ce99..f009b2a38f 100644 --- a/src/instr/instr_routing.c +++ b/src/instr/instr_routing.c @@ -113,7 +113,7 @@ static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t xbt_ex_t e; TRY { - route = routing_get_route(child1_name, child2_name); + routing_get_route_and_latency(child1_name, child2_name, &route, NULL, 1); } CATCH(e) { xbt_ex_free(e); } @@ -422,7 +422,8 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb strcmp (child1_name, child2_name) != 0){ // FIXME factorize route creation once possible - xbt_dynar_t route = routing_get_route (child1_name, child2_name); + xbt_dynar_t route; + routing_get_route_and_latency (child1_name, child2_name,&route,NULL,1); if (TRACE_onelink_only()){ if (xbt_dynar_length (route) > 1) continue; } diff --git a/src/surf/network.c b/src/surf/network.c index 0c45addafb..8753f1a421 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -413,7 +413,8 @@ static void net_update_actions_state(double now, double delta) } #ifdef HAVE_TRACING if (TRACE_is_enabled()) { - xbt_dynar_t route = routing_get_route(action->src_name, action->dst_name); + xbt_dynar_t route; + routing_get_route_and_latency(action->src_name, action->dst_name,&route,NULL,1); link_CM02_t link; unsigned int i; xbt_dynar_foreach(route, i, link) { @@ -589,7 +590,7 @@ static surf_action_t net_communicate(const char *src_name, routing_get_route_and_latency(src_name, dst_name, &route, &latency, 0); if (sg_network_fullduplex == 1) { - back_route = routing_get_route(dst_name, src_name); + routing_get_route_and_latency(dst_name, src_name, &back_route,NULL,1); } /* LARGE PLATFORMS HACK: @@ -722,7 +723,9 @@ static surf_action_t net_communicate(const char *src_name, static xbt_dynar_t net_get_route(const char *src, const char *dst) { - return routing_get_route(src, dst); + xbt_dynar_t route; + routing_get_route_and_latency(src, dst,&route, NULL,1); + return route; } static double net_get_link_bandwidth(const void *link) diff --git a/src/surf/network_im.c b/src/surf/network_im.c index 48447e1104..2ee4babfed 100644 --- a/src/surf/network_im.c +++ b/src/surf/network_im.c @@ -610,7 +610,7 @@ static surf_action_t im_net_communicate(const char *src_name, if (sg_network_fullduplex == 1) { - back_route = routing_get_route(dst_name, src_name); + routing_get_route_and_latency(dst_name, src_name, &back_route, NULL,1); } /* LARGE PLATFORMS HACK: @@ -747,7 +747,9 @@ static surf_action_t im_net_communicate(const char *src_name, static xbt_dynar_t im_net_get_route(const char *src, const char *dst) { - return routing_get_route(src, dst); + xbt_dynar_t route; + routing_get_route_and_latency(src, dst,&route,NULL,1); + return route; } static double im_net_get_link_bandwidth(const void *link) diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 323885f5b3..99af1caff9 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -176,7 +176,6 @@ XBT_PUBLIC(void) routing_register_callbacks(void); XBT_PUBLIC(void) generic_free_route(route_t route); // FIXME rename to routing_route_free -XBT_PUBLIC(xbt_dynar_t) routing_get_route(const char *src, const char *dst); XBT_PUBLIC(void) routing_get_route_and_latency(const char *src, const char *dst, //FIXME too much functions avail? xbt_dynar_t * route, double *latency, int cleanup); diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 42790c6ca5..61c0be47e4 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -627,7 +627,17 @@ static void _get_route_and_latency(const char *src, const char *dst, } /** - * \brief Generic function for get_route, get_route_no_cleanup, and get_latency + * \brief Find a route between hosts + * + * \param src the source host name + * \param dst the destination host name + * \param route where to store the list of links (or NULL if you are not interested in it) + * \param latency where to store the latency experienced on the path (or NULL if not interested) + * \param cleanup boolean whether the dynar should be automatically destroyed or not + * + * walk through the routing components tree and find a route between hosts + * by calling the differents "get_route" functions in each routing component. + * No need to free the returned dynar. It will be freed at the next call. */ void routing_get_route_and_latency(const char *src, const char *dst, xbt_dynar_t * route, double *latency, int cleanup) @@ -644,22 +654,6 @@ void routing_get_route_and_latency(const char *src, const char *dst, } } -/** - * \brief Find a route between hosts - * - * \param src the source host name - * \param dst the destination host name - * - * walk through the routing components tree and find a route between hosts - * by calling the differents "get_route" functions in each routing component. - * No need to free the returned dynar. It will be freed at the next call. - */ -xbt_dynar_t routing_get_route(const char *src, const char *dst) { - xbt_dynar_t route = NULL; - routing_get_route_and_latency(src, dst, &route, NULL, 1); - return route; -} - /** * \brief Generic method: find a route between hosts * diff --git a/src/surf/surf_routing_dijkstra.c b/src/surf/surf_routing_dijkstra.c index 02aef552de..b77cfaf337 100644 --- a/src/surf/surf_routing_dijkstra.c +++ b/src/surf/surf_routing_dijkstra.c @@ -360,8 +360,8 @@ static void dijkstra_get_route(AS_t asg, if (asg->hierarchy == SURF_ROUTING_RECURSIVE && v != dst_node_id && strcmp(gw_dst, prev_gw_src)) { - xbt_dynar_t e_route_as_to_as = - routing_get_route(gw_dst, prev_gw_src); + xbt_dynar_t e_route_as_to_as; + routing_get_route_and_latency(gw_dst, prev_gw_src,&e_route_as_to_as,NULL,1); xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"", gw_dst, prev_gw_src); links = e_route_as_to_as; diff --git a/src/surf/surf_routing_floyd.c b/src/surf/surf_routing_floyd.c index 7e4f4c2d27..cd869e9367 100644 --- a/src/surf/surf_routing_floyd.c +++ b/src/surf/surf_routing_floyd.c @@ -108,8 +108,8 @@ static void floyd_get_route(AS_t asg, const char *src, const char *dst, route_t if (asg->hierarchy == SURF_ROUTING_RECURSIVE && !first && strcmp(gw_dst, prev_gw_src)) { - xbt_dynar_t e_route_as_to_as = - routing_get_route(gw_dst, prev_gw_src); + xbt_dynar_t e_route_as_to_as; + routing_get_route_and_latency(gw_dst, prev_gw_src,&e_route_as_to_as,NULL,1); xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"", gw_dst, prev_gw_src); links = e_route_as_to_as; diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index c558a2e798..714590bab1 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -81,13 +81,13 @@ static void ptask_update_action_bound(surf_action_workstation_L07_t action) for (i = 0; i < workstation_nb; i++) { for (j = 0; j < workstation_nb; j++) { - xbt_dynar_t route = - routing_get_route(surf_resource_name - (action->workstation_list[i]), - surf_resource_name(action-> - workstation_list - [j])); + xbt_dynar_t route; + routing_get_route_and_latency(surf_resource_name + (action->workstation_list[i]), + surf_resource_name(action->workstation_list[j]), + &route, NULL,1); + // FIXME do we really need to recompute the latency here? double lat = 0.0; if (action->communication_amount[i * workstation_nb + j] > 0) { @@ -462,11 +462,11 @@ static surf_action_t ptask_execute_parallel_task(int workstation_nb, for (i = 0; i < workstation_nb; i++) { for (j = 0; j < workstation_nb; j++) { link_L07_t link; - xbt_dynar_t route = - routing_get_route(surf_resource_name - (workstation_list[i]), - surf_resource_name(workstation_list - [j])); + xbt_dynar_t route; + routing_get_route_and_latency( + surf_resource_name(workstation_list[i]), + surf_resource_name(workstation_list[j]), + &route,NULL,1); // FIXME: do we want to recompute the latency? double lat = 0.0; if (communication_amount[i * workstation_nb + j] > 0) @@ -516,11 +516,11 @@ static surf_action_t ptask_execute_parallel_task(int workstation_nb, for (i = 0; i < workstation_nb; i++) { for (j = 0; j < workstation_nb; j++) { link_L07_t link; - xbt_dynar_t route = - routing_get_route(surf_resource_name - (workstation_list[i]), - surf_resource_name(workstation_list - [j])); + xbt_dynar_t route; + routing_get_route_and_latency( + surf_resource_name(workstation_list[i]), + surf_resource_name(workstation_list[j]), + &route,NULL,1); if (communication_amount[i * workstation_nb + j] == 0.0) continue; @@ -591,8 +591,11 @@ static surf_action_t ptask_action_sleep(void *cpu, double duration) static xbt_dynar_t ptask_get_route(void *src, void *dst) // FIXME: kill that callback kind? { - return routing_get_route(surf_resource_name(src), - surf_resource_name(dst)); + xbt_dynar_t route; + routing_get_route_and_latency( + surf_resource_name(src), surf_resource_name(dst), + &route,NULL,1); + return route; } static double ptask_get_link_bandwidth(const void *link) diff --git a/teshsuite/simdag/platforms/flatifier.c b/teshsuite/simdag/platforms/flatifier.c index 7b3e375913..7e7bb7ffed 100644 --- a/teshsuite/simdag/platforms/flatifier.c +++ b/teshsuite/simdag/platforms/flatifier.c @@ -136,7 +136,8 @@ int main(int argc, char **argv) printf(" \n " ,src ,dst); - xbt_dynar_t route = routing_get_route(src,dst); + xbt_dynar_t route; + routing_get_route_and_latency(src,dst,&route,NULL,1); for(i=0;i\n " ,src ,dst); - xbt_dynar_t route = routing_get_route(src,dst); + xbt_dynar_t route; + routing_get_route_and_latency(src,dst,&route,NULL,1); for(i=0;i\n " ,src ,dst); - xbt_dynar_t route = routing_get_route(src,dst); + xbt_dynar_t route; + routing_get_route_and_latency(src,dst,&route,NULL,1); for(i=0;i\n " - ,src - ,dst); - xbt_dynar_t route = routing_get_route(src,dst); + ,src, dst); + xbt_dynar_t route; + routing_get_route_and_latency(src,dst,&route, NULL,1); for(i=0;i