X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/05a7f6f63685b139a23bbaf1fc3536fd2ea35cb9..805ca601ea6ed88e4b000ced1b985c70f1d4f940:/src/plugins/host_energy.cpp diff --git a/src/plugins/host_energy.cpp b/src/plugins/host_energy.cpp index 4fdc423e4e..6334dddffe 100644 --- a/src/plugins/host_energy.cpp +++ b/src/plugins/host_energy.cpp @@ -6,12 +6,15 @@ #include "simgrid/plugins/energy.h" #include "simgrid/plugins/load.h" #include "simgrid/s4u/Engine.hpp" +#include "src/include/surf/surf.hpp" #include "src/plugins/vm/VirtualMachineImpl.hpp" #include "src/surf/cpu_interface.hpp" #include #include +SIMGRID_REGISTER_PLUGIN(host_energy, "Cpu energy consumption.", &sg_host_energy_plugin_init) + /** @addtogroup plugin_energy This is the energy plugin, enabling to account not only for computation time, but also for the dissipated energy in the @@ -156,7 +159,12 @@ void HostEnergy::update() { double start_time = this->last_updated_; double finish_time = surf_get_clock(); - + // + // We may have start == finish if the past consumption was updated since the simcall was started + // for example if 2 actors requested to update the same host's consumption in a given scheduling round. + // + // Even in this case, we need to save the pstate for the next call (after this if), + // which may have changed since that recent update. if (start_time < finish_time) { double previous_energy = this->total_energy_; @@ -223,11 +231,6 @@ double HostEnergy::get_current_watts_value() double current_speed = host_->get_speed(); double cpu_load; - // We may have start == finish if the past consumption was updated since the simcall was started - // for example if 2 actors requested to update the same host's consumption in a given scheduling round. - // - // Even in this case, we need to save the pstate for the next call (after this big if), - // which may have changed since that recent update. if (current_speed <= 0) // Some users declare a pstate of speed 0 flops (e.g., to model boot time). @@ -275,8 +278,8 @@ double HostEnergy::get_current_watts_value(double cpu_load) double power_slope = 0; if (cpu_load > 0) { /* Something is going on, the machine is not idle */ - double min_power = range.min_; - double max_power = range.max_; + min_power = range.min_; + max_power = range.max_; /** * The min_power states how much we consume when only one single