Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove useless boost #includes
[simgrid.git] / src / surf / network_cm02.cpp
index 1ea74f3..4c1cf08 100644 (file)
@@ -40,13 +40,12 @@ void surf_network_model_init_LegrandVelho(void)
   if (surf_network_model)
     return;
 
-  simgrid::surf::on_link.connect(netlink_parse_init);
   surf_network_model = new simgrid::surf::NetworkCm02Model();
   xbt_dynar_push(all_existing_models, &surf_network_model);
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",      13.01);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",     0.97);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",         20537);
+  xbt_cfg_setdefault_double("network/latency-factor",      13.01);
+  xbt_cfg_setdefault_double("network/bandwidth-factor",     0.97);
+  xbt_cfg_setdefault_double("network/weight-S",         20537);
 }
 
 /***************************************************************************/
@@ -66,13 +65,12 @@ void surf_network_model_init_CM02(void)
   if (surf_network_model)
     return;
 
-  simgrid::surf::on_link.connect(netlink_parse_init);
   surf_network_model = new simgrid::surf::NetworkCm02Model();
   xbt_dynar_push(all_existing_models, &surf_network_model);
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",   1.0);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 1.0);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",         0.0);
+  xbt_cfg_setdefault_double("network/latency-factor",   1.0);
+  xbt_cfg_setdefault_double("network/bandwidth-factor", 1.0);
+  xbt_cfg_setdefault_double("network/weight-S",         0.0);
 }
 
 /***************************************************************************/
@@ -90,16 +88,15 @@ void surf_network_model_init_Reno(void)
   if (surf_network_model)
     return;
 
-  simgrid::surf::on_link.connect(netlink_parse_init);
   surf_network_model = new simgrid::surf::NetworkCm02Model();
   xbt_dynar_push(all_existing_models, &surf_network_model);
 
   lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi);
   surf_network_model->f_networkSolve = lagrange_solve;
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",     10.4);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",    0.92);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",         8775);
+  xbt_cfg_setdefault_double("network/latency-factor",     10.4);
+  xbt_cfg_setdefault_double("network/bandwidth-factor",    0.92);
+  xbt_cfg_setdefault_double("network/weight-S",         8775);
 }
 
 
@@ -108,16 +105,15 @@ void surf_network_model_init_Reno2(void)
   if (surf_network_model)
     return;
 
-  simgrid::surf::on_link.connect(netlink_parse_init);
   surf_network_model = new simgrid::surf::NetworkCm02Model();
   xbt_dynar_push(all_existing_models, &surf_network_model);
 
   lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp, func_reno2_fpi);
   surf_network_model->f_networkSolve = lagrange_solve;
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",    10.4);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",   0.92);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",        8775);
+  xbt_cfg_setdefault_double("network/latency-factor",    10.4);
+  xbt_cfg_setdefault_double("network/bandwidth-factor",   0.92);
+  xbt_cfg_setdefault_double("network/weight-S",        8775);
 }
 
 void surf_network_model_init_Vegas(void)
@@ -125,16 +121,15 @@ void surf_network_model_init_Vegas(void)
   if (surf_network_model)
     return;
 
