From: Paul Bédaride Date: Wed, 5 Feb 2014 09:29:38 +0000 (+0100) Subject: Clean bound in surf X-Git-Tag: v3_11_beta~53 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7777e8942b95f4adfd35f43b302db2d7e8e9799e Clean bound in surf --- diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index c77302ede3..e735c61f7e 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -240,17 +240,6 @@ void CpuAction::updateRemainingLazy(double now) m_lastValue = lmm_variable_getvalue(getVariable()); } -void CpuAction::setBound(double bound) -{ - XBT_IN("(%p,%g)", this, bound); - m_bound = bound; - lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), bound); - - if (getModel()->getUpdateMechanism() == UM_LAZY) - heapRemove(getModel()->getActionHeap()); - XBT_OUT(); -} - /* * * This function formulates a constraint problem that pins a given task to diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 101359fa84..c72e0f5a40 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -216,7 +216,7 @@ public: /** * @brief CpuAction constructor */ - CpuAction(): m_bound(0) {}; + CpuAction() {}; /** * @brief CpuAction constructor @@ -226,7 +226,7 @@ public: * @param failed [TODO] */ CpuAction(ModelPtr model, double cost, bool failed) - : Action(model, cost, failed), m_bound(0) {} //FIXME:REMOVE + : Action(model, cost, failed) {} //FIXME:REMOVE /** * @brief CpuAction constructor @@ -237,7 +237,7 @@ public: * @param var The lmm variable associated to this CpuAction if it is part of a LMM component */ CpuAction(ModelPtr model, double cost, bool failed, lmm_variable_t var) - : Action(model, cost, failed, var), m_bound(0) {} + : Action(model, cost, failed, var) {} /** * @brief Set the affinity of the current CpuAction @@ -248,25 +248,10 @@ public: */ virtual void setAffinity(CpuPtr cpu, unsigned long mask); - /** - * @brief Set the bound of current CpuAction - * @details [TODO] - * - * @param bound [TODO] - */ - virtual void setBound(double bound); - - /** - * @brief Get the bound of the current CpuAction - * - * @return The bound of the current CpuAction - */ - double getBound() { return m_bound; } - void setState(e_surf_action_state_t state); void updateRemainingLazy(double now); - double m_bound; /*< the capping of the CPU use */ + }; #endif /* SURF_CPU_INTERFACE_HPP_ */ diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 0d9daa6f81..4e1ac71e1b 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -176,7 +176,6 @@ public: void setPriority(double priority); double getRemains(); void setAffinity(CpuPtr /*cpu*/, unsigned long /*mask*/) {}; - void setBound(double /*bound*/) {}; CpuTiPtr p_cpu; int m_indexHeap; diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index 1c584ec534..bfdc22c83c 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -252,7 +252,7 @@ double lmm_variable_getvalue(lmm_variable_t var) return (var->value); } -XBT_INLINE double lmm_variable_getbound(lmm_variable_t var) +double lmm_variable_getbound(lmm_variable_t var) { return (var->bound); } diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 26542547f9..43789734df 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -850,6 +850,22 @@ void Action::setState(e_surf_action_state_t state) XBT_OUT(); } +double Action::getBound() +{ + return (p_variable) ? lmm_variable_getbound(p_variable) : 0; +} + +void Action::setBound(double bound) +{ + XBT_IN("(%p,%g)", this, bound); + if (p_variable) + lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), bound); + + if (getModel()->getUpdateMechanism() == UM_LAZY) + heapRemove(getModel()->getActionHeap()); + XBT_OUT(); +} + double Action::getStartTime() { return m_start; diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 27774f36b9..2b75d00bd8 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -441,6 +441,20 @@ public: */ virtual void setState(e_surf_action_state_t state); + /** + * @brief Get the bound of the current Action + * + * @return The bound of the current Action + */ + double getBound(); + + /** + * @brief Set the bound of the current Action + * + * @param bound The new bound of the current Action + */ + void setBound(double bound); + /** * @brief Get the start time of the current action *