Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix smpi replay issue
[simgrid.git] / src / surf / cpu.cpp
index a1ac6ea6cb1d8566f84f83d9d1d2ca0c5116a8f7..fe58cf0af0da2b3961e4715f8a9529f17c0944da 100644 (file)
@@ -1,17 +1,11 @@
 #include "cpu.hpp"
 
-//TODO: resolve dependencies
-static int TRACE_is_enabled(void) {return 0;}
-static void TRACE_surf_host_set_utilization(const char *resource,
-                                     const char *category,
-                                     double value,
-                                     double now,
-                                     double delta){}
-static double TRACE_last_timestamp_to_dump = 0;
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surfpp_cpu, surfpp,
+extern "C" {
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
                                 "Logging specific to the SURF cpu module");
+}
 
+CpuModelPtr surf_cpu_model;
 
 /*********
  * Model *
@@ -49,7 +43,7 @@ void CpuModel::updateActionsStateLazy(double now, double delta)
     //without losing the event ascending order (considering all CPU's)
     double smaller = -1;
     xbt_swag_foreach(_action, p_runningActionSet) {
-      action = (ActionLmmPtr) _action;
+      action = dynamic_cast<ActionLmmPtr>(static_cast<ActionPtr>(_action));
         if (smaller < 0) {
           smaller = action->m_lastUpdate;
           continue;
@@ -74,7 +68,7 @@ void CpuModel::updateActionsStateFull(double now, double delta)
   xbt_swag_t running_actions = p_runningActionSet;
 
   xbt_swag_foreach_safe(_action, _next_action, running_actions) {
-    action = (ActionLmmPtr) _action;
+    action = dynamic_cast<ActionLmmPtr>(static_cast<ActionPtr>(_action));
 #ifdef HAVE_TRACING
     if (TRACE_is_enabled()) {
       CpuPtr x = (CpuPtr) lmm_constraint_id(lmm_get_cnst_from_var