Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use implicit string conversion.
[simgrid.git] / src / plugins / host_energy.cpp
index 6c49c918893691e0fc404efeab24af80d524f00a..9d35a374081c19ffdf921aaf8da42f4f90f507c2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2020. 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. */
 
 SIMGRID_REGISTER_PLUGIN(host_energy, "Cpu energy consumption.", &sg_host_energy_plugin_init)
 
-/** @defgroup plugin_host_energy
+/** @defgroup plugin_host_energy plugin_host_energy Plugin Host Energy
 
   @beginrst
 
 This is the energy plugin, enabling to account not only for computation time, but also for the dissipated energy in the
 simulated platform.
-To activate this plugin, first call :cpp:func:`sg_host_energy_plugin_init()` before your :cpp:func:`MSG_init()`, and
-then use :cpp:func:`MSG_host_get_consumed_energy()` to retrieve the consumption of a given host.
+To activate this plugin, first call :cpp:func:`sg_host_energy_plugin_init()` before your loading your platform, and
+then use :cpp:func:`sg_host_get_consumed_energy()` to retrieve the consumption of a given host.
 
 When the host is on, this energy consumption naturally depends on both the current CPU load and the host energy profile.
 According to our measurements, the consumption is somehow linear in the amount of cores at full speed, with an
@@ -34,7 +34,7 @@ abnormality when all the cores are idle. The full details are in `our scientific
 As a result, our energy model takes 4 parameters:
 
   - ``Idle`` wattage (i.e., instantaneous consumption in Watt) when your host is up and running, but without anything to
-do.
+    do.
   - ``Epsilon`` wattage when all cores are at 0 or epsilon%, but not in Idle state.
   - ``AllCores`` wattage when all cores of the host are at 100%.
   - ``Off`` wattage when the host is turned off.
@@ -476,7 +476,7 @@ static void on_action_state_change(simgrid::kernel::resource::CpuAction const& a
     simgrid::s4u::Host* host = cpu->get_host();
     if (host != nullptr) {
       // If it's a VM, take the corresponding PM
-      simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
+      const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
       if (vm) // If it's a VM, take the corresponding PM
         host = vm->get_pm();
 
@@ -556,7 +556,7 @@ void sg_host_energy_plugin_init()
   simgrid::s4u::Exec::on_start.connect([](simgrid::s4u::Actor const&, simgrid::s4u::Exec const& activity) {
     if (activity.get_host_number() == 1) { // We only run on one host
       simgrid::s4u::Host* host         = activity.get_host();
-      simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
+      const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
       if (vm != nullptr)
         host = vm->get_pm();
       xbt_assert(host != nullptr);