X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/33880334d29389adfe68b379c9e28afcbd33d5c4..0f5828869a4c6d79018e8eca27a10d0fe51979e5:/src/surf/cpu_ti.cpp diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 3fc88feb06..10d6cb6e5d 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -1,5 +1,4 @@ -/* 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. */ @@ -362,7 +361,7 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/) while (not actionHeapIsEmpty() && actionHeapTopDate() <= now) { CpuTiAction* action = static_cast(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 */ @@ -440,10 +439,11 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value) /* 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()); } } @@ -473,7 +473,7 @@ void CpuTi::updateActionsFinishTime(double now) continue; /* action suspended, skip it */ - if (action.suspended_ != 0) + if (action.suspended_ != kernel::resource::Action::SuspendStates::not_suspended) continue; sum_priority += 1.0 / action.getPriority(); @@ -487,7 +487,7 @@ void CpuTi::updateActionsFinishTime(double now) continue; /* verify if the action is really running on cpu */ - if (action.suspended_ == 0 && 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(); @@ -507,7 +507,7 @@ void CpuTi::updateActionsFinishTime(double now) } /* 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()); @@ -550,7 +550,7 @@ void CpuTi::updateRemainingAmount(double now) continue; /* action suspended, skip it */ - if (action.suspended_ != 0) + if (action.suspended_ != kernel::resource::Action::SuspendStates::not_suspended) continue; /* action don't need update */ @@ -589,11 +589,11 @@ CpuAction *CpuTi::sleep(double duration) CpuTiAction* action = new CpuTiAction(static_cast(model()), 1.0, isOff(), this); action->setMaxDuration(duration); - action->suspended_ = 2; + 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); - action->stateSet_ = &static_cast(model())->runningActionSetThatDoesNotNeedBeingChecked_; + action->state_set_ = &static_cast(model())->runningActionSetThatDoesNotNeedBeingChecked_; action->getStateSet()->push_back(*action); } @@ -636,7 +636,7 @@ int CpuTiAction::unref() { 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()) @@ -660,8 +660,8 @@ void CpuTiAction::cancel() void CpuTiAction::suspend() { XBT_IN("(%p)", this); - if (suspended_ != 2) { - suspended_ = 1; + if (suspended_ != Action::SuspendStates::sleeping) { + suspended_ = Action::SuspendStates::suspended; heapRemove(getModel()->getActionHeap()); cpu_->modified(true); } @@ -671,8 +671,8 @@ void CpuTiAction::suspend() void CpuTiAction::resume() { XBT_IN("(%p)", this); - if (suspended_ != 2) { - suspended_ = 0; + if (suspended_ != Action::SuspendStates::sleeping) { + suspended_ = Action::SuspendStates::not_suspended; cpu_->modified(true); } XBT_OUT(); @@ -693,7 +693,7 @@ void CpuTiAction::setMaxDuration(double duration) min_finish = getFinishTime(); /* add in action heap */ - heapUpdate(getModel()->getActionHeap(), min_finish, NOTSET); + heapUpdate(getModel()->getActionHeap(), min_finish, Action::Type::NOTSET); XBT_OUT(); }