Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix ns3.
[simgrid.git] / src / surf / surf.c
index 41ec013..b80d1fd 100644 (file)
@@ -312,12 +312,14 @@ void surf_init(int *argc, char **argv)
   link_lib = xbt_lib_new();
   as_router_lib = xbt_lib_new();
   storage_lib = xbt_lib_new();
+  storage_type_lib = xbt_lib_new();
 
   XBT_DEBUG("ADD ROUTING LEVEL");
   ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,xbt_free);
   ROUTING_ASR_LEVEL  = xbt_lib_add_level(as_router_lib,xbt_free);
-  // FOR NOW UNUSED
-//  ROUTING_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,NULL);
+  ROUTING_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,xbt_free);
+  ROUTING_STORAGE_HOST_LEVEL = xbt_lib_add_level(storage_lib,routing_storage_host_free);
+  ROUTING_STORAGE_TYPE_LEVEL = xbt_lib_add_level(storage_type_lib,routing_storage_type_free);
 
   XBT_DEBUG("ADD SURF LEVELS");
   SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,surf_resource_free);
@@ -419,6 +421,7 @@ void surf_exit(void)
   xbt_lib_free(&link_lib);
   xbt_lib_free(&as_router_lib);
   xbt_lib_free(&storage_lib);
+  xbt_lib_free(&storage_type_lib);
 
   tmgr_finalize();
   surf_parse_lex_destroy();
@@ -590,14 +593,15 @@ XBT_INLINE double surf_get_clock(void)
 
 static void surf_share_resources(surf_model_t model)
 {
+  double next_action_end = -1.0;
+  int i = __sync_fetch_and_add(&surf_min_index, 1);
   if (strcmp(model->name,"network NS3")) {
     XBT_DEBUG("Running for Resource [%s]", model->name);
-    double next_action_end = model->model_private->share_resources(NOW);
+    next_action_end = model->model_private->share_resources(NOW);
     XBT_DEBUG("Resource [%s] : next action end = %f",
         model->name, next_action_end);
-    int i = __sync_fetch_and_add(&surf_min_index, 1);
-    surf_mins[i] = next_action_end;
   }
+  surf_mins[i] = next_action_end;
 }
 
 static void surf_update_actions_state(surf_model_t model)