]> AND Public Git Repository - simgrid.git/blobdiff - src/plugins/host_load.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mention disk model in host model descriptions
[simgrid.git] / src / plugins / host_load.cpp
index 3484d05f697b74451463b8e9acf043b1aca85cdb..0c1d0753cfd7c6ff07bd858c44fd719cace18843 100644 (file)
@@ -34,8 +34,7 @@ It attaches an extension to each host to store some data, and places callbacks i
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(host_load, kernel, "Logging specific to the HostLoad plugin");
 
-namespace simgrid {
-namespace plugin {
+namespace simgrid::plugin {
 
 static const double activity_uninitialized_remaining_cost = -1;
 
@@ -190,8 +189,7 @@ void HostLoad::reset()
   current_flops_   = host_->get_load();
   current_speed_   = host_->get_speed();
 }
-} // namespace plugin
-} // namespace simgrid
+} // namespace simgrid::plugin
 
 using simgrid::plugin::HostLoad;
 
@@ -237,8 +235,7 @@ void sg_host_load_plugin_init()
   simgrid::s4u::Exec::on_start_cb([](simgrid::s4u::Exec const& activity) {
     if (activity.get_host_number() == 1) { // We only run on one host
       simgrid::s4u::Host* host         = activity.get_host();
-      const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
-      if (vm != nullptr)
+      if (const auto* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host))
         host = vm->get_pm();
       xbt_assert(host != nullptr);
       host->extension<HostLoad>()->add_activity(static_cast<simgrid::kernel::activity::ExecImpl*>(activity.get_impl()));
@@ -256,8 +253,7 @@ void sg_host_load_plugin_init()
       return;
     if (exec->get_host_number() == 1) { // We only run on one host
       simgrid::s4u::Host* host               = exec->get_host();
-      const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
-      if (vm != nullptr)
+      if (const auto* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host))
         host = vm->get_pm();
       xbt_assert(host != nullptr);
       host->extension<HostLoad>()->update();