Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename routing_component to as, since that's just an AS at the end of the day
[simgrid.git] / src / surf / network.c
index 6d203b3..e3bd03a 100644 (file)
@@ -199,22 +199,42 @@ static void net_parse_link_init(sg_platf_link_cbarg_t link)
 {
   XBT_DEBUG("link_CM02");
 
-  if(link->policy == SURF_LINK_FULLDUPLEX)
-  {
-    net_create_resource(bprintf("%s_UP",link->id), link->bandwidth, link->bandwidth_trace,
-                      link->latency, link->latency_trace, link->state, link->state_trace,
-                      link->policy, link->properties);
-    net_create_resource(bprintf("%s_DOWN",link->id), link->bandwidth, link->bandwidth_trace,
-            link->latency, link->latency_trace, link->state, link->state_trace,
-            link->policy, NULL); // FIXME: We need to deep copy the properties or we won't be able to free it
-  }
-  else
-  {
-    net_create_resource(xbt_strdup(link->id), link->bandwidth, link->bandwidth_trace,
-               link->latency, link->latency_trace, link->state, link->state_trace,
-                      link->policy, link->properties);
+  if (link->policy == SURF_LINK_FULLDUPLEX) {
+    char *link_id;
+    link_id = bprintf("%s_UP", link->id);
+    net_create_resource(link_id,
+                        link->bandwidth,
+                        link->bandwidth_trace,
+                        link->latency,
+                        link->latency_trace,
+                        link->state,
+                        link->state_trace,
+                        link->policy,
+                        link->properties);
+    xbt_free(link_id);
+    link_id = bprintf("%s_DOWN", link->id);
+    net_create_resource(link_id,
+                        link->bandwidth,
+                        link->bandwidth_trace,
+                        link->latency,
+                        link->latency_trace,
+                        link->state,
+                        link->state_trace,
+                        link->policy,
+                        NULL); /* FIXME: We need to deep copy the properties or
+                                * we won't be able to free it */
+    xbt_free(link_id);
+  } else {
+    net_create_resource(link->id,
+                        link->bandwidth,
+                        link->bandwidth_trace,
+                        link->latency,
+                        link->latency_trace,
+                        link->state,
+                        link->state_trace,
+                        link->policy,
+                        link->properties);
   }
-
 }
 
 static void net_add_traces(void)
@@ -298,8 +318,7 @@ static int net_action_unref(surf_action_t action)
 #ifdef HAVE_TRACING
     xbt_free(((surf_action_network_CM02_t) action)->src_name);
     xbt_free(((surf_action_network_CM02_t) action)->dst_name);
-    if (action->category)
-      xbt_free(action->category);
+    xbt_free(action->category);
 #endif
     surf_action_free(&action);
     return 1;
@@ -816,11 +835,11 @@ static void surf_network_model_init_internal(void)
     network_maxmin_system = lmm_system_new();
 
   routing_model_create(sizeof(link_CM02_t),
-      net_create_resource(xbt_strdup("__loopback__"),
-          498000000, NULL, 0.000015, NULL,
-            SURF_RESOURCE_ON, NULL,
-            SURF_LINK_FATPIPE, NULL),
-            net_get_link_latency);
+                       net_create_resource("__loopback__",
+                                           498000000, NULL,
+                                           0.000015, NULL,
+                                           SURF_RESOURCE_ON, NULL,
+                                           SURF_LINK_FATPIPE, NULL));
 }
 
 
@@ -844,8 +863,6 @@ void surf_network_model_init_SMPI(void)
   xbt_cfg_setdefault_double(_surf_cfg_set, "network/sender_gap", 10e-6);
   xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 8775);
 
-  update_model_description(surf_network_model_description,
-                           "SMPI", surf_network_model);
 }
 
 /************************************************************************/
@@ -866,8 +883,6 @@ void surf_network_model_init_LegrandVelho(void)
                             0.92);
   xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 8775);
 
-  update_model_description(surf_network_model_description,
-                           "LV08_fullupdate", surf_network_model);
 }
 
 /***************************************************************************/
@@ -890,9 +905,6 @@ void surf_network_model_init_CM02(void)
   net_define_callbacks();
   xbt_dynar_push(model_list, &surf_network_model);
   network_solve = lmm_solve;
-
-  update_model_description(surf_network_model_description,
-                           "CM02", surf_network_model);
 }
 
 void surf_network_model_init_Reno(void)
@@ -911,9 +923,6 @@ void surf_network_model_init_Reno(void)
   xbt_cfg_setdefault_double(_surf_cfg_set, "network/bandwidth_factor",
                             0.92);
   xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 8775);
-
-  update_model_description(surf_network_model_description,
-                           "Reno", surf_network_model);
 }
 
 
@@ -934,9 +943,6 @@ void surf_network_model_init_Reno2(void)
                             0.92);
   xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S_parameter",
                             8775);
-
-  update_model_description(surf_network_model_description,
-                           "Reno2", surf_network_model);
 }
 
 void surf_network_model_init_Vegas(void)
@@ -955,7 +961,4 @@ void surf_network_model_init_Vegas(void)
   xbt_cfg_setdefault_double(_surf_cfg_set, "network/bandwidth_factor",
                             0.92);
   xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 8775);
-
-  update_model_description(surf_network_model_description,
-                           "Vegas", surf_network_model);
 }