-/* Copyright (c) 2010, 2012-2013. The SimGrid Team.
+/* Copyright (c) 2010, 2012-2014. 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. */
+ * under the terms of the license (GNU LGPL) which comes with this package. */
#include "energy.hpp"
#include "../cpu_cas01.hpp"
/** @addtogroup SURF_plugin_energy
- *
- *
+ *
+ *
* BlaBla energy
*/
surf_energy->erase(cpuIt);
}
-static void energyCpuActionStateChangedCallback(CpuActionPtr action){
+static void energyCpuActionStateChangedCallback(CpuActionPtr action, e_surf_action_state_t old, e_surf_action_state_t cur){
CpuPtr cpu = getActionCpu(action);
CpuEnergyPtr cpu_energy = (*surf_energy)[cpu];
}
}
+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.
surf_callback_connect(cpuCreatedCallbacks, energyCpuCreatedCallback);
surf_callback_connect(cpuDestructedCallbacks, energyCpuDestructedCallback);
surf_callback_connect(cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback);
-
+ surf_callback_connect(surfExitCallbacks, sg_energy_plugin_exit);
}
}
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<CpuCas01Ptr>(cpu)->m_pstate, xbt_dynar_t);
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(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 */