From: Frederic Suter Date: Sun, 26 Mar 2017 14:36:17 +0000 (+0200) Subject: sunday bug chase X-Git-Tag: v3.16~444 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/94e9dc93cadf4130878831fc74e5f17d035a3600 sunday bug chase --- diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index ac0cf234b8..68203b5687 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -96,7 +96,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) { } else { action->latency_ = 0.0; } - if ((action->latency_ == 0.0) && (action->isSuspended() == 0)) { + if ((action->latency_ <= 0.0) && (action->isSuspended() == 0)) { action->updateBound(); lmm_update_variable_weight(maxminSystem_, action->getVariable(), 1.0); } @@ -105,7 +105,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) { action, action->getRemains(), lmm_variable_getvalue(action->getVariable()) * delta); action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta); - if (action->getMaxDuration() != NO_MAX_DURATION) + if (action->getMaxDuration() > NO_MAX_DURATION) action->updateMaxDuration(delta); XBT_DEBUG("Action (%p) : remains (%g).", action, action->getRemains()); @@ -117,7 +117,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) { */ if (((action->getRemains() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) || - ((action->getMaxDuration() != NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) { + ((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) { action->finish(); action->setState(Action::State::done); } else { @@ -407,7 +407,7 @@ void L07Action::updateBound() } double lat_bound = sg_tcp_gamma / (2.0 * lat_current); XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound); - if ((latency_ == 0.0) && (suspended_ == 0)) { + if ((latency_ <= 0.0) && (suspended_ == 0)) { if (rate_ < 0) lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), lat_bound); else diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 9010a9490e..0417b98c3e 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -455,7 +455,7 @@ double Model::nextOccuringEventLazy(double now) while(!modifiedSet_->empty()) { Action *action = &(modifiedSet_->front()); modifiedSet_->pop_front(); - int max_dur_flag = 0; + bool max_dur_flag = false; if (action->getStateSet() != runningActionSet_) continue; @@ -479,11 +479,11 @@ double Model::nextOccuringEventLazy(double now) min = now + time_to_completion; // when the task will complete if nothing changes } - if ((action->getMaxDuration() != NO_MAX_DURATION) && + if ((action->getMaxDuration() > NO_MAX_DURATION) && (min == -1 || action->getStartTime() + action->getMaxDuration() < min)) { // when the task will complete anyway because of the deadline if any min = action->getStartTime() + action->getMaxDuration(); - max_dur_flag = 1; + max_dur_flag = true; } @@ -495,9 +495,9 @@ double Model::nextOccuringEventLazy(double now) if (min != -1) { action->heapUpdate(actionHeap_, min, max_dur_flag ? MAX_DURATION : NORMAL); - XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min, - now); - } else DIE_IMPOSSIBLE; + XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min, now); + } else + DIE_IMPOSSIBLE; } //hereafter must have already the min value for this resource model @@ -705,7 +705,7 @@ void Action::setBound(double bound) if (variable_) lmm_update_variable_bound(getModel()->getMaxminSystem(), variable_, bound); - if (getModel()->getUpdateMechanism() == UM_LAZY && getLastUpdate()!=surf_get_clock()) + if (getModel()->getUpdateMechanism() == UM_LAZY && getLastUpdate() != surf_get_clock()) heapRemove(getModel()->getActionHeap()); XBT_OUT(); } @@ -718,7 +718,7 @@ double Action::getStartTime() double Action::getFinishTime() { /* keep the function behavior, some models (cpu_ti) change the finish time before the action end */ - return remains_ == 0 ? finishTime_ : -1; + return remains_ <= 0 ? finishTime_ : -1; } void Action::setData(void* data)