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) {
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);
}
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;
}
}
#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) {
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:
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)
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:
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)
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);
}
/**
- * \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)
}
}
-/**
- * \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
*
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;
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;
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) {
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)
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;
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)
printf(" <route src=\"%s\" dst=\"%s\">\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<xbt_dynar_length(route) ;i++)
{
void *link = xbt_dynar_get_as(route,i,void *);
printf(" <route src=\"%s\" dst=\"%s\">\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<xbt_dynar_length(route) ;i++)
{
void *link = xbt_dynar_get_as(route,i,void *);
printf(" <route src=\"%s\" dst=\"%s\">\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<xbt_dynar_length(route) ;i++)
{
void *link = xbt_dynar_get_as(route,i,void *);
xbt_lib_foreach(host_lib, cursor_dst, dst, value) //to host
{
printf(" <route src=\"%s\" dst=\"%s\">\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<xbt_dynar_length(route) ;i++)
{
void *link = xbt_dynar_get_as(route,i,void *);