Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[surf] new (abstract) class: PropertyHolder, with only one purpose
[simgrid.git] / src / surf / cpu_ti.cpp
index 3e2d91b..dd729be 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_ti, surf_cpu,
                                 "Logging specific to the SURF CPU TRACE INTEGRATION module");
 
-static void cpu_ti_action_update_index_heap(void *action, int i);
+namespace simgrid {
+namespace surf {
+  
+static inline
+void cpu_ti_action_update_index_heap(void *action, int i)
+{
+  ((simgrid::surf::CpuTiAction*)action)->updateIndexHeap(i);
+}
 
 /*********
  * Trace *
@@ -375,13 +382,16 @@ int CpuTiTrace::binarySearch(double *array, double a, int low, int high)
   return low;
 }
 
+}
+}
+
 /*************
  * CallBacks *
  *************/
 
 static void cpu_ti_define_callbacks()
 {
-  sg_platf_postparse_add_cb(cpu_add_traces);
+  sg_platf_postparse_add_cb(simgrid::surf::cpu_add_traces);
 }
 
 /*********
@@ -393,16 +403,19 @@ void surf_cpu_model_init_ti()
   xbt_assert(!surf_cpu_model_pm,"CPU model already initialized. This should not happen.");
   xbt_assert(!surf_cpu_model_vm,"CPU model already initialized. This should not happen.");
 
-  surf_cpu_model_pm = new CpuTiModel();
-  surf_cpu_model_vm = new CpuTiModel();
+  surf_cpu_model_pm = new simgrid::surf::CpuTiModel();
+  surf_cpu_model_vm = new simgrid::surf::CpuTiModel();
 
   cpu_ti_define_callbacks();
-  Model *model_pm = static_cast<Model*>(surf_cpu_model_pm);
-  Model *model_vm = static_cast<Model*>(surf_cpu_model_vm);
+  simgrid::surf::Model *model_pm = static_cast<simgrid::surf::Model*>(surf_cpu_model_pm);
+  simgrid::surf::Model *model_vm = static_cast<simgrid::surf::Model*>(surf_cpu_model_vm);
   xbt_dynar_push(all_existing_models, &model_pm);
   xbt_dynar_push(all_existing_models, &model_vm);
 }
 
+namespace simgrid {
+namespace surf {
+
 CpuTiModel::CpuTiModel() : CpuModel()
 {
   p_runningActionSetThatDoesNotNeedBeingChecked = new ActionList();
@@ -429,16 +442,13 @@ Cpu *CpuTiModel::createCpu(const char *name,
                            tmgr_trace_t speedTrace,
                            int core,
                            e_surf_resource_state_t stateInitial,
-                           tmgr_trace_t stateTrace,
-                           xbt_dict_t cpuProperties)
+                           tmgr_trace_t stateTrace)
 {
   xbt_assert(core==1,"Multi-core not handled with this model yet");
-  sg_host_t host = sg_host_by_name(name);
   xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
       "Speed has to be >0.0. Did you forget to specify the mandatory speed attribute?");
   CpuTi *cpu = new CpuTi(this, name, speedPeak, pstate, speedScale, speedTrace,
-                          core, stateInitial, stateTrace, cpuProperties);
-  sg_host_surfcpu_register(host, cpu);
+                          core, stateInitial, stateTrace);
   return cpu;
 }
 
@@ -540,9 +550,8 @@ void CpuTiModel::addTraces()
  ************/
 CpuTi::CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t speedPeak,
         int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
-        e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
-             xbt_dict_t properties)
-  : Cpu(model, name, properties, core, 0, speedScale, stateInitial)
+        e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace)
+  : Cpu(model, name, core, 0, speedScale, stateInitial)
 {
   p_speedEvent = NULL;
   m_speedScale = speedScale;
@@ -844,11 +853,6 @@ void CpuTi::modified(bool modified){
  * Action *
  **********/
 
-static void cpu_ti_action_update_index_heap(void *action, int i)
-{
-((CpuTiAction*)action)->updateIndexHeap(i);
-}
-
 CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed,
                                 CpuTi *cpu)
  : CpuAction(model_, cost, failed)
@@ -965,5 +969,7 @@ double CpuTiAction::getRemains()
   return m_remains;
 }
 
-#endif /* SURF_MODEL_CPUTI_H_ */
+}
+}
 
+#endif /* SURF_MODEL_CPUTI_H_ */