-  simgrid::surf::on_link.connect(netlink_parse_init);
   surf_network_model = new simgrid::surf::NetworkCm02Model();
   xbt_dynar_push(all_existing_models, &surf_network_model);
 
   lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi);
   surf_network_model->f_networkSolve = lagrange_solve;
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",    10.4);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",   0.92);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",        8775);
+  xbt_cfg_setdefault_double("network/latency-factor",    10.4);
+  xbt_cfg_setdefault_double("network/bandwidth-factor",   0.92);
+  xbt_cfg_setdefault_double("network/weight-S",        8775);
 }
 
 namespace simgrid {
@@ -143,60 +138,57 @@ namespace surf {
 NetworkCm02Model::NetworkCm02Model()
   :NetworkModel()
 {
-  char *optim = xbt_cfg_get_string(_sg_cfg_set, "network/optim");
-  int select = xbt_cfg_get_boolean(_sg_cfg_set, "network/maxmin_selective_update");
+  char *optim = xbt_cfg_get_string("network/optim");
+  int select = xbt_cfg_get_boolean("network/maxmin-selective-update");
 
   if (!strcmp(optim, "Full")) {
-    p_updateMechanism = UM_FULL;
-    m_selectiveUpdate = select;
+    updateMechanism_ = UM_FULL;
+    selectiveUpdate_ = select;
   } else if (!strcmp(optim, "Lazy")) {
-    p_updateMechanism = UM_LAZY;
-    m_selectiveUpdate = 1;
-    xbt_assert((select == 1) || (xbt_cfg_is_default_value(_sg_cfg_set, "network/maxmin_selective_update")),
+    updateMechanism_ = UM_LAZY;
+    selectiveUpdate_ = 1;
+    xbt_assert((select == 1) || (xbt_cfg_is_default_value("network/maxmin-selective-update")),
                "Disabling selective update while using the lazy update mechanism is dumb!");
   } else {
     xbt_die("Unsupported optimization (%s) for this model", optim);
   }
 
-  if (!p_maxminSystem)
-    p_maxminSystem = lmm_system_new(m_selectiveUpdate);
+  if (!maxminSystem_)
+    maxminSystem_ = lmm_system_new(selectiveUpdate_);
 
   routing_model_create(createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, NULL));
 
-  if (p_updateMechanism == UM_LAZY) {
-  p_actionHeap = xbt_heap_new(8, NULL);
-  xbt_heap_set_update_callback(p_actionHeap, surf_action_lmm_update_index_heap);
-  p_modifiedSet = new ActionLmmList();
-  p_maxminSystem->keep_track = p_modifiedSet;
+  if (updateMechanism_ == UM_LAZY) {
+  actionHeap_ = xbt_heap_new(8, NULL);
+  xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
+  modifiedSet_ = new ActionLmmList();
+  maxminSystem_->keep_track = modifiedSet_;
   }
 }
 
-Link* NetworkCm02Model::createLink(const char *name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy, xbt_dict_t properties)
+Link* NetworkCm02Model::createLink(const char *name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy,
+    xbt_dict_t properties)
 {
-  xbt_assert(NULL == Link::byName(name), "Link '%s' declared several times in the platform", name);
-
-  Link* link = new NetworkCm02Link(this, name, properties, p_maxminSystem, sg_bandwidth_factor * bandwidth, bandwidth, latency, policy);
-  Link::onCreation(link);
-  return link;
+  return new NetworkCm02Link(this, name, properties, bandwidth, latency, policy, maxminSystem_);
 }
 
 void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
 {
   NetworkCm02Action *action;
-  while ((xbt_heap_size(p_actionHeap) > 0)
-         && (double_equals(xbt_heap_maxkey(p_actionHeap), now, sg_surf_precision))) {
-    action = static_cast<NetworkCm02Action*> (xbt_heap_pop(p_actionHeap));
+  while ((xbt_heap_size(actionHeap_) > 0)
+         && (double_equals(xbt_heap_maxkey(actionHeap_), now, sg_surf_precision))) {
+    action = static_cast<NetworkCm02Action*> (xbt_heap_pop(actionHeap_));
     XBT_DEBUG("Something happened to action %p", action);
     if (TRACE_is_enabled()) {
-      int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->getVariable());
+      int n = lmm_get_number_of_cnst_from_var(maxminSystem_, action->getVariable());
 
       for (int i = 0; i < n; i++){
-        lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i);
+        lmm_constraint_t constraint = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i);
         NetworkCm02Link *link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
         TRACE_surf_link_set_utilization(link->getName(),
                                         action->getCategory(),
                                         (lmm_variable_getvalue(action->getVariable())*
-                                            lmm_get_cnst_weight_from_var(p_maxminSystem,
+                                            lmm_get_cnst_weight_from_var(maxminSystem_,
                                                 action->getVariable(),
                                                 i)),
                                         action->getLastUpdate(),
@@ -207,8 +199,8 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
     // if I am wearing a latency hat
     if (action->getHat() == LATENCY) {
       XBT_DEBUG("Latency paid for action %p. Activating", action);
-      lmm_update_variable_weight(p_maxminSystem, action->getVariable(), action->m_weight);
-      action->heapRemove(p_actionHeap);
+      lmm_update_variable_weight(maxminSystem_, action->getVariable(), action->weight_);
+      action->heapRemove(actionHeap_);
       action->refreshLastUpdate();
 
         // if I am wearing a max_duration or normal hat
@@ -219,8 +211,8 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
       XBT_DEBUG("Action %p finished", action);
       action->setRemains(0);
       action->finish();
-      action->setState(SURF_ACTION_DONE);
-      action->heapRemove(p_actionHeap);
+      action->setState(Action::State::done);
+      action->heapRemove(actionHeap_);
 
       action->gapRemove();
     }
@@ -241,35 +233,35 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
     action = static_cast<NetworkCm02Action*> (&*it);
     XBT_DEBUG("Something happened to action %p", action);
       double deltap = delta;
-      if (action->m_latency > 0) {
-        if (action->m_latency > deltap) {
-          double_update(&(action->m_latency), deltap, sg_surf_precision);
+      if (action->latency_ > 0) {
+        if (action->latency_ > deltap) {
+          double_update(&(action->latency_), deltap, sg_surf_precision);
           deltap = 0.0;
         } else {
-          double_update(&(deltap), action->m_latency, sg_surf_precision);
-          action->m_latency = 0.0;
+          double_update(&(deltap), action->latency_, sg_surf_precision);
+          action->latency_ = 0.0;
         }
-        if (action->m_latency == 0.0 && !(action->isSuspended()))
-          lmm_update_variable_weight(p_maxminSystem, action->getVariable(),
-              action->m_weight);
+        if (action->latency_ == 0.0 && !(action->isSuspended()))
+          lmm_update_variable_weight(maxminSystem_, action->getVariable(),
+              action->weight_);
       }
       if (TRACE_is_enabled()) {
-        int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->getVariable());
+        int n = lmm_get_number_of_cnst_from_var(maxminSystem_, action->getVariable());
         for (int i = 0; i < n; i++){
-          lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i);
+          lmm_constraint_t constraint = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i);
 
           NetworkCm02Link* link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
           TRACE_surf_link_set_utilization(link->getName(),
                                         action->getCategory(),
                                         (lmm_variable_getvalue(action->getVariable())*
-                                            lmm_get_cnst_weight_from_var(p_maxminSystem,
+                                            lmm_get_cnst_weight_from_var(maxminSystem_,
                                                 action->getVariable(),
                                                 i)),
                                         action->getLastUpdate(),
                                         now - action->getLastUpdate());
         }
       }
-      if (!lmm_get_number_of_cnst_from_var (p_maxminSystem, action->getVariable())) {
+      if (!lmm_get_number_of_cnst_from_var (maxminSystem_, action->getVariable())) {
         /* There is actually no link used, hence an infinite bandwidth.
          * This happens often when using models like vivaldi.
          * In such case, just make sure that the action completes immediately.
@@ -284,12 +276,12 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
     if ((action->getRemains() <= 0) &&
         (lmm_get_variable_weight(action->getVariable()) > 0)) {
       action->finish();
-      action->setState(SURF_ACTION_DONE);
+      action->setState(Action::State::done);
       action->gapRemove();
     } else if (((action->getMaxDuration() != NO_MAX_DURATION)
         && (action->getMaxDuration() <= 0))) {
       action->finish();
-      action->setState(SURF_ACTION_DONE);
+      action->setState(Action::State::done);
       action->gapRemove();
     }
   }
@@ -325,62 +317,62 @@ Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, double size, d
   }
 
   NetworkCm02Action *action = new NetworkCm02Action(this, size, failed);
-  action->m_weight = action->m_latency = latency;
+  action->weight_ = action->latency_ = latency;
 
-  action->m_rate = rate;
-  if (p_updateMechanism == UM_LAZY) {
-    action->m_indexHeap = -1;
-    action->m_lastUpdate = surf_get_clock();
+  action->rate_ = rate;
+  if (updateMechanism_ == UM_LAZY) {
+    action->indexHeap_ = -1;
+    action->lastUpdate_ = surf_get_clock();
   }
 
   bandwidth_bound = -1.0;
   if (sg_weight_S_parameter > 0)
     for (auto link : *route)
-      action->m_weight += sg_weight_S_parameter / link->getBandwidth();
+      action->weight_ += sg_weight_S_parameter / link->getBandwidth();
 
   for (auto link : *route) {
     double bb = bandwidthFactor(size) * link->getBandwidth();
     bandwidth_bound = (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb);
   }
 
-  action->m_latCurrent = action->m_latency;
-  action->m_latency *= latencyFactor(size);
-  action->m_rate = bandwidthConstraint(action->m_rate, bandwidth_bound, size);
-  if (m_haveGap) {
+  action->latCurrent_ = action->latency_;
+  action->latency_ *= latencyFactor(size);
+  action->rate_ = bandwidthConstraint(action->rate_, bandwidth_bound, size);
+  if (haveGap_) {
     xbt_assert(! route->empty(),
                "Using a model with a gap (e.g., SMPI) with a platform without links (e.g. vivaldi)!!!");
 
     gapAppend(size, route->at(0), action);
-    XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->name(), dst->name(), action->m_senderGap, action->m_latency);
+    XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", action, src->name(), dst->name(), action->senderGap_, action->latency_);
   }
 
   constraints_per_variable = route->size();
   if (back_route != NULL)
     constraints_per_variable += back_route->size();
 
-  if (action->m_latency > 0) {
-    action->p_variable = lmm_variable_new(p_maxminSystem, action, 0.0, -1.0, constraints_per_variable);
-    if (p_updateMechanism == UM_LAZY) {
+  if (action->latency_ > 0) {
+    action->variable_ = lmm_variable_new(maxminSystem_, action, 0.0, -1.0, constraints_per_variable);
+    if (updateMechanism_ == UM_LAZY) {
       // add to the heap the event when the latency is payed
-      XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->m_latency + action->m_lastUpdate);
-      action->heapInsert(p_actionHeap, action->m_latency + action->m_lastUpdate, route->empty() ? NORMAL : LATENCY);
+      XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->lastUpdate_);
+      action->heapInsert(actionHeap_, action->latency_ + action->lastUpdate_, route->empty() ? NORMAL : LATENCY);
     }
   } else
-    action->p_variable = lmm_variable_new(p_maxminSystem, action, 1.0, -1.0, constraints_per_variable);
+    action->variable_ = lmm_variable_new(maxminSystem_, action, 1.0, -1.0, constraints_per_variable);
 
-  if (action->m_rate < 0) {
-    lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? sg_tcp_gamma / (2.0 * action->m_latCurrent) : -1.0);
+  if (action->rate_ < 0) {
+    lmm_update_variable_bound(maxminSystem_, action->getVariable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
   } else {
-    lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? std::min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)) : action->m_rate);
+    lmm_update_variable_bound(maxminSystem_, action->getVariable(), (action->latCurrent_ > 0) ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)) : action->rate_);
   }
 
   for (auto link: *route)
-    lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), 1.0);
+    lmm_expand(maxminSystem_, link->getConstraint(), action->getVariable(), 1.0);
 
   if (sg_network_crosstraffic == 1) {
     XBT_DEBUG("Fullduplex active adding backward flow using 5%%");
     for (auto link : *back_route)
-      lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), .05);
+      lmm_expand(maxminSystem_, link->getConstraint(), action->getVariable(), .05);
      
     //Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
     //(You would also have to change lmm_element_concurrency())
@@ -388,9 +380,10 @@ Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, double size, d
   }
 
   delete route;
+  delete back_route;
   XBT_OUT();
 
-  networkCommunicateCallbacks(action, src, dst, size, rate);
+  Link::onCommunicate(action, src, dst);
   return action;
 }
 
@@ -398,20 +391,20 @@ Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, double size, d
  * Resource *
  ************/
 NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
-    lmm_system_t system,
-    double constraint_value,
-    double bw_peak,  double lat_initial,
-    e_surf_link_sharing_policy_t policy)
-: Link(model, name, props, lmm_constraint_new(system, this, constraint_value))
+    double bandwidth,  double latency, e_surf_link_sharing_policy_t policy,
+    lmm_system_t system)
+: Link(model, name, props, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
 {
   m_bandwidth.scale = 1.0;
-  m_bandwidth.peak = bw_peak;
+  m_bandwidth.peak = bandwidth;
 
   m_latency.scale = 1.0;
-  m_latency.peak = lat_initial;
+  m_latency.peak = latency;
 
   if (policy == SURF_LINK_FATPIPE)
     lmm_constraint_shared(getConstraint());
+
+  Link::onCreation(this);
 }
 
 
@@ -440,10 +433,10 @@ void NetworkCm02Link::apply_event(tmgr_trace_iterator_t triggered, double value)
       while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
         Action *action = static_cast<Action*>( lmm_variable_id(var) );
 
-        if (action->getState() == SURF_ACTION_RUNNING ||
-            action->getState() == SURF_ACTION_READY) {
+        if (action->getState() == Action::State::running ||
+            action->getState() == Action::State::ready) {
           action->setFinishTime(now);
-          action->setState(SURF_ACTION_FAILED);
+          action->setState(Action::State::failed);
         }
       }
     }
@@ -472,9 +465,9 @@ void NetworkCm02Link::updateBandwidth(double value) {
     int numelem = 0;
     while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
       NetworkCm02Action *action = (NetworkCm02Action*) lmm_variable_id(var);
-      action->m_weight += delta;
+      action->weight_ += delta;
       if (!action->isSuspended())
-        lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
+        lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->weight_);
     }
   }
 }
@@ -490,22 +483,22 @@ void NetworkCm02Link::updateLatency(double value){
 
   while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
     NetworkCm02Action *action = (NetworkCm02Action*) lmm_variable_id(var);
-    action->m_latCurrent += delta;
-    action->m_weight += delta;
-    if (action->m_rate < 0)
-      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->m_latCurrent));
+    action->latCurrent_ += delta;
+    action->weight_ += delta;
+    if (action->rate_ < 0)
+      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->latCurrent_));
     else {
       lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(),
-                                std::min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)));
+                                std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)));
 
