Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use std::string_view (sonar).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 31 Aug 2022 13:15:57 +0000 (15:15 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 31 Aug 2022 13:15:57 +0000 (15:15 +0200)
src/kernel/lmm/System.cpp
src/kernel/lmm/System.hpp
src/kernel/resource/DiskImpl.cpp
src/surf/cpu_cas01.cpp
src/surf/network_cm02.cpp
src/surf/ptask_L07.cpp

index 8723613..2f7f25f 100644 (file)
@@ -57,7 +57,7 @@ void Element::increase_concurrency(bool check_limit)
              "Concurrency limit overflow!");
 }
 
-System* System::build(const std::string& solver_name, bool selective_update)
+System* System::build(std::string_view solver_name, bool selective_update)
 {
   System* system = nullptr;
   if (solver_name == "bmf") {
index 12a194f..a0505ce 100644 (file)
@@ -18,6 +18,7 @@
 #include <cmath>
 #include <limits>
 #include <memory>
+#include <string_view>
 #include <vector>
 
 namespace simgrid::kernel::lmm {
@@ -418,7 +419,7 @@ public:
    * @param selective_update Enables lazy updates
    * @return pointer to System instance
    */
-  static System* build(const std::string& solver_name, bool selective_update);
+  static System* build(std::string_view solver_name, bool selective_update);
   /** @brief Validates solver configuration */
   static void validate_solver(const std::string& solver_name);
 
index 29198e1..07709ce 100644 (file)
@@ -29,7 +29,7 @@ xbt::signal<void(DiskAction const&, Action::State, Action::State)> DiskAction::o
 
 DiskModel::DiskModel(const std::string& name) : Model(name)
 {
-  set_maxmin_system(lmm::System::build(cfg_disk_solver, true /* selective update */));
+  set_maxmin_system(lmm::System::build(cfg_disk_solver.get(), true /* selective update */));
 }
 
 /************
index 8112b6a..62e8aef 100644 (file)
@@ -68,7 +68,7 @@ CpuCas01Model::CpuCas01Model(const std::string& name) : CpuModel(name)
     select = true;
   }
 
-  set_maxmin_system(lmm::System::build(cfg_cpu_solver, select));
+  set_maxmin_system(lmm::System::build(cfg_cpu_solver.get(), select));
 }
 
 CpuImpl* CpuCas01Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate)
index c7f15ec..8ef4943 100644 (file)
@@ -93,7 +93,7 @@ NetworkCm02Model::NetworkCm02Model(const std::string& name) : NetworkModel(name)
     select = true;
   }
 
-  set_maxmin_system(lmm::System::build(cfg_network_solver, select));
+  set_maxmin_system(lmm::System::build(cfg_network_solver.get(), select));
 
   loopback_.reset(create_link("__loopback__", {config::get_value<double>("network/loopback-bw")}));
   loopback_->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE, {});
index 357dd10..60dddcd 100644 (file)
@@ -36,7 +36,7 @@ void surf_host_model_init_ptask_L07()
   XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks.");
   xbt_assert(cfg_ptask_solver != "maxmin", "Invalid configuration. Cannot use maxmin solver with parallel tasks.");
 
-  auto* system    = simgrid::kernel::lmm::System::build(cfg_ptask_solver, true /* selective update */);
+  auto* system    = simgrid::kernel::lmm::System::build(cfg_ptask_solver.get(), true /* selective update */);
   auto host_model = std::make_shared<simgrid::kernel::resource::HostL07Model>("Host_Ptask", system);
   auto* engine    = simgrid::kernel::EngineImpl::get_instance();
   engine->add_model(host_model);