-CpuCas01::CpuCas01(CpuCas01Model *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,
- lmm_constraint_new(model->getMaxminSystem(), this, core * speedScale * xbt_dynar_get_as(speedPeak, pstate, double)),
- core, xbt_dynar_get_as(speedPeak, pstate, double), speedScale,
- stateInitial) {
- p_speedEvent = NULL;
-
- // Copy the power peak array:
- p_speedPeakList = xbt_dynar_new(sizeof(double), nullptr);
- unsigned long n = xbt_dynar_length(speedPeak);
- for (unsigned long i = 0; i != n; ++i) {
- double value = xbt_dynar_get_as(speedPeak, i, double);
- xbt_dynar_push(p_speedPeakList, &value);
- }
-
- m_pstate = pstate;
-
- XBT_DEBUG("CPU create: peak=%f, pstate=%d", m_speedPeak, m_pstate);
-
- m_core = core;
- if (speedTrace)
- p_speedEvent = tmgr_history_add_trace(history, speedTrace, 0.0, 0, this);
-
- if (stateTrace)
- p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, this);
-}
-
-CpuCas01::~CpuCas01(){
- if (getModel() == surf_cpu_model_pm)
- xbt_dynar_free(&p_speedPeakList);
-}
-
-void CpuCas01::setStateEvent(tmgr_trace_event_t stateEvent)
+CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
+: Cpu(model, host,
+ lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedPerPstate, 0/*pstate*/, double)),
+ speedPerPstate, core)