-      if (action->m_rate < sg_tcp_gamma / (2.0 * action->m_latCurrent)) {
+      if (action->rate_ < sg_tcp_gamma / (2.0 * action->latCurrent_)) {
         XBT_INFO("Flow is limited BYBANDWIDTH");
       } else {
-        XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->m_latCurrent);
+        XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->latCurrent_);
       }
     }
     if (!action->isSuspended())
-      lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
+      lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->weight_);
   }
 }
 
@@ -516,36 +509,36 @@ void NetworkCm02Action::updateRemainingLazy(double now)
 {
   double delta = 0.0;
 
-  if (m_suspended != 0)
+  if (suspended_ != 0)
     return;
 
-  delta = now - m_lastUpdate;
+  delta = now - 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_maxmin_precision*sg_surf_precision);
+  if (remains_ > 0) {
+    XBT_DEBUG("Updating action(%p): remains was %f, last_update was: %f", this, remains_, lastUpdate_);
+    double_update(&(remains_), lastValue_ * delta, sg_maxmin_precision*sg_surf_precision);
 
-    XBT_DEBUG("Updating action(%p): remains is now %f", this, m_remains);
+    XBT_DEBUG("Updating action(%p): remains is now %f", this, remains_);
   }
 
-  if (m_maxDuration != NO_MAX_DURATION)
-    double_update(&m_maxDuration, delta, sg_surf_precision);
+  if (maxDuration_ != NO_MAX_DURATION)
+    double_update(&maxDuration_, delta, sg_surf_precision);
 
-  if (m_remains <= 0 &&
+  if (remains_ <= 0 &&
       (lmm_get_variable_weight(getVariable()) > 0)) {
     finish();
-    setState(SURF_ACTION_DONE);
+    setState(Action::State::done);
 
     heapRemove(getModel()->getActionHeap());
-  } else if (((m_maxDuration != NO_MAX_DURATION)
-      && (m_maxDuration <= 0))) {
+  } else if (((maxDuration_ != NO_MAX_DURATION)
+      && (maxDuration_ <= 0))) {
     finish();
-    setState(SURF_ACTION_DONE);
+    setState(Action::State::done);
     heapRemove(getModel()->getActionHeap());
   }
 
-  m_lastUpdate = now;
-  m_lastValue = lmm_variable_getvalue(getVariable());
+  lastUpdate_ = now;
+  lastValue_ = lmm_variable_getvalue(getVariable());
 }
 
 }