Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cleanup in log categories
[simgrid.git] / src / kernel / lmm / fair_bottleneck.cpp
index 1db0704..951e8db 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2022. 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. */
 #include <cstdlib>
 #include <xbt/utility.hpp>
 
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_maxmin);
-
-simgrid::kernel::lmm::System* simgrid::kernel::lmm::make_new_fair_bottleneck_system(bool selective_update)
-{
-  return new simgrid::kernel::lmm::FairBottleneck(selective_update);
-}
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ker_lmm);
 
 void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
 {
@@ -41,9 +36,8 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
   }
 
   XBT_DEBUG("Active constraints : %zu", active_constraint_set.size());
-  for (Constraint& cnst : active_constraint_set) {
-    saturated_constraint_set.push_back(cnst);
-  }
+  saturated_constraint_set.insert(saturated_constraint_set.end(), active_constraint_set.begin(),
+                                  active_constraint_set.end());
   for (Constraint& cnst : saturated_constraint_set) {
     cnst.remaining_ = cnst.bound_;
     cnst.usage_     = 0.0;
@@ -57,7 +51,7 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
   auto& var_list  = saturated_variable_set;
   auto& cnst_list = saturated_constraint_set;
   do {
-    if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
+    if (XBT_LOG_ISENABLED(ker_lmm, xbt_log_priority_debug)) {
       XBT_DEBUG("Fair bottleneck done");
       print();
     }
@@ -67,13 +61,13 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
       int nb = 0;
       XBT_DEBUG("Processing cnst %p ", &cnst);
       cnst.usage_ = 0.0;
-      for (Element& elem : cnst.enabled_element_set_) {
+      for (const Element& elem : cnst.enabled_element_set_) {
         xbt_assert(elem.variable->sharing_penalty_ > 0);
         if (elem.consumption_weight > 0 && elem.variable->saturated_variable_set_hook_.is_linked())
           nb++;
       }
       XBT_DEBUG("\tThere are %d variables", nb);
-      if (nb > 0 && cnst.sharing_policy_ == s4u::Link::SharingPolicy::FATPIPE)
+      if (nb > 0 && cnst.sharing_policy_ == Constraint::SharingPolicy::FATPIPE)
         nb = 1;
       if (nb == 0) {
         cnst.remaining_ = 0.0;
@@ -107,15 +101,15 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
     for (auto iter = std::begin(cnst_list); iter != std::end(cnst_list);) {
       Constraint& cnst = *iter;
       XBT_DEBUG("Updating cnst %p ", &cnst);
-      if (cnst.sharing_policy_ != s4u::Link::SharingPolicy::FATPIPE) {
-        for (Element& elem : cnst.enabled_element_set_) {
+      if (cnst.sharing_policy_ != Constraint::SharingPolicy::FATPIPE) {
+        for (const Element& elem : cnst.enabled_element_set_) {
           xbt_assert(elem.variable->sharing_penalty_ > 0);
           XBT_DEBUG("\tUpdate constraint %p (%g) with variable %p by %g", &cnst, cnst.remaining_, elem.variable,
                     elem.variable->mu_);
           double_update(&cnst.remaining_, elem.consumption_weight * elem.variable->mu_, sg_maxmin_precision);
         }
       } else {
-        for (Element& elem : cnst.enabled_element_set_) {
+        for (const Element& elem : cnst.enabled_element_set_) {
           xbt_assert(elem.variable->sharing_penalty_ > 0);
           XBT_DEBUG("\tNon-Shared variable. Update constraint usage of %p (%g) with variable %p by %g", &cnst,
                     cnst.usage_, elem.variable, elem.variable->mu_);
@@ -130,7 +124,7 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
         XBT_DEBUG("\tGet rid of constraint %p", &cnst);
 
         iter = cnst_list.erase(iter);
-        for (Element& elem : cnst.enabled_element_set_) {
+        for (const Element& elem : cnst.enabled_element_set_) {
           if (elem.variable->sharing_penalty_ <= 0)
             break;
           if (elem.consumption_weight > 0 && elem.variable->saturated_variable_set_hook_.is_linked()) {
@@ -146,7 +140,7 @@ void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
 
   cnst_list.clear();
   modified_ = true;
-  if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
+  if (XBT_LOG_ISENABLED(ker_lmm, xbt_log_priority_debug)) {
     XBT_DEBUG("Fair bottleneck done");
     print();
   }