Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix bug when creating topology graph with model dijkstra.
[simgrid.git] / src / surf / surf_routing.c
index 0611c53..44a6e90 100644 (file)
@@ -289,9 +289,6 @@ static void parse_S_router(void)
   info->rc_type = SURF_NETWORK_ELEMENT_ROUTER;
   xbt_dict_set(global_routing->where_network_elements, A_surfxml_router_id,
                (void *) info, xbt_free);
-#ifdef HAVE_TRACING
-  TRACE_surf_host_declaration(A_surfxml_router_id, 0);
-#endif
   if (strcmp(A_surfxml_router_coordinates,"")) {
        xbt_dynar_t ctn = xbt_str_split_str(A_surfxml_router_coordinates, " ");
        xbt_dynar_shrink(ctn,0);
@@ -1111,6 +1108,10 @@ void routing_model_create(size_t size_of_links, void *loopback, double_f_cpvoid_
                                           &routing_parse_Sconfig);
   surfxml_add_callback(ETag_surfxml_config_cb_list,
                                           &routing_parse_Econfig);
+
+#ifdef HAVE_TRACING
+  instr_routing_define_callbacks();
+#endif
 }
 
 /* ************************************************************************** */
@@ -1863,9 +1864,10 @@ static void route_new_dijkstra(routing_component_dijkstra_t rc, int src_id,
                                int dst_id, route_extended_t e_route)
 {
   routing_component_dijkstra_t routing = (routing_component_dijkstra_t) rc;
-
+  DEBUG2("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
   xbt_node_t src = NULL;
   xbt_node_t dst = NULL;
+
   graph_node_map_element_t src_elm = (graph_node_map_element_t)
       xbt_dict_get_or_null_ext(routing->graph_node_map,
                                (char *) (&src_id),
@@ -1875,6 +1877,7 @@ static void route_new_dijkstra(routing_component_dijkstra_t rc, int src_id,
                                (char *) (&dst_id),
                                sizeof(int));
 
+
   if (src_elm)
     src = src_elm->node;
 
@@ -2222,13 +2225,6 @@ static void model_dijkstra_both_end(void)
   unsigned int cursor2;
   xbt_dynar_t nodes = NULL;
 
-  /* Create the topology graph */
-  routing->route_graph = xbt_graph_new_graph(1, NULL);
-  routing->graph_node_map = xbt_dict_new();
-
-  if (routing->cached && !routing->route_cache)
-    routing->route_cache = xbt_dict_new();
-
   /* Add the loopback if needed */
   if (current_routing->hierarchy == SURF_ROUTING_BASE)
     add_loopback_dijkstra(routing);
@@ -2250,6 +2246,12 @@ static void model_dijkstra_both_set_route (routing_component_t rc, const char *s
        src_id = xbt_dict_get_or_null(rc->to_index, src);
        dst_id = xbt_dict_get_or_null(rc->to_index, dst);
 
+    /* Create the topology graph */
+       if(!routing->route_cache)
+       routing->route_graph = xbt_graph_new_graph(1, NULL);
+       if(!routing->graph_node_map)
+       routing->graph_node_map = xbt_dict_new();
+
        if (routing->cached && !routing->route_cache)
        routing->route_cache = xbt_dict_new();
 
@@ -3266,8 +3268,6 @@ static void routing_parse_Scluster(void)
   char *cluster_state_file = A_surfxml_cluster_state_file;
   char *host_id, *groups, *link_id = NULL;
   char *router_id, *link_router, *link_backbone;
-  char *host_availability_file = NULL;
-  char *host_state_file = NULL;
   char *availability_file = bprintf("%s",cluster_availability_file);
   char *state_file = bprintf("%s",cluster_state_file);