X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/45d7d1ab9ae1e9a941dd34440467f25e6d337970..a15797ea55151ddfdbae48147e74159efe01b411:/src/surf/cpu_interface.cpp diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 6bb195a11b..ee3fc09929 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -24,18 +24,7 @@ namespace surf { * Callbacks * *************/ -std::list getActionCpus(CpuAction *action) { - std::list retlist; - lmm_system_t sys = action->getModel()->getMaxminSystem(); - int llen = lmm_get_number_of_cnst_from_var(sys, action->getVariable()); - - for(int i = 0; igetVariable(), i) )) ); - } - return retlist; -} - -simgrid::xbt::signal cpuActionStateChangedCallbacks; +simgrid::xbt::signal cpuActionStateChangedCallbacks; /********* * Model * @@ -61,7 +50,7 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/) /* set the remains to 0 due to precision problems when updating the remaining amount */ action->setRemains(0); - action->setState(SURF_ACTION_DONE); + action->setState(Action::State::done); action->heapRemove(getActionHeap()); //FIXME: strange call since action was already popped } if (TRACE_is_enabled()) { @@ -117,11 +106,11 @@ void CpuModel::updateActionsStateFull(double now, double delta) if ((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) { action->finish(); - action->setState(SURF_ACTION_DONE); + action->setState(Action::State::done); } else if ((action->getMaxDuration() != NO_MAX_DURATION) && (action->getMaxDuration() <= 0)) { action->finish(); - action->setState(SURF_ACTION_DONE); + action->setState(Action::State::done); } } } @@ -260,21 +249,21 @@ void CpuAction::updateRemainingLazy(double now) xbt_assert(getStateSet() == getModel()->getRunningActionSet(), "You're updating an action that is not running."); xbt_assert(getPriority() > 0, "You're updating an action that seems suspended."); - double delta = now - m_lastUpdate; + double delta = now - lastUpdate_; - if (m_remains > 0) { - XBT_CDEBUG(surf_kernel, "Updating action(%p): remains was %f, last_update was: %f", this, m_remains, m_lastUpdate); - double_update(&(m_remains), m_lastValue * delta, sg_maxmin_precision*sg_surf_precision); + if (remains_ > 0) { + XBT_CDEBUG(surf_kernel, "Updating action(%p): remains was %f, last_update was: %f", this, remains_, lastUpdate_); + double_update(&(remains_), lastValue_ * delta, sg_maxmin_precision*sg_surf_precision); if (TRACE_is_enabled()) { Cpu *cpu = static_cast(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0))); - TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), m_lastValue, m_lastUpdate, now - m_lastUpdate); + TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), lastValue_, lastUpdate_, now - lastUpdate_); } - XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, m_remains); + XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, remains_); } - m_lastUpdate = now; - m_lastValue = lmm_variable_getvalue(getVariable()); + lastUpdate_ = now; + lastValue_ = lmm_variable_getvalue(getVariable()); } /* @@ -341,13 +330,23 @@ void CpuAction::setAffinity(Cpu *cpu, unsigned long mask) XBT_OUT(); } -simgrid::xbt::signal CpuAction::onStateChange; +simgrid::xbt::signal CpuAction::onStateChange; -void CpuAction::setState(e_surf_action_state_t state){ - e_surf_action_state_t previous = getState(); +void CpuAction::setState(Action::State state){ + Action::State previous = getState(); Action::setState(state); onStateChange(this, previous); } +std::list CpuAction::cpus() { + std::list retlist; + lmm_system_t sys = getModel()->getMaxminSystem(); + int llen = lmm_get_number_of_cnst_from_var(sys, getVariable()); + + for(int i = 0; i