S4U
- New callbacks:
- - simgrid::s4u::onPlatformCreated: right before the simulation starts
- - simgrid::s4u::onSimulationEnd: right after the main simulation loop
+ - s4u::onPlatformCreated: right before the simulation starts
+ - s4u::onSimulationEnd: right after the main simulation loop
+ - s4u::Host::onSpeedChange: when the pstate is changed, or when an
+ event from the availability_file changes the avail speed.
- Links are now usable from s4u
-- target_date=March 20 2017 -- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
static simgrid::xbt::signal<void(Host&)> onDestruction;
/*** Called when the machine is turned on or off */
static simgrid::xbt::signal<void(Host&)> onStateChange;
+ /*** Called when the speed of the machine is changed
+ * (either because of a pstate switch or because of an external load event coming from the profile) */
+ static simgrid::xbt::signal<void(Host&)> onSpeedChange;
};
}} // namespace simgrid::s4u
simgrid::xbt::signal<void(Host&)> Host::onCreation;
simgrid::xbt::signal<void(Host&)> Host::onDestruction;
simgrid::xbt::signal<void(Host&)> Host::onStateChange;
+simgrid::xbt::signal<void(Host&)> Host::onSpeedChange;
Host::Host(const char* name)
: name_(name)
CpuCas01Action* action = static_cast<CpuCas01Action*>(lmm_variable_id(var));
lmm_update_variable_bound(model()->getMaxminSystem(), action->getVariable(), speed_.scale * speed_.peak);
- }
+ }
Cpu::onSpeedChange();
}
void Cpu::onSpeedChange() {
TRACE_surf_host_set_speed(surf_get_clock(), cname(), coresAmount_ * speed_.scale * speed_.peak);
+ s4u::Host::onSpeedChange(*host_);
}
int Cpu::coreCount()
namespace simgrid {
namespace energy {
-class XBT_PRIVATE HostEnergy;
-
class PowerRange {
public:
double idle;
}
}
-static void onHostStateChange(simgrid::s4u::Host& host)
+/* This callback is fired either when the host change its state (on/off) or its speed
+ * (because the user changed the pstate, or because of external trace events) */
+static void onHostChange(simgrid::s4u::Host& host)
{
if (dynamic_cast<simgrid::s4u::VirtualMachine*>(&host)) // Ignore virtual machines
return;
/* **************************** Public interface *************************** */
/** \ingroup SURF_plugin_energy
- * \brief Enable energy plugin
- * \details Enable energy plugin to get joules consumption of each cpu. You should call this function before
- * #MSG_init().
+ * \brief Enable host energy plugin
+ * \details Enable energy plugin to get joules consumption of each cpu. Call this function before #MSG_init().
*/
void sg_host_energy_plugin_init()
{
HostEnergy::EXTENSION_ID = simgrid::s4u::Host::extension_create<HostEnergy>();
simgrid::s4u::Host::onCreation.connect(&onCreation);
- simgrid::s4u::Host::onStateChange.connect(&onHostStateChange);
+ simgrid::s4u::Host::onStateChange.connect(&onHostChange);
+ simgrid::s4u::Host::onSpeedChange.connect(&onHostChange);
simgrid::s4u::Host::onDestruction.connect(&onHostDestruction);
simgrid::surf::CpuAction::onStateChange.connect(&onActionStateChange);
}