X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/00500f6c49040933bc106ca6f366a5fa0c40970a..a51412052680be35c70a5771242eb5a0a61b1dea:/src/surf/cpu_ti.cpp diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 01496568dc..d899ed0c98 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -468,9 +468,9 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value) || action->getState() == Action::State::not_in_the_system) { action->setFinishTime(date); action->setState(Action::State::failed); - if (action->indexHeap_ >= 0) { + if (action->getIndexHeap() >= 0) { CpuTiAction* heap_act = static_cast( - xbt_heap_remove(static_cast(model())->tiActionHeap_, action->indexHeap_)); + xbt_heap_remove(static_cast(model())->tiActionHeap_, action->getIndexHeap())); if (heap_act != action) DIE_IMPOSSIBLE; } @@ -538,10 +538,10 @@ void CpuTi::updateActionsFinishTime(double now) min_finish = action->getStartTime() + action->getMaxDuration(); } /* add in action heap */ - XBT_DEBUG("action(%p) index %d", action, action->indexHeap_); - if (action->indexHeap_ >= 0) { + XBT_DEBUG("action(%p) index %d", action, action->getIndexHeap()); + if (action->getIndexHeap() >= 0) { CpuTiAction* heap_act = static_cast( - xbt_heap_remove(static_cast(model())->tiActionHeap_, action->indexHeap_)); + xbt_heap_remove(static_cast(model())->tiActionHeap_, action->getIndexHeap())); if (heap_act != action) DIE_IMPOSSIBLE; } @@ -664,15 +664,10 @@ CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed, CpuTi *cp : CpuAction(model_, cost, failed) , cpu_(cpu) { - indexHeap_ = -1; + updateIndexHeap(-1); cpu_->modified(true); } -void CpuTiAction::updateIndexHeap(int i) -{ - indexHeap_ = i; -} - void CpuTiAction::setState(Action::State state) { CpuAction::setState(state); @@ -689,7 +684,7 @@ int CpuTiAction::unref() if (action_ti_hook.is_linked()) cpu_->actionSet_->erase(cpu_->actionSet_->iterator_to(*this)); /* remove from heap */ - xbt_heap_remove(static_cast(getModel())->tiActionHeap_, this->indexHeap_); + xbt_heap_remove(static_cast(getModel())->tiActionHeap_, getIndexHeap()); cpu_->modified(true); delete this; return 1; @@ -700,7 +695,7 @@ int CpuTiAction::unref() void CpuTiAction::cancel() { this->setState(Action::State::failed); - xbt_heap_remove(getModel()->getActionHeap(), this->indexHeap_); + xbt_heap_remove(getModel()->getActionHeap(), getIndexHeap()); cpu_->modified(true); } @@ -709,7 +704,7 @@ void CpuTiAction::suspend() XBT_IN("(%p)", this); if (suspended_ != 2) { suspended_ = 1; - xbt_heap_remove(getModel()->getActionHeap(), indexHeap_); + xbt_heap_remove(getModel()->getActionHeap(), getIndexHeap()); cpu_->modified(true); } XBT_OUT(); @@ -740,8 +735,8 @@ void CpuTiAction::setMaxDuration(double duration) min_finish = getFinishTime(); /* add in action heap */ - if (indexHeap_ >= 0) { - CpuTiAction *heap_act = static_cast(xbt_heap_remove(getModel()->getActionHeap(), indexHeap_)); + if (getIndexHeap() >= 0) { + CpuTiAction* heap_act = static_cast(xbt_heap_remove(getModel()->getActionHeap(), getIndexHeap())); if (heap_act != this) DIE_IMPOSSIBLE; } @@ -753,7 +748,7 @@ void CpuTiAction::setMaxDuration(double duration) void CpuTiAction::setSharingWeight(double priority) { XBT_IN("(%p,%g)", this, priority); - sharingWeight_ = priority; + setSharingWeightNoUpdate(priority); cpu_->modified(true); XBT_OUT(); }