X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/73ce29ce2f26f9133fee1ed734563abddb7f6290..adb6ac3567f09ceb1016dfbce03254bdb879c711:/src/plugins/host_energy.cpp diff --git a/src/plugins/host_energy.cpp b/src/plugins/host_energy.cpp index d01fe42e5b..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).