xbt_assert(!surf_network_model, "network model type already defined");
surf_host_model = new simgrid::surf::HostL07Model();
- xbt_dynar_push(all_existing_models, &surf_host_model);
+ all_existing_models->push_back(surf_host_model);
}
L07Action *action;
ActionList *running_actions = getRunningActionSet();
- double min = this->shareResourcesMaxMin(running_actions,
- maxminSystem_,
- bottleneck_solve);
+ double min = this->shareResourcesMaxMin(running_actions, maxminSystem_, bottleneck_solve);
- for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end())
- ; it != itend ; ++it) {
+ for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end()); it != itend ; ++it) {
action = static_cast<L07Action*>(&*it);
if (action->m_latency > 0) {
if (min < 0) {
min = action->m_latency;
- XBT_DEBUG("Updating min (value) with %p (start %f): %f", action,
- action->getStartTime(), min);
+ XBT_DEBUG("Updating min (value) with %p (start %f): %f", action, action->getStartTime(), min);
} else if (action->m_latency < min) {
min = action->m_latency;
- XBT_DEBUG("Updating min (latency) with %p (start %f): %f", action,
- action->getStartTime(), min);
+ XBT_DEBUG("Updating min (latency) with %p (start %f): %f", action, action->getStartTime(), min);
}
}
}
}
Action *HostL07Model::executeParallelTask(int host_nb, sg_host_t *host_list,
- double *flops_amount, double *bytes_amount,
- double rate) {
+ double *flops_amount, double *bytes_amount,double rate) {
return new L07Action(this, host_nb, host_list, flops_amount, bytes_amount, rate);
}
-L07Action::L07Action(Model *model, int host_nb, sg_host_t*host_list,
- double *flops_amount, double *bytes_amount, double rate)
+L07Action::L07Action(Model *model, int host_nb, sg_host_t *host_list,
+ double *flops_amount, double *bytes_amount, double rate)
: CpuAction(model, 1, 0)
{
int nb_link = 0;
return p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate);
}
-Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
+Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core)
{
return new CpuL07(this, host, speedPerPstate, core);
}
* Resource *
************/
-CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
+CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core)
: Cpu(model, host, speedPerPstate, core)
{
- constraint_ = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPerPstate,0,double));
+ constraint_ = lmm_constraint_new(model->getMaxminSystem(), this, speedPerPstate->front());
}
-CpuL07::~CpuL07()
-{
-}
+CpuL07::~CpuL07()=default;
LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
host_list[0] = getHost();
flops_amount[0] = size;
- return static_cast<CpuL07Model*>(getModel())->p_hostModel
- ->executeParallelTask( 1, host_list, flops_amount, nullptr, -1);
+ return static_cast<CpuL07Model*>(getModel())->p_hostModel->executeParallelTask(1, host_list, flops_amount, nullptr, -1);
}
Action *CpuL07::sleep(double duration)
lmm_element_t elem = nullptr;
lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), speed_.peak * speed_.scale);
- while ((var = lmm_get_var_from_cnst
- (getModel()->getMaxminSystem(), getConstraint(), &elem))) {
+ while ((var = lmm_get_var_from_cnst (getModel()->getMaxminSystem(), getConstraint(), &elem))) {
Action *action = static_cast<Action*>(lmm_variable_id(var));
- lmm_update_variable_bound(getModel()->getMaxminSystem(),
- action->getVariable(),
- speed_.scale * speed_.peak);
+ lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), speed_.scale * speed_.peak);
}
Cpu::onSpeedChange();
if (m_rate < 0)
lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), lat_bound);
else
- lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(),
- std::min(m_rate, lat_bound));
+ lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), std::min(m_rate, lat_bound));
}
}