Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A commit before a design modification. I'm gonna try the weird
[simgrid.git] / src / surf / surf.c
index ecc3e9e..eeff674 100644 (file)
@@ -37,7 +37,7 @@ void surf_action_change_state(surf_action_t action, e_surf_action_state_t state)
 {
   surf_action_state_t action_state = &(action->resource_type->states); 
 
-  xbt_swag_extract(action, action->state_set);
+  xbt_swag_remove(action, action->state_set);
 
   if(state == SURF_ACTION_READY) 
     action->state_set = action_state->ready_action_set;
@@ -68,6 +68,16 @@ xbt_heap_float_t surf_solve(void)
   surf_resource_t resource = NULL;
   int i;
 
+  while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
+    if(next_event_date > NOW) break;
+    while (tmgr_history_get_next_event_leq(history, next_event_date,
+                                          &value, (void **) &resource)) {
+      if(surf_cpu_resource->resource.resource_used(resource)) {
+       min = next_event_date-NOW;
+      }
+    }
+  }
+
   xbt_dynar_foreach (resource_list,i,resource) {
     resource_next_action_end = resource->share_resources(NOW);
     if((min<0) || (resource_next_action_end<min))