Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make HostL07 behave more like the regular Host
[simgrid.git] / src / surf / cpu_cas01.cpp
index a4579f2..8644a7b 100644 (file)
@@ -30,7 +30,6 @@ void surf_cpu_model_init_Cas01()
   surf_cpu_model_pm = new CpuCas01Model();
   surf_cpu_model_vm  = new CpuCas01Model();
 
-  sg_platf_host_add_cb(cpu_parse_init);
   sg_platf_postparse_add_cb(cpu_add_traces);
 
   Model *model_pm = surf_cpu_model_pm;
@@ -167,7 +166,15 @@ CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t powerPeak
          core, xbt_dynar_get_as(powerPeak, pstate, double), powerScale,
     stateInitial) {
   p_powerEvent = NULL;
-  p_powerPeakList = powerPeak;
+
+  // Copy the power peak array:
+  p_powerPeakList = xbt_dynar_new(sizeof(double), nullptr);
+  unsigned long n = xbt_dynar_length(powerPeak);
+  for (unsigned long i = 0; i != n; ++i) {
+    double value = xbt_dynar_get_as(powerPeak, i, double);
+    xbt_dynar_push(p_powerPeakList, &value);
+  }
+
   m_pstate = pstate;
 
   XBT_DEBUG("CPU create: peak=%f, pstate=%d", m_powerPeak, m_pstate);