X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e82dd935104acc85e28194b2e9348b37e7022621..347f9a2ca55bffc88bf965952b9be3a15535e908:/src/surf/plugins/energy.cpp diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index be3fcd7a50..1ee70cfced 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -100,7 +100,8 @@ void sg_energy_plugin_init() { }); simgrid::surf::VMCreatedCallbacks.connect([](simgrid::surf::VirtualMachine* vm) { - std::map::iterator host_energy_it = surf_energy->find(vm->p_subWs); + std::map::iterator host_energy_it = + surf_energy->find(vm->p_hostPM->extension(simgrid::surf::Host::EXTENSION_ID)); xbt_assert(host_energy_it != surf_energy->end(), "The host is not in surf_energy."); (*surf_energy)[vm] = host_energy_it->second; host_energy_it->second->ref(); // protect the HostEnergy from getting deleted too early @@ -196,10 +197,7 @@ double HostEnergy::getWattMaxAt(int pstate) { return max_power; } -/** - * Computes the power consumed by the host according to the current pstate and processor load - * - */ +/** @brief Computes the power consumed by the host according to the current pstate and processor load */ double HostEnergy::getCurrentWattsValue(double cpu_load) { xbt_dynar_t power_range_list = power_range_watts_list; @@ -226,11 +224,9 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) double HostEnergy::getConsumedEnergy() { - if(last_updated < surf_get_clock()) update_consumption(host, this); return total_energy; - } xbt_dynar_t HostEnergy::getWattsRangeList()