Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branches 'auto_restart' and 'auto_restart' of framagit.org:simgrid/simgrid
[simgrid.git] / src / surf / ptask_L07.cpp
index f0deae5..6e75461 100644 (file)
@@ -22,10 +22,9 @@ void surf_host_model_init_ptask_L07()
   xbt_assert(not surf_network_model, "Cannot switch to ptasks: network model already defined");
 
   surf_host_model = new simgrid::surf::HostL07Model();
-  all_existing_models->push_back(surf_host_model);
+  all_existing_models.push_back(surf_host_model);
 }
 
-
 namespace simgrid {
 namespace surf {
 
@@ -146,6 +145,7 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos
   int nb_link = 0;
   int nb_used_host = 0; /* Only the hosts with something to compute (>0 flops) are counted) */
   double latency = 0.0;
+  this->set_last_update();
 
   this->hostList_->reserve(host_nb);
   for (int i = 0; i < host_nb; i++) {
@@ -315,10 +315,13 @@ void CpuL07::apply_event(tmgr_trace_event_t triggered, double value)
     tmgr_trace_event_unref(&speed_.event);
 
   } else if (triggered == state_event_) {
-    if (value > 0)
-      turn_on();
-    else
-      turn_off();
+    if (value > 0) {
+      if (is_off()) {
+        host_that_restart.push_back(get_host());
+        get_host()->turn_on();
+      }
+    } else
+      get_host()->turn_off();
     tmgr_trace_event_unref(&state_event_);
 
   } else {