the previous state is NEVER used
->set_event(surf_get_clock(), host.get_core_count() * host.get_available_speed());
}
->set_event(surf_get_clock(), host.get_core_count() * host.get_available_speed());
}
-static void instr_cpu_action_on_state_change(simgrid::surf::CpuAction* action,
- simgrid::kernel::resource::Action::State /* previous */)
+static void instr_cpu_action_on_state_change(simgrid::surf::CpuAction* action)
{
simgrid::surf::Cpu* cpu = static_cast<simgrid::surf::Cpu*>(action->get_variable()->get_constraint(0)->get_id());
TRACE_surf_resource_set_utilization("HOST", "power_used", cpu->get_cname(), action->get_category(),
{
simgrid::surf::Cpu* cpu = static_cast<simgrid::surf::Cpu*>(action->get_variable()->get_constraint(0)->get_id());
TRACE_surf_resource_set_utilization("HOST", "power_used", cpu->get_cname(), action->get_category(),
}
simgrid::s4u::NetZone::onCreation.connect(instr_netzone_on_creation);
}
simgrid::s4u::NetZone::onCreation.connect(instr_netzone_on_creation);
- simgrid::surf::CpuAction::onStateChange.connect(instr_cpu_action_on_state_change);
+ simgrid::surf::CpuAction::on_state_change.connect(instr_cpu_action_on_state_change);
simgrid::s4u::Link::on_communication_state_change.connect(instr_link_on_communication_state_change);
if (TRACE_actor_is_enabled()) {
simgrid::s4u::Link::on_communication_state_change.connect(instr_link_on_communication_state_change);
if (TRACE_actor_is_enabled()) {
host.extension_set(new HostEnergy(&host));
}
host.extension_set(new HostEnergy(&host));
}
-static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::kernel::resource::Action::State previous)
+static void onActionStateChange(simgrid::surf::CpuAction* action)
{
for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
simgrid::s4u::Host* host = cpu->get_host();
{
for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
simgrid::s4u::Host* host = cpu->get_host();
simgrid::s4u::Host::on_speed_change.connect(&onHostChange);
simgrid::s4u::Host::on_destruction.connect(&onHostDestruction);
simgrid::s4u::on_simulation_end.connect(&onSimulationEnd);
simgrid::s4u::Host::on_speed_change.connect(&onHostChange);
simgrid::s4u::Host::on_destruction.connect(&onHostDestruction);
simgrid::s4u::on_simulation_end.connect(&onSimulationEnd);
- simgrid::surf::CpuAction::onStateChange.connect(&onActionStateChange);
+ simgrid::surf::CpuAction::on_state_change.connect(&onActionStateChange);
}
/** @ingroup plugin_energy
}
/** @ingroup plugin_energy
}
/* This callback is called when an action (computation, idle, ...) terminates */
}
/* This callback is called when an action (computation, idle, ...) terminates */
-static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::kernel::resource::Action::State /*previous*/)
+static void onActionStateChange(simgrid::surf::CpuAction* action)
{
for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
simgrid::s4u::Host* host = cpu->get_host();
{
for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
simgrid::s4u::Host* host = cpu->get_host();
host.extension_set(new HostLoad(&host));
});
host.extension_set(new HostLoad(&host));
});
- simgrid::surf::CpuAction::onStateChange.connect(&onActionStateChange);
+ simgrid::surf::CpuAction::on_state_change.connect(&onActionStateChange);
simgrid::s4u::Host::on_state_change.connect(&onHostChange);
simgrid::s4u::Host::on_speed_change.connect(&onHostChange);
}
simgrid::s4u::Host::on_state_change.connect(&onHostChange);
simgrid::s4u::Host::on_speed_change.connect(&onHostChange);
}
set_last_value(get_variable()->get_value());
}
set_last_value(get_variable()->get_value());
}
-simgrid::xbt::signal<void(simgrid::surf::CpuAction*, kernel::resource::Action::State)> CpuAction::onStateChange;
+simgrid::xbt::signal<void(simgrid::surf::CpuAction*)> CpuAction::on_state_change;
void CpuAction::suspend(){
void CpuAction::suspend(){
- Action::State previous = get_state();
- onStateChange(this, previous);
Action::suspend();
}
void CpuAction::resume(){
Action::suspend();
}
void CpuAction::resume(){
- Action::State previous = get_state();
- onStateChange(this, previous);
Action::resume();
}
void CpuAction::set_state(Action::State state)
{
Action::resume();
}
void CpuAction::set_state(Action::State state)
{
- Action::State previous = get_state();
Action::set_state(state);
Action::set_state(state);
- onStateChange(this, previous);
/** @brief returns a list of all CPUs that this action is using */
std::list<Cpu*> CpuAction::cpus() {
std::list<Cpu*> retlist;
/** @brief returns a list of all CPUs that this action is using */
std::list<Cpu*> CpuAction::cpus() {
std::list<Cpu*> retlist;
class XBT_PUBLIC CpuAction : public simgrid::kernel::resource::Action {
public:
/** @brief Signal emitted when the action state changes (ready/running/done, etc)
class XBT_PUBLIC CpuAction : public simgrid::kernel::resource::Action {
public:
/** @brief Signal emitted when the action state changes (ready/running/done, etc)
- * Signature: `void(CpuAction *action, simgrid::kernel::resource::Action::State previous)`
+ * Signature: `void(CpuAction *action)`
- static simgrid::xbt::signal<void(simgrid::surf::CpuAction*, simgrid::kernel::resource::Action::State)> onStateChange;
+ static simgrid::xbt::signal<void(simgrid::surf::CpuAction*)> on_state_change;
/** @brief Signal emitted when the action share changes (amount of flops it gets)
* Signature: `void(CpuAction *action)`
*/
/** @brief Signal emitted when the action share changes (amount of flops it gets)
* Signature: `void(CpuAction *action)`
*/