Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correct the network_model_description_size in order to include Reno2.
[simgrid.git] / src / surf / surf.c
index 166c134..0d56e1b 100644 (file)
@@ -125,6 +125,7 @@ const char *surf_action_state_names[6] = {
   "SURF_ACTION_NOT_IN_THE_SYSTEM"
 };
 
+
 s_surf_model_description_t surf_network_model_description[surf_network_model_description_size] = {
   {"Constant", NULL, surf_network_model_init_Constant},
   {"CM02", NULL, surf_network_model_init_CM02},
@@ -135,6 +136,7 @@ s_surf_model_description_t surf_network_model_description[surf_network_model_des
   {"SDP", NULL, surf_network_model_init_SDP},
 #endif
   {"Reno", NULL, surf_network_model_init_Reno},
+  {"Reno2", NULL, surf_network_model_init_Reno2},
   {"Vegas", NULL, surf_network_model_init_Vegas}
 };
 
@@ -211,8 +213,6 @@ double generic_maxmin_share_resources(xbt_swag_t running_actions,
   } else
     min = action->max_duration;
 
-  DEBUG5("Found action (%p: duration = %f, remains = %f, value = %f) ! %f",
-        action, action->max_duration, action->remains, value, min);
 
   for (action = xbt_swag_getNext(action, running_actions->offset);
        action;
@@ -454,20 +454,14 @@ void surf_exit(void)
   xbt_exit();
 }
 
-double surf_solve(void)
-{
-  static int first_run = 1;
-
-  double min = -1.0;
+void surf_presolve(void) {
   double next_event_date = -1.0;
-  double model_next_action_end = -1.0;
+  tmgr_trace_event_t event = NULL;
   double value = -1.0;
   surf_model_object_t model_obj = NULL;
   surf_model_t model = NULL;
-  tmgr_trace_event_t event = NULL;
   unsigned int iter;
-
-  if (first_run) {
+   
     DEBUG0
        ("First Run! Let's \"purge\" events and put models in the right state");
     while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
@@ -478,15 +472,24 @@ double surf_solve(void)
                                              &value,
                                              (void **) &model_obj))) {
        model_obj->model->common_private->
-           update_resource_state(model_obj, event, value);
+         update_resource_state(model_obj, event, value,NOW);
       }
     }
     xbt_dynar_foreach(model_list, iter, model) {
       model->common_private->update_actions_state(NOW, 0.0);
     }
-    first_run = 0;
-    return 0.0;
-  }
+}
+
+double surf_solve(void)
+{
+  double min = -1.0;
+  double next_event_date = -1.0;
+  double model_next_action_end = -1.0;
+  double value = -1.0;
+  surf_model_object_t model_obj = NULL;
+  surf_model_t model = NULL;
+  tmgr_trace_event_t event = NULL;
+  unsigned int iter;
 
   min = -1.0;
 
@@ -526,7 +529,7 @@ double surf_solve(void)
       /* update state of model_obj according to new value. Does not touch lmm.
          It will be modified if needed when updating actions */
       model_obj->model->common_private->
-         update_resource_state(model_obj, event, value);
+       update_resource_state(model_obj, event, value,NOW+min);
     }
   }