X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2589a5617fe05b8b2aaf2bc9bb998e6ad4271518..cc63d7b267be4c20633a0be7db63b3d88030bee6:/src/surf/surf_interface.cpp diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 93506d614b..a4d47c207b 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -520,7 +520,7 @@ double Model::shareResourcesLazy(double now) { ActionPtr action = NULL; double min = -1; - double share, time_to_completion; + double share; XBT_DEBUG ("Before share resources, the size of modified actions set is %zd", @@ -547,10 +547,10 @@ double Model::shareResourcesLazy(double now) action->updateRemainingLazy(now); min = -1; - time_to_completion = -1; share = lmm_variable_getvalue(action->getVariable()); if (share > 0) { + double time_to_completion; if (action->getRemains() > 0) { time_to_completion = action->getRemainsNoUpdate() / share; } else { @@ -759,26 +759,29 @@ const char *surf_action_state_names[6] = { "SURF_ACTION_NOT_IN_THE_SYSTEM" }; -Action::Action() -: m_refcount(1) -{} +void Action::initialize(ModelPtr model, double cost, bool failed, + lmm_variable_t var) +{ + m_priority = 1.0; + m_refcount = 1; + m_remains = cost; + m_maxDuration = NO_MAX_DURATION; + m_finish = -1.0; + m_failed = failed; + m_start = surf_get_clock(); + m_cost = cost; + p_model = model; + p_data = NULL; + p_variable = var; + m_lastValue = 0; + m_lastUpdate = 0; + m_suspended = false; + m_hat = NOTSET; +} Action::Action(ModelPtr model, double cost, bool failed) - : m_priority(1.0) - , m_refcount(1) - , m_remains(cost) - , m_maxDuration(NO_MAX_DURATION) - , m_finish(-1.0) - , m_failed(failed) - , m_start(surf_get_clock()) - , m_cost(cost) - , p_model(model) - , p_data(NULL) - , p_variable(NULL) - , m_lastValue(0) - , m_lastUpdate(0) - , m_suspended(false) { + initialize(model, cost, failed); #ifdef HAVE_TRACING p_category = NULL; #endif @@ -793,21 +796,8 @@ Action::Action(ModelPtr model, double cost, bool failed) } Action::Action(ModelPtr model, double cost, bool failed, lmm_variable_t var) - : m_priority(1.0) - , m_refcount(1) - , m_remains(cost) - , m_maxDuration(NO_MAX_DURATION) - , m_finish(-1.0) - , m_failed(failed) - , m_start(surf_get_clock()) - , m_cost(cost) - , p_model(model) - , p_data(NULL) - , p_variable(var) - , m_lastValue(0) - , m_lastUpdate(0) - , m_suspended(false) { + initialize(model, cost, failed, var); #ifdef HAVE_TRACING p_category = NULL; #endif