Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Anonymize unused parameters.
[simgrid.git] / src / surf / network_cm02.cpp
index a85a3d5..2f78a0d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -172,7 +172,7 @@ void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
   }
 }
 
-void NetworkCm02Model::update_actions_state_full(double now, double delta)
+void NetworkCm02Model::update_actions_state_full(double /*now*/, double delta)
 {
   for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
     NetworkCm02Action& action = static_cast<NetworkCm02Action&>(*it);
@@ -199,11 +199,11 @@ void NetworkCm02Model::update_actions_state_full(double now, double delta)
     }
     action.update_remains(action.get_variable()->get_value() * delta);
 
-    if (action.get_max_duration() > NO_MAX_DURATION)
+    if (action.get_max_duration() != NO_MAX_DURATION)
       action.update_max_duration(delta);
 
     if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) ||
-        ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
+        ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
       action.finish(Action::State::FINISHED);
     }
   }
@@ -218,16 +218,17 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   XBT_IN("(%s,%s,%g,%g)", src->get_cname(), dst->get_cname(), size, rate);
 
   src->route_to(dst, route, &latency);
-  xbt_assert(not route.empty() || latency,
+  xbt_assert(not route.empty() || latency > 0,
              "You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
              src->get_cname(), dst->get_cname());
 
-  bool failed = std::any_of(route.begin(), route.end(), [](LinkImpl* link) { return link->is_off(); });
+  bool failed = std::any_of(route.begin(), route.end(), [](const LinkImpl* link) { return not link->is_on(); });
 
   if (cfg_crosstraffic) {
     dst->route_to(src, back_route, nullptr);
     if (not failed)
-      failed = std::any_of(back_route.begin(), back_route.end(), [](LinkImpl* const& link) { return link->is_off(); });
+      failed =
+          std::any_of(back_route.begin(), back_route.end(), [](const LinkImpl* link) { return not link->is_on(); });
   }
 
   NetworkCm02Action *action = new NetworkCm02Action(this, size, failed);
@@ -254,7 +255,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   action->latency_ *= get_latency_factor(size);
   action->rate_ = get_bandwidth_constraint(action->rate_, bandwidth_bound, size);
 
-  int constraints_per_variable = route.size();
+  size_t constraints_per_variable = route.size();
   constraints_per_variable += back_route.size();
 
   if (action->latency_ > 0) {
@@ -318,7 +319,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& nam
   simgrid::s4u::Link::on_creation(this->piface_);
 }
 
-void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
+void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value)
 {
   /* Find out which of my iterators was triggered, and react accordingly */
   if (triggered == bandwidth_.event) {
@@ -423,7 +424,6 @@ void NetworkCm02Action::update_remains_lazy(double now)
     return;
 
   double delta        = now - get_last_update();
-  double max_duration = get_max_duration();
 
   if (get_remains_no_update() > 0) {
     XBT_DEBUG("Updating action(%p): remains was %f, last_update was: %f", this, get_remains_no_update(),
@@ -433,13 +433,10 @@ void NetworkCm02Action::update_remains_lazy(double now)
     XBT_DEBUG("Updating action(%p): remains is now %f", this, get_remains_no_update());
   }
 
-  if (max_duration > NO_MAX_DURATION) {
-    double_update(&max_duration, delta, sg_surf_precision);
-    set_max_duration(max_duration);
-  }
+  update_max_duration(delta);
 
   if ((get_remains_no_update() <= 0 && (get_variable()->get_weight() > 0)) ||
-      ((max_duration > NO_MAX_DURATION) && (max_duration <= 0))) {
+      ((get_max_duration() != NO_MAX_DURATION) && (get_max_duration() <= 0))) {
     finish(Action::State::FINISHED);
     get_model()->get_action_heap().remove(this);
   }