Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
{
- xbt_assert(xbt_dynar_getfirst_as(speedPerPstate, double) > 0.0,
- "Speed has to be >0.0. Did you forget to specify the mandatory power attribute?");
- xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core);
return new CpuCas01(this, host, speedPerPstate, core);
}
, coresAmount_(core)
, host_(host)
{
+ 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, "Available speed has to be >0");
+ 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);
xbt_heap_free(tiActionHeap_);
}
-Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speeds, int core)
+Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
{
- xbt_assert(core==1,"Multi-core not handled with this model yet");
- xbt_assert(xbt_dynar_getfirst_as(speeds, double) > 0.0,
- "Speed has to be >0.0. Did you forget to specify the mandatory speed attribute?");
- return new CpuTi(this, host, speeds, core);
+ return new CpuTi(this, host, speedPerPstate, core);
}
double CpuTiModel::next_occuring_event(double now)
public:
CpuTiModel();
~CpuTiModel();
- Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speeds, int core) override;
+ Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) override;
double next_occuring_event(double now) override;
void updateActionsState(double now, double delta) override;