- if (child2->kind == INSTR_LINK) continue;
-
- if ((child1->kind == INSTR_HOST || child1->kind == INSTR_ROUTER) &&
- (child2->kind == INSTR_HOST || child2->kind == INSTR_ROUTER) &&
- strcmp (child1_name, child2_name) != 0){
-
- xbt_dynar_t route = global_routing->get_route (child1_name, child2_name);
- unsigned int cpt;
- void *link;
- container_t previous = child1;
- xbt_dynar_foreach (route, cpt, link) {
- char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
- container_t current = getContainerByName(link_name);
- linkContainers(container, previous, current, filter);
- previous = current;
- }
- linkContainers(container, previous, child2, filter);
-
- }else if (child1->kind == INSTR_AS &&
- child2->kind == INSTR_AS &&
- strcmp(child1_name, child2_name) != 0){
-
- route_extended_t route = rc->get_route (rc, child1_name, child2_name);
- unsigned int cpt;
- void *link;
- container_t previous = getContainerByName(route->src_gateway);
- xbt_dynar_foreach (route->generic_route.link_list, cpt, link) {
- char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
- container_t current = getContainerByName(link_name);
- linkContainers (container, previous, current, filter);
- previous = current;
- }
- container_t last = getContainerByName(route->dst_gateway);
- linkContainers (container, previous, last, filter);
+ if (graph_extraction_filter_out (child2, child1)) continue;
+ XBT_DEBUG ("get_route from %s to %s", child1_name, child2_name);
+
+ //get the route
+ sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
+ route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
+ rc->get_route_and_latency(rc, child1->net_elm, child2->net_elm,
+ route, NULL);
+
+ //user might want to extract a graph using routes with only one link
+ //see --cfg=tracing/onelink_only:1 or --help-tracing for details
+ if (TRACE_onelink_only() && xbt_dynar_length (route->link_list) > 1){
+ generic_free_route(route);
+ continue;
+ }
+
+ //traverse the route connecting the containers
+ unsigned int cpt;
+ void *link;
+ container_t current, previous;
+ if (route->gw_src){
+ previous = PJ_container_get(route->gw_src->name);
+ }else{
+ previous = child1;
+ }
+
+ xbt_dynar_foreach (route->link_list, cpt, link) {
+ //FIXME (TODO): Should have a cleaner way to get the link name
+ char *link_name = ((link_CM02_t)link)->lmm_resource.generic_resource.name;
+ current = PJ_container_get(link_name);
+ linkContainers(previous, current, filter);
+ previous = current;
+ }
+ if (route->gw_dst){
+ current = PJ_container_get(route->gw_dst->name);
+ }else{
+ current = child2;