-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
while (not actionHeapIsEmpty() && actionHeapTopDate() <= now) {
CpuTiAction* action = static_cast<CpuTiAction*>(actionHeapPop());
XBT_DEBUG("Action %p: finish", action);
- action->finish(Action::State::done);
+ action->finish(kernel::resource::Action::State::done);
/* set the remains to 0 due to precision problems when updating the remaining amount */
action->setRemains(0);
/* update remaining amount of all actions */
/* put all action running on cpu to failed */
for (CpuTiAction& action : actionSet_) {
- if (action.getState() == Action::State::running || action.getState() == Action::State::ready ||
- action.getState() == Action::State::not_in_the_system) {
+ if (action.getState() == kernel::resource::Action::State::running ||
+ action.getState() == kernel::resource::Action::State::ready ||
+ action.getState() == kernel::resource::Action::State::not_in_the_system) {
action.setFinishTime(date);
- action.setState(Action::State::failed);
+ action.setState(kernel::resource::Action::State::failed);
action.heapRemove(model()->getActionHeap());
}
}
continue;
/* action suspended, skip it */
- if (action.suspended_ != Action::SuspendStates::not_suspended)
+ if (action.suspended_ != kernel::resource::Action::SuspendStates::not_suspended)
continue;
sum_priority += 1.0 / action.getPriority();
continue;
/* verify if the action is really running on cpu */
- if (action.suspended_ == Action::SuspendStates::not_suspended && action.getPriority() > 0) {
+ if (action.suspended_ == kernel::resource::Action::SuspendStates::not_suspended && action.getPriority() > 0) {
/* total area needed to finish the action. Used in trace integration */
total_area = (action.getRemains()) * sum_priority * action.getPriority();
}
/* add in action heap */
if (min_finish > NO_MAX_DURATION)
- action.heapUpdate(model()->getActionHeap(), min_finish, NOTSET);
+ action.heapUpdate(model()->getActionHeap(), min_finish, kernel::resource::Action::Type::NOTSET);
else
action.heapRemove(model()->getActionHeap());
continue;
/* action suspended, skip it */
- if (action.suspended_ != Action::SuspendStates::not_suspended)
+ if (action.suspended_ != kernel::resource::Action::SuspendStates::not_suspended)
continue;
/* action don't need update */
CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), 1.0, isOff(), this);
action->setMaxDuration(duration);
- action->suspended_ = Action::SuspendStates::sleeping;
+ action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
if (duration == NO_MAX_DURATION) {
/* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
{
refcount_--;
if (not refcount_) {
- if (action_hook.is_linked())
+ if (stateSetHook_.is_linked())
simgrid::xbt::intrusive_erase(*getStateSet(), *this);
/* remove from action_set */
if (action_ti_hook.is_linked())
min_finish = getFinishTime();
/* add in action heap */
- heapUpdate(getModel()->getActionHeap(), min_finish, NOTSET);
+ heapUpdate(getModel()->getActionHeap(), min_finish, Action::Type::NOTSET);
XBT_OUT();
}