Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A few spelling mistakes and many replacements: [Ss]imgrid -> SimGrid.
[simgrid.git] / src / kernel / resource / models / cpu_ti.cpp
index 401a212ef5023423df805164e1794ccf3670f673..6b522bb29693eda460d2189b794853f7d7483d5b 100644 (file)
@@ -337,6 +337,16 @@ CpuTi::~CpuTi()
   delete speed_integrated_trace_;
 }
 
+void CpuTi::turn_off()
+{
+  /* Skip CpuImpl::turn_off() that marks the actions as failing, as it seems to be done otherwise in CPU TI.
+   * So, just avoid the segfault for now.
+   *
+   * TODO: a proper solution would be to understand and adapt the way actions are marked FAILED in here,
+   * and adapt it to align with the other resources. */
+  Resource::turn_off();
+}
+
 CpuImpl* CpuTi::set_speed_profile(kernel::profile::Profile* profile)
 {
   delete speed_integrated_trace_;
@@ -377,13 +387,13 @@ void CpuTi::apply_event(kernel::profile::Event* event, double value)
       }
     } else {
       get_iface()->turn_off();
-      double date = EngineImpl::get_clock();
 
       /* put all action running on cpu to failed */
+      double now = EngineImpl::get_clock();
       for (CpuTiAction& action : action_set_) {
         if (action.get_state() == Action::State::INITED || action.get_state() == Action::State::STARTED ||
             action.get_state() == Action::State::IGNORED) {
-          action.set_finish_time(date);
+          action.set_finish_time(now);
           action.set_state(Action::State::FAILED);
           get_model()->get_action_heap().remove(&action);
         }