Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplification
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 30 May 2018 08:48:18 +0000 (10:48 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 30 May 2018 08:48:18 +0000 (10:48 +0200)
the previous state is NEVER used

src/instr/instr_platform.cpp
src/plugins/host_energy.cpp
src/plugins/host_load.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp

index 985c506..a2adf5e 100644 (file)
@@ -232,8 +232,7 @@ static void instr_host_on_speed_change(simgrid::s4u::Host& host)
       ->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(),
@@ -358,7 +357,7 @@ void instr_define_callbacks()
   }
   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()) {
index 42c9f8e..c5d0f67 100644 (file)
@@ -381,7 +381,7 @@ static void onCreation(simgrid::s4u::Host& host)
   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();
@@ -462,7 +462,7 @@ void sg_host_energy_plugin_init()
   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
index 0ca6a98..69e2a0d 100644 (file)
@@ -149,7 +149,7 @@ static void onHostChange(simgrid::s4u::Host& host)
 }
 
 /* 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();
@@ -184,7 +184,7 @@ void sg_host_load_plugin_init()
     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);
 }
index eba8890..98bb02c 100644 (file)
@@ -172,26 +172,24 @@ void CpuAction::update_remains_lazy(double now)
   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);
+  on_state_change(this);
   Action::suspend();
 }
 
 void CpuAction::resume(){
   Action::suspend();
 }
 
 void CpuAction::resume(){
-  Action::State previous = get_state();
-  onStateChange(this, previous);
+  on_state_change(this);
   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);
+  on_state_change(this);
 }
 }
+
 /** @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;
index fed276a..8eb5a34 100644 (file)
@@ -168,9 +168,9 @@ protected:
 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)`
    */