- surf_callback_emit(cpuCreatedCallbacks, this);
- /* At now, we assume that a VM does not have a multicore CPU. */
- if (core > 1)
- xbt_assert(model == surf_cpu_model_pm);
+ xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->name().c_str());
+
+ speed_.peak = xbt_dynar_get_as(speedPerPstate, 0/*pstate*/, double);
+ speed_.scale = 1;
+ host->pimpl_cpu = this;
+ xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->name().c_str());
+
+ // Copy the power peak array:
+ speedPerPstate_ = xbt_dynar_new(sizeof(double), nullptr);
+ unsigned long n = xbt_dynar_length(speedPerPstate);
+ for (unsigned long i = 0; i != n; ++i) {
+ double value = xbt_dynar_get_as(speedPerPstate, i, double);
+ xbt_dynar_push(speedPerPstate_, &value);
+ }
+
+ xbt_assert(model == surf_cpu_model_pm || core==1, "Currently, VM cannot be multicore");