Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use std::string_view (sonar).
[simgrid.git] / src / kernel / resource / DiskImpl.cpp
index e3781ab..07709ce 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2019-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2019-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. */
@@ -6,15 +6,20 @@
 #include "DiskImpl.hpp"
 
 #include "simgrid/s4u/Engine.hpp"
+#include "simgrid/sg_config.hpp"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 #include "src/kernel/resource/profile/Profile.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_disk, ker_resource, "Disk resources, that fuel I/O activities");
+/***********
+ * Options *
+ ***********/
+static simgrid::config::Flag<std::string> cfg_disk_solver("disk/solver",
+                                                          "Set linear equations solver used by disk model", "maxmin",
+                                                          &simgrid::kernel::lmm::System::validate_solver);
 
-namespace simgrid {
-namespace kernel {
-namespace resource {
+namespace simgrid::kernel::resource {
 
 xbt::signal<void(DiskAction const&, Action::State, Action::State)> DiskAction::on_state_change;
 
@@ -24,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(new lmm::System(true /* selective update */));
+  set_maxmin_system(lmm::System::build(cfg_disk_solver.get(), true /* selective update */));
 }
 
 /************
@@ -172,6 +177,4 @@ void DiskAction::set_state(Action::State new_state)
     on_state_change(*this, previous_state, new_state);
   }
 }
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::resource