- return m_remains;
-}
-
-double Action::getRemainsNoUpdate()
-{
- return m_remains;
-}
-
-//FIXME split code in the right places
-void Action::updateRemainingLazy(double now)
-{
- double delta = 0.0;
-
- if(getModel() == surf_network_model)
- {
- if (m_suspended != 0)
- return;
- }
- else
- {
- xbt_assert(p_stateSet == getModel()->getRunningActionSet(),
- "You're updating an action that is not running.");
-
- /* bogus priority, skip it */
- xbt_assert(m_priority > 0,
- "You're updating an action that seems suspended.");
- }
-
- delta = now - m_lastUpdate;
-
- if (m_remains > 0) {
- XBT_DEBUG("Updating action(%p): remains was %f, last_update was: %f", this, m_remains, m_lastUpdate);
- double_update(&m_remains, m_lastValue * delta, sg_surf_precision*sg_maxmin_precision);
-
- if (getModel() == surf_cpu_model_pm && TRACE_is_enabled()) {
- simgrid::surf::Resource *cpu = static_cast<simgrid::surf::Resource*>(
- 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);
- }
- XBT_DEBUG("Updating action(%p): remains is now %f", this, m_remains);
- }
-
- if(getModel() == surf_network_model)
- {
- if (m_maxDuration != NO_MAX_DURATION)
- double_update(&m_maxDuration, delta, sg_surf_precision);
-
- //FIXME: duplicated code
- if ((m_remains <= 0) &&
- (lmm_get_variable_weight(getVariable()) > 0)) {
- finish();
- setState(SURF_ACTION_DONE);
- heapRemove(getModel()->getActionHeap());
- } else if (((m_maxDuration != NO_MAX_DURATION)
- && (m_maxDuration <= 0))) {
- finish();
- setState(SURF_ACTION_DONE);
- heapRemove(getModel()->getActionHeap());
- }
- }
-
- m_lastUpdate = now;
- m_lastValue = lmm_variable_getvalue(getVariable());