X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5b3677b425b9cc6949c1573d59ac772540cbf4b2..1943ca63ab0af58abc75c70054783d962737f3e9:/src/surf/plugins/energy.cpp diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index 9784cbb8f1..993ac0b7ed 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -54,6 +54,12 @@ static void energyCpuActionStateChangedCallback(CpuActionPtr action){ } } +static void sg_energy_plugin_exit() +{ + delete surf_energy; + surf_energy = NULL; +} + /** \ingroup SURF_plugin_energy * \brief Enable energy plugin * \details Enable energy plugin to get joules consumption of each cpu. @@ -64,7 +70,7 @@ void sg_energy_plugin_init() { surf_callback_connect(cpuCreatedCallbacks, energyCpuCreatedCallback); surf_callback_connect(cpuDestructedCallbacks, energyCpuDestructedCallback); surf_callback_connect(cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback); - + surf_callback_connect(surfExitCallbacks, sg_energy_plugin_exit); } } @@ -106,7 +112,7 @@ double CpuEnergy::getCurrentWattsValue(double cpu_load) cpu->getName());*/ /* retrieve the power values associated with the current pstate */ - xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(cpu)->m_pstate, xbt_dynar_t); + xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast(cpu)->getPState(), xbt_dynar_t); /* min_power corresponds to the idle power (cpu load = 0) */ /* max_power is the power consumed at 100% cpu load */