{
if (array)
return array[pos];
- else
- return -1.0;
+ return -1.0;
}
kernel::resource::Action* HostModel::execute_parallel(const std::vector<s4u::Host*>& host_list,
for (auto const& arg : actors_at_boot_) {
XBT_DEBUG("Booting Actor %s(%s) right now", arg->name.c_str(), arg->host->get_cname());
simgrid::kernel::actor::ActorImplPtr actor = simgrid::kernel::actor::ActorImpl::create(
- arg->name.c_str(), arg->code, nullptr, arg->host, arg->properties.get(), nullptr);
+ arg->name, arg->code, nullptr, arg->host, arg->properties.get(), nullptr);
if (arg->on_exit)
*actor->on_exit = *arg->on_exit;
if (arg->kill_time >= 0)
return storages;
}
-}
-}
+} // namespace surf
+} // namespace simgrid
get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(),
get_core_count() * speed_.scale * speed_.peak);
while ((var = get_constraint()->get_variable(&elem))) {
- CpuCas01Action* action = static_cast<CpuCas01Action*>(var->get_id());
+ auto* action = static_cast<CpuCas01Action*>(var->get_id());
get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
action->requested_core() * speed_.scale * speed_.peak);
get_host()->turn_off();
while ((var = cnst->get_variable(&elem))) {
- Action* action = static_cast<Action*>(var->get_id());
+ auto* action = static_cast<Action*>(var->get_id());
if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED ||
action->get_state() == Action::State::IGNORED) {
duration = std::max(duration, sg_surf_precision);
XBT_IN("(%s,%g)", get_cname(), duration);
- CpuCas01Action* action =
- new CpuCas01Action(get_model(), 1.0, not is_on(), speed_.scale * speed_.peak, get_constraint());
+ auto* action = new CpuCas01Action(get_model(), 1.0, not is_on(), speed_.scale * speed_.peak, get_constraint());
// FIXME: sleep variables should not consume 1.0 in System::expand()
action->set_max_duration(duration);
{
while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) {
- CpuAction* action = static_cast<CpuAction*>(get_action_heap().pop());
+ auto* action = static_cast<CpuAction*>(get_action_heap().pop());
XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
action->finish(kernel::resource::Action::State::FINISHED);
void CpuModel::update_actions_state_full(double /*now*/, double delta)
{
for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
- CpuAction& action = static_cast<CpuAction&>(*it);
+ auto& action = static_cast<CpuAction&>(*it);
++it; // increment iterator here since the following calls to action.finish() may invalidate it
action.update_remains(action.get_variable()->get_value() * delta);
void CpuTiModel::update_actions_state(double now, double /*delta*/)
{
while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) {
- CpuTiAction* action = static_cast<CpuTiAction*>(get_action_heap().pop());
+ auto* action = static_cast<CpuTiAction*>(get_action_heap().pop());
XBT_DEBUG("Action %p: finish", action);
action->finish(kernel::resource::Action::State::FINISHED);
/* update remaining amount of all actions */
if (profile && profile->event_list.size() > 1) {
kernel::profile::DatedValue val = profile->event_list.back();
if (val.date_ < 1e-12) {
- simgrid::kernel::profile::Profile* prof = new simgrid::kernel::profile::Profile();
- speed_.event = prof->schedule(&profile::future_evt_set, this);
+ auto* prof = new simgrid::kernel::profile::Profile();
+ speed_.event = prof->schedule(&profile::future_evt_set, this);
}
}
}
kernel::resource::CpuAction* CpuTi::execution_start(double size)
{
XBT_IN("(%s,%g)", get_cname(), size);
- CpuTiAction* action = new CpuTiAction(this, size);
+ auto* action = new CpuTiAction(this, size);
action_set_.push_back(*action); // Actually start the action
duration = std::max(duration, sg_surf_precision);
XBT_IN("(%s,%g)", get_cname(), duration);
- CpuTiAction* action = new CpuTiAction(this, 1.0);
+ auto* action = new CpuTiAction(this, 1.0);
action->set_max_duration(duration);
action->set_suspend_state(kernel::resource::Action::SuspendStates::SLEEPING);