-Cpu::Cpu(int core, double powerPeak, double powerScale)
- : m_core(core), m_powerPeak(powerPeak), m_powerScale(powerScale)
-{}
+Cpu::Cpu(Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint,
+ xbt_dynar_t speedPeakList, int pstate,
+ int core, double speedPeak,
+ double speedScale, int initiallyOn)
+ : Resource(model, host->name().c_str(), constraint, initiallyOn)
+ , m_core(core)
+ , m_speedPeak(speedPeak)
+ , m_speedScale(speedScale)
+ , m_host(host)
+{
+ host->pimpl_cpu = this;
+ xbt_assert(m_speedScale > 0, "Available speed has to be >0");
+
+ // Copy the power peak array:
+ p_speedPeakList = xbt_dynar_new(sizeof(double), nullptr);
+ unsigned long n = xbt_dynar_length(speedPeakList);
+ for (unsigned long i = 0; i != n; ++i) {
+ double value = xbt_dynar_get_as(speedPeakList, i, double);
+ xbt_dynar_push(p_speedPeakList, &value);
+ }