Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] bug fix on the way that routes are used to extract topology
[simgrid.git] / src / instr / instr_routing.c
index 4dc65be..9ac0932 100644 (file)
@@ -109,15 +109,18 @@ static void recursiveGraphExtraction (routing_component_t rc, container_t contai
           (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);
+        xbt_dynar_t route = NULL;
+        route = global_routing->get_route_or_null (child1_name, child2_name);
+        if (route == NULL) continue;
+
         if (TRACE_onelink_only()){
           if (xbt_dynar_length (route) > 1) continue;
         }
-        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;
+        int i;
+        for (i = 0; i < xbt_dynar_length(route); i++){
+          link_CM02_t *link = ((link_CM02_t*)xbt_dynar_get_ptr (route, i));
+          char *link_name = (*link)->lmm_resource.generic_resource.name;
           container_t current = getContainerByName(link_name);
           linkContainers(container, previous, current, filter);
           previous = current;
@@ -209,10 +212,12 @@ static void instr_routing_parse_start_link ()
 
     container_t new = newContainer (link_name, INSTR_LINK, father);
 
-    type_t bandwidth = getVariableType ("bandwidth", NULL, new->type);
-    type_t latency = getVariableType ("latency", NULL, new->type);
-    new_pajeSetVariable (0, new, bandwidth, bandwidth_value);
-    new_pajeSetVariable (0, new, latency, latency_value);
+    if (TRACE_categorized() || TRACE_uncategorized()){
+      type_t bandwidth = getVariableType ("bandwidth", NULL, new->type);
+      type_t latency = getVariableType ("latency", NULL, new->type);
+      new_pajeSetVariable (0, new, bandwidth, bandwidth_value);
+      new_pajeSetVariable (0, new, latency, latency_value);
+    }
     if (TRACE_uncategorized()){
       getVariableType ("bandwidth_used", "0.5 0.5 0.5", new->type);
     }
@@ -230,18 +235,18 @@ static void instr_routing_parse_start_host ()
   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
   container_t new = newContainer (A_surfxml_host_id, INSTR_HOST, father);
 
-  type_t power = getVariableType ("power", NULL, new->type);
-  new_pajeSetVariable (0, new, power, atof(A_surfxml_host_power));
+  if (TRACE_categorized() || TRACE_uncategorized()) {
+    type_t power = getVariableType ("power", NULL, new->type);
+    new_pajeSetVariable (0, new, power, atof(A_surfxml_host_power));
+  }
   if (TRACE_uncategorized()){
     getVariableType ("power_used", "0.5 0.5 0.5", new->type);
   }
 
-  if (TRACE_smpi_is_enabled()) {
-    if (TRACE_smpi_is_grouped()){
-      type_t mpi = getContainerType("MPI", new->type);
-      getStateType ("MPI_STATE", mpi);
-      getLinkType ("MPI_LINK", getRootType(), mpi, mpi);
-    }
+  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()){
+    type_t mpi = getContainerType("MPI", new->type);
+    getStateType ("MPI_STATE", mpi);
+    getLinkType ("MPI_LINK", getRootType(), mpi, mpi);
   }
 
   if (TRACE_msg_process_is_enabled()) {