Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
UPPER_CASE the Action::State values (+ uniformity with s4u::Activity)
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 17 May 2018 20:26:52 +0000 (22:26 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 17 May 2018 20:28:39 +0000 (22:28 +0200)
23 files changed:
include/simgrid/kernel/resource/Action.hpp
include/simgrid/kernel/resource/Model.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/SleepImpl.cpp
src/kernel/activity/SynchroIo.cpp
src/kernel/activity/SynchroRaw.cpp
src/kernel/resource/Action.cpp
src/kernel/resource/Model.cpp
src/simix/ActorImpl.cpp
src/simix/smx_network.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_ti.cpp
src/surf/network_cm02.cpp
src/surf/network_constant.cpp
src/surf/network_ib.cpp
src/surf/network_interface.cpp
src/surf/network_ns3.cpp
src/surf/ptask_L07.cpp
src/surf/storage_n11.cpp
src/surf/surf_c_bindings.cpp
teshsuite/surf/surf_usage/surf_usage.cpp

index c8e20eb..72a9435 100644 (file)
@@ -66,11 +66,12 @@ public:
       StateSet;
 
   enum class State {
-    inited,  /**< Created, but not started yet */
-    running, /**< Started, currently running */
-    failed,  /**< Completed (unsuccessfully: either the resource failed, or the action was canceled) */
-    done,    /**< Completed (successfully) */
-    ignored  /**< e.g. failure detectors, these infinite sleep actions that are put on resources which failure should be notified */
+    INITED,   /**< Created, but not started yet */
+    STARTED,  /**< Currently running */
+    FAILED,   /**< either the resource failed, or the action was canceled */
+    FINISHED, /**< Successfully completed  */
+    IGNORED /**< e.g. failure detectors, these infinite sleep actions that are put on resources which failure should be
+               notified */
   };
 
   enum class SuspendStates {
index 399a507..9a614ca 100644 (file)
@@ -34,14 +34,14 @@ public:
   /** @brief Get the set of [actions](@ref Action) in *inited* state */
   Action::StateSet* get_inited_action_set() const { return inited_action_set_; }
 
-  /** @brief Get the set of [actions](@ref Action) in *running* state */
-  Action::StateSet* get_running_action_set() const { return running_action_set_; }
+  /** @brief Get the set of [actions](@ref Action) in *started* state */
+  Action::StateSet* get_started_action_set() const { return started_action_set_; }
 
   /** @brief Get the set of [actions](@ref Action) in *failed* state */
   Action::StateSet* get_failed_action_set() const { return failed_action_set_; }
 
-  /** @brief Get the set of [actions](@ref Action) in *done* state */
-  Action::StateSet* get_done_action_set() const { return done_action_set_; }
+  /** @brief Get the set of [actions](@ref Action) in *finished* state */
+  Action::StateSet* get_finished_action_set() const { return finished_action_set_; }
 
   /** @brief Get the set of modified [actions](@ref Action) */
   Action::ModifiedSet* get_modified_set() const;
@@ -89,9 +89,9 @@ private:
   lmm::System* maxmin_system_           = nullptr;
   const UpdateAlgo update_algorithm_;
   Action::StateSet* inited_action_set_  = new Action::StateSet(); /**< Created not started */
-  Action::StateSet* running_action_set_ = new Action::StateSet(); /**< Started not done */
+  Action::StateSet* started_action_set_  = new Action::StateSet(); /**< Started not done */
   Action::StateSet* failed_action_set_  = new Action::StateSet(); /**< Done with failure */
-  Action::StateSet* done_action_set_    = new Action::StateSet(); /**< Done successful */
+  Action::StateSet* finished_action_set_ = new Action::StateSet(); /**< Done successful */
   ActionHeap action_heap_;
 };
 
index 7d9bd69..8c2f838 100644 (file)
@@ -97,15 +97,15 @@ void simgrid::kernel::activity::CommImpl::cleanupSurf()
 void simgrid::kernel::activity::CommImpl::post()
 {
   /* Update synchro state */
-  if (src_timeout && src_timeout->get_state() == simgrid::kernel::resource::Action::State::done)
+  if (src_timeout && src_timeout->get_state() == simgrid::kernel::resource::Action::State::FINISHED)
     state_ = SIMIX_SRC_TIMEOUT;
-  else if (dst_timeout && dst_timeout->get_state() == simgrid::kernel::resource::Action::State::done)
+  else if (dst_timeout && dst_timeout->get_state() == simgrid::kernel::resource::Action::State::FINISHED)
     state_ = SIMIX_DST_TIMEOUT;
-  else if (src_timeout && src_timeout->get_state() == simgrid::kernel::resource::Action::State::failed)
+  else if (src_timeout && src_timeout->get_state() == simgrid::kernel::resource::Action::State::FAILED)
     state_ = SIMIX_SRC_HOST_FAILURE;
-  else if (dst_timeout && dst_timeout->get_state() == simgrid::kernel::resource::Action::State::failed)
+  else if (dst_timeout && dst_timeout->get_state() == simgrid::kernel::resource::Action::State::FAILED)
     state_ = SIMIX_DST_HOST_FAILURE;
-  else if (surfAction_ && surfAction_->get_state() == simgrid::kernel::resource::Action::State::failed) {
+  else if (surfAction_ && surfAction_->get_state() == simgrid::kernel::resource::Action::State::FAILED) {
     state_ = SIMIX_LINK_FAILURE;
   } else
     state_ = SIMIX_DONE;
index 6cecccf..a0e3cc2 100644 (file)
@@ -97,10 +97,11 @@ void simgrid::kernel::activity::ExecImpl::post()
                                  /* If the host running the synchro failed, notice it. This way, the asking
                                   * process can be killed if it runs on that host itself */
                                  state_ = SIMIX_FAILED;
-  } else if (surf_action_ && surf_action_->get_state() == simgrid::kernel::resource::Action::State::failed) {
+  } else if (surf_action_ && surf_action_->get_state() == simgrid::kernel::resource::Action::State::FAILED) {
     /* If the host running the synchro didn't fail, then the synchro was canceled */
     state_ = SIMIX_CANCELED;
-  } else if (timeout_detector_ && timeout_detector_->get_state() == simgrid::kernel::resource::Action::State::done) {
+  } else if (timeout_detector_ &&
+             timeout_detector_->get_state() == simgrid::kernel::resource::Action::State::FINISHED) {
     state_ = SIMIX_TIMEOUT;
   } else {
     state_ = SIMIX_DONE;
index 05e8303..9fa1841 100644 (file)
@@ -33,12 +33,12 @@ void simgrid::kernel::activity::SleepImpl::post()
 
     e_smx_state_t result;
     switch (surf_sleep->get_state()) {
-      case simgrid::kernel::resource::Action::State::failed:
+      case simgrid::kernel::resource::Action::State::FAILED:
         simcall->issuer->context->iwannadie = 1;
         result                              = SIMIX_SRC_HOST_FAILURE;
         break;
 
-      case simgrid::kernel::resource::Action::State::done:
+      case simgrid::kernel::resource::Action::State::FINISHED:
         result = SIMIX_DONE;
         break;
 
index 130354d..b153484 100644 (file)
@@ -35,10 +35,10 @@ void simgrid::kernel::activity::IoImpl::post()
   }
 
   switch (surf_io->get_state()) {
-    case simgrid::kernel::resource::Action::State::failed:
+    case simgrid::kernel::resource::Action::State::FAILED:
       state_ = SIMIX_FAILED;
       break;
-    case simgrid::kernel::resource::Action::State::done:
+    case simgrid::kernel::resource::Action::State::FINISHED:
       state_ = SIMIX_DONE;
       break;
     default:
index 69830b0..f1fb07f 100644 (file)
@@ -27,9 +27,9 @@ void simgrid::kernel::activity::RawImpl::resume()
 void simgrid::kernel::activity::RawImpl::post()
 {
   XBT_IN("(%p)",this);
-  if (sleep->get_state() == simgrid::kernel::resource::Action::State::failed)
+  if (sleep->get_state() == simgrid::kernel::resource::Action::State::FAILED)
     state_ = SIMIX_FAILED;
-  else if (sleep->get_state() == simgrid::kernel::resource::Action::State::done)
+  else if (sleep->get_state() == simgrid::kernel::resource::Action::State::FINISHED)
     state_ = SIMIX_SRC_TIMEOUT;
 
   SIMIX_synchro_finish(this);
index 02505ea..4fb398f 100644 (file)
@@ -26,7 +26,7 @@ Action::Action(simgrid::kernel::resource::Model* model, double cost, bool failed
   if (failed)
     state_set_ = get_model()->get_failed_action_set();
   else
-    state_set_ = get_model()->get_running_action_set();
+    state_set_ = get_model()->get_started_action_set();
 
   state_set_->push_back(*this);
 }
@@ -56,31 +56,31 @@ void Action::finish(Action::State state)
 Action::State Action::get_state() const
 {
   if (state_set_ == model_->get_inited_action_set())
-    return Action::State::inited;
-  if (state_set_ == model_->get_running_action_set())
-    return Action::State::running;
+    return Action::State::INITED;
+  if (state_set_ == model_->get_started_action_set())
+    return Action::State::STARTED;
   if (state_set_ == model_->get_failed_action_set())
-    return Action::State::failed;
-  if (state_set_ == model_->get_done_action_set())
-    return Action::State::done;
-  return Action::State::ignored;
+    return Action::State::FAILED;
+  if (state_set_ == model_->get_finished_action_set())
+    return Action::State::FINISHED;
+  return Action::State::IGNORED;
 }
 
 void Action::set_state(Action::State state)
 {
   simgrid::xbt::intrusive_erase(*state_set_, *this);
   switch (state) {
-    case Action::State::inited:
+    case Action::State::INITED:
       state_set_ = model_->get_inited_action_set();
       break;
-    case Action::State::running:
-      state_set_ = model_->get_running_action_set();
+    case Action::State::STARTED:
+      state_set_ = model_->get_started_action_set();
       break;
-    case Action::State::failed:
+    case Action::State::FAILED:
       state_set_ = model_->get_failed_action_set();
       break;
-    case Action::State::done:
-      state_set_ = model_->get_done_action_set();
+    case Action::State::FINISHED:
+      state_set_ = model_->get_finished_action_set();
       break;
     default:
       state_set_ = nullptr;
@@ -136,7 +136,7 @@ void Action::set_priority(double weight)
 
 void Action::cancel()
 {
-  set_state(Action::State::failed);
+  set_state(Action::State::FAILED);
   if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) {
     if (modified_set_hook_.is_linked())
       simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this);
@@ -161,7 +161,7 @@ void Action::suspend()
     get_model()->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
     if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) {
       get_model()->get_action_heap().remove(this);
-      if (state_set_ == get_model()->get_running_action_set() && sharing_priority_ > 0) {
+      if (state_set_ == get_model()->get_started_action_set() && sharing_priority_ > 0) {
         // If we have a lazy model, we need to update the remaining value accordingly
         update_remains_lazy(surf_get_clock());
       }
index f73ee98..c8b0e08 100644 (file)
@@ -17,9 +17,9 @@ Model::Model(Model::UpdateAlgo algo) : update_algorithm_(algo) {}
 Model::~Model()
 {
   delete inited_action_set_;
-  delete running_action_set_;
+  delete started_action_set_;
   delete failed_action_set_;
-  delete done_action_set_;
+  delete finished_action_set_;
   delete maxmin_system_;
 }
 
@@ -50,7 +50,7 @@ double Model::next_occuring_event_lazy(double now)
     maxmin_system_->modified_set_->pop_front();
     bool max_duration_flag = false;
 
-    if (action->get_state_set() != running_action_set_)
+    if (action->get_state_set() != started_action_set_)
       continue;
 
     /* bogus priority, skip it */
@@ -108,7 +108,7 @@ double Model::next_occuring_event_full(double /*now*/)
 
   double min = -1;
 
-  for (Action& action : *get_running_action_set()) {
+  for (Action& action : *get_started_action_set()) {
     double value = action.get_variable()->get_value();
     if (value > 0) {
       if (action.get_remains() > 0)
index 202aa8f..9319634 100644 (file)
@@ -655,7 +655,7 @@ smx_activity_t SIMIX_process_join(smx_actor_t issuer, smx_actor_t process, doubl
                         [](void*, void* arg) {
                           auto sleep = static_cast<simgrid::kernel::activity::SleepImpl*>(arg);
                           if (sleep->surf_sleep)
-                            sleep->surf_sleep->finish(simgrid::kernel::resource::Action::State::done);
+                            sleep->surf_sleep->finish(simgrid::kernel::resource::Action::State::FINISHED);
                           intrusive_ptr_release(sleep);
                           return 0;
                         },
index 649154b..6a599e8 100644 (file)
@@ -466,7 +466,7 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm)
               receiver->get_cname(), comm->surfAction_);
 
     /* If a link is failed, detect it immediately */
-    if (comm->surfAction_->get_state() == simgrid::kernel::resource::Action::State::failed) {
+    if (comm->surfAction_->get_state() == simgrid::kernel::resource::Action::State::FAILED) {
       XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->get_cname(),
                 receiver->get_cname());
       comm->state_ = SIMIX_LINK_FAILURE;
index e01b903..926ff85 100644 (file)
@@ -151,11 +151,11 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value)
       while ((var = cnst->get_variable(&elem))) {
         kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
-        if (action->get_state() == kernel::resource::Action::State::inited ||
-            action->get_state() == kernel::resource::Action::State::running ||
-            action->get_state() == kernel::resource::Action::State::ignored) {
+        if (action->get_state() == kernel::resource::Action::State::INITED ||
+            action->get_state() == kernel::resource::Action::State::STARTED ||
+            action->get_state() == kernel::resource::Action::State::IGNORED) {
           action->set_finish_time(date);
-          action->set_state(kernel::resource::Action::State::failed);
+          action->set_state(kernel::resource::Action::State::FAILED);
         }
       }
     }
index 05fbd12..7cd104d 100644 (file)
@@ -28,14 +28,14 @@ void CpuModel::update_actions_state_lazy(double now, double /*delta*/)
     CpuAction* action = static_cast<CpuAction*>(get_action_heap().pop());
     XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
 
-    action->finish(kernel::resource::Action::State::done);
+    action->finish(kernel::resource::Action::State::FINISHED);
     XBT_CDEBUG(surf_kernel, "Action %p finished", action);
   }
   if (TRACE_is_enabled()) {
     //defining the last timestamp that we can safely dump to trace file
     //without losing the event ascending order (considering all CPU's)
     double smaller = -1;
-    for (kernel::resource::Action const& action : *get_running_action_set()) {
+    for (kernel::resource::Action const& action : *get_started_action_set()) {
       if (smaller < 0 || action.get_last_update() < smaller)
         smaller = action.get_last_update();
     }
@@ -47,7 +47,7 @@ void CpuModel::update_actions_state_lazy(double now, double /*delta*/)
 
 void CpuModel::update_actions_state_full(double now, double delta)
 {
-  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
+  for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
     CpuAction& action = static_cast<CpuAction&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
 
@@ -58,7 +58,7 @@ void CpuModel::update_actions_state_full(double now, double delta)
 
     if (((action.get_remains_no_update() <= 0) && (action.get_variable()->get_weight() > 0)) ||
         ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
-      action.finish(kernel::resource::Action::State::done);
+      action.finish(kernel::resource::Action::State::FINISHED);
     }
   }
 }
@@ -161,7 +161,7 @@ void Cpu::set_speed_trace(tmgr_trace_t trace)
 
 void CpuAction::update_remains_lazy(double now)
 {
-  xbt_assert(get_state_set() == get_model()->get_running_action_set(),
+  xbt_assert(get_state_set() == get_model()->get_started_action_set(),
              "You're updating an action that is not running.");
   xbt_assert(get_priority() > 0, "You're updating an action that seems suspended.");
 
index b1928e4..6ce9417 100644 (file)
@@ -343,7 +343,7 @@ void CpuTiModel::update_actions_state(double now, double /*delta*/)
   while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) {
     CpuTiAction* action = static_cast<CpuTiAction*>(get_action_heap().pop());
     XBT_DEBUG("Action %p: finish", action);
-    action->finish(kernel::resource::Action::State::done);
+    action->finish(kernel::resource::Action::State::FINISHED);
     /* update remaining amount of all actions */
     action->cpu_->update_remaining_amount(surf_get_clock());
   }
@@ -413,11 +413,11 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value)
 
       /* put all action running on cpu to failed */
       for (CpuTiAction& action : action_set_) {
-        if (action.get_state() == kernel::resource::Action::State::inited ||
-            action.get_state() == kernel::resource::Action::State::running ||
-            action.get_state() == kernel::resource::Action::State::ignored) {
+        if (action.get_state() == kernel::resource::Action::State::INITED ||
+            action.get_state() == kernel::resource::Action::State::STARTED ||
+            action.get_state() == kernel::resource::Action::State::IGNORED) {
           action.set_finish_time(date);
-          action.set_state(kernel::resource::Action::State::failed);
+          action.set_state(kernel::resource::Action::State::FAILED);
           get_model()->get_action_heap().remove(&action);
         }
       }
@@ -439,7 +439,7 @@ void CpuTi::update_actions_finish_time(double now)
   sum_priority_ = 0.0;
   for (CpuTiAction const& action : action_set_) {
     /* action not running, skip it */
-    if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
+    if (action.get_state_set() != surf_cpu_model_pm->get_started_action_set())
       continue;
 
     /* bogus priority, skip it */
@@ -456,7 +456,7 @@ void CpuTi::update_actions_finish_time(double now)
   for (CpuTiAction& action : action_set_) {
     double min_finish = -1;
     /* action not running, skip it */
-    if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
+    if (action.get_state_set() != surf_cpu_model_pm->get_started_action_set())
       continue;
 
     /* verify if the action is really running on cpu */
@@ -513,7 +513,7 @@ void CpuTi::update_remaining_amount(double now)
   XBT_DEBUG("Flops total: %f, Last update %f", area_total, last_update_);
   for (CpuTiAction& action : action_set_) {
     /* action not running, skip it */
-    if (action.get_state_set() != get_model()->get_running_action_set())
+    if (action.get_state_set() != get_model()->get_started_action_set())
       continue;
 
     /* bogus priority, skip it */
@@ -613,7 +613,7 @@ void CpuTiAction::set_state(Action::State state)
 
 void CpuTiAction::cancel()
 {
-  this->set_state(Action::State::failed);
+  this->set_state(Action::State::FAILED);
   get_model()->get_action_heap().remove(this);
   cpu_->set_modified(true);
 }
index 761f90d..2eed509 100644 (file)
@@ -174,7 +174,7 @@ void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
       // no need to communicate anymore
       // assume that flows that reached max_duration have remaining of 0
       XBT_DEBUG("Action %p finished", action);
-      action->finish(Action::State::done);
+      action->finish(Action::State::FINISHED);
       get_action_heap().remove(action);
     }
   }
@@ -182,7 +182,7 @@ void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
 
 void NetworkCm02Model::update_actions_state_full(double now, double delta)
 {
-  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
+  for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
     NetworkCm02Action& action = static_cast<NetworkCm02Action&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     XBT_DEBUG("Something happened to action %p", &action);
@@ -212,7 +212,7 @@ void NetworkCm02Model::update_actions_state_full(double now, double delta)
 
     if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) ||
         ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
-      action.finish(Action::State::done);
+      action.finish(Action::State::FINISHED);
     }
   }
 }
@@ -349,9 +349,9 @@ void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
       while ((var = get_constraint()->get_variable(&elem))) {
         Action* action = static_cast<Action*>(var->get_id());
 
-        if (action->get_state() == Action::State::inited || action->get_state() == Action::State::running) {
+        if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED) {
           action->set_finish_time(now);
-          action->set_state(Action::State::failed);
+          action->set_state(Action::State::FAILED);
         }
       }
     }
@@ -448,7 +448,7 @@ void NetworkCm02Action::update_remains_lazy(double now)
 
   if ((get_remains_no_update() <= 0 && (get_variable()->get_weight() > 0)) ||
       ((max_duration > NO_MAX_DURATION) && (max_duration <= 0))) {
-    finish(Action::State::done);
+    finish(Action::State::FINISHED);
     get_model()->get_action_heap().remove(this);
   }
 
index 197285b..c1f0970 100644 (file)
@@ -35,7 +35,7 @@ LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, d
 double NetworkConstantModel::next_occuring_event(double /*now*/)
 {
   double min = -1.0;
-  for (kernel::resource::Action const& action : *get_running_action_set()) {
+  for (kernel::resource::Action const& action : *get_started_action_set()) {
     const NetworkConstantAction& net_action = static_cast<const NetworkConstantAction&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min))
       min = net_action.latency_;
@@ -45,7 +45,7 @@ double NetworkConstantModel::next_occuring_event(double /*now*/)
 
 void NetworkConstantModel::update_actions_state(double /*now*/, double delta)
 {
-  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
+  for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
     NetworkConstantAction& action = static_cast<NetworkConstantAction&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     if (action.latency_ > 0) {
@@ -61,7 +61,7 @@ void NetworkConstantModel::update_actions_state(double /*now*/, double delta)
 
     if ((action.get_remains_no_update() <= 0) ||
         ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
-      action.finish(kernel::resource::Action::State::done);
+      action.finish(kernel::resource::Action::State::FINISHED);
     }
   }
 }
@@ -82,7 +82,7 @@ NetworkConstantAction::NetworkConstantAction(NetworkConstantModel* model_, doubl
 {
   latency_ = latency;
   if (latency_ <= 0.0)
-    NetworkConstantAction::set_state(Action::State::done);
+    NetworkConstantAction::set_state(Action::State::FINISHED);
 };
 
 NetworkConstantAction::~NetworkConstantAction() = default;
index bc08ced..a633584 100644 (file)
@@ -32,7 +32,7 @@ static void IB_action_state_changed_callback(simgrid::kernel::resource::NetworkA
   using simgrid::kernel::resource::IBNode;
   using simgrid::kernel::resource::NetworkIBModel;
 
-  if (action->get_state() != simgrid::kernel::resource::Action::State::done)
+  if (action->get_state() != simgrid::kernel::resource::Action::State::FINISHED)
     return;
   std::pair<IBNode*,IBNode*> pair = ((NetworkIBModel*)surf_network_model)->active_comms[action];
   XBT_DEBUG("IB callback - action %p finished", action);
index c57f111..d462377 100644 (file)
@@ -102,7 +102,7 @@ double NetworkModel::next_occuring_event_full(double now)
 {
   double minRes = Model::next_occuring_event_full(now);
 
-  for (Action const& action : *get_running_action_set()) {
+  for (Action const& action : *get_started_action_set()) {
     const NetworkAction& net_action = static_cast<const NetworkAction&>(action);
     if (net_action.latency_ > 0)
       minRes = (minRes < 0) ? net_action.latency_ : std::min(minRes, net_action.latency_);
index ce78407..820493b 100644 (file)
@@ -190,7 +190,7 @@ double NetworkNS3Model::next_occuring_event(double now)
   XBT_DEBUG("ns3_next_occuring_event");
 
   //get the first relevant value from the running_actions list
-  if (not get_running_action_set()->size() || now == 0.0)
+  if (not get_started_action_set()->size() || now == 0.0)
     return -1.0;
   else
     do {
@@ -211,7 +211,7 @@ void NetworkNS3Model::update_actions_state(double now, double delta)
   static std::vector<std::string> socket_to_destroy;
 
   /* If there are no running flows, advance the NS3 simulator and return */
-  if (get_running_action_set()->empty()) {
+  if (get_started_action_set()->empty()) {
 
     while(double_positive(now - ns3::Simulator::Now().GetSeconds(), sg_surf_precision))
       ns3_simulator(now-ns3::Simulator::Now().GetSeconds());
@@ -227,7 +227,7 @@ void NetworkNS3Model::update_actions_state(double now, double delta)
     XBT_DEBUG("Processing socket %p (action %p)",sgFlow,action);
     action->set_remains(action->get_cost() - sgFlow->sentBytes_);
 
-    if (TRACE_is_enabled() && action->get_state() == kernel::resource::Action::State::running) {
+    if (TRACE_is_enabled() && action->get_state() == kernel::resource::Action::State::STARTED) {
       double data_delta_sent = sgFlow->sentBytes_ - action->lastSent_;
 
       std::vector<LinkImpl*> route = std::vector<LinkImpl*>();
@@ -243,7 +243,7 @@ void NetworkNS3Model::update_actions_state(double now, double delta)
     if(sgFlow->finished_){
       socket_to_destroy.push_back(ns3Socket);
       XBT_DEBUG("Destroy socket %p of action %p", ns3Socket.c_str(), action);
-      action->finish(kernel::resource::Action::State::done);
+      action->finish(kernel::resource::Action::State::FINISHED);
     } else {
       XBT_DEBUG("Socket %p sent %u bytes out of %u (%u remaining)", ns3Socket.c_str(), sgFlow->sentBytes_,
                 sgFlow->totalBytes_, sgFlow->remaining_);
index 2a2b54a..d1485bf 100644 (file)
@@ -68,7 +68,7 @@ NetworkL07Model::~NetworkL07Model()
 double HostL07Model::next_occuring_event(double now)
 {
   double min = HostModel::next_occuring_event_full(now);
-  for (kernel::resource::Action const& action : *get_running_action_set()) {
+  for (kernel::resource::Action const& action : *get_started_action_set()) {
     const L07Action& net_action = static_cast<const L07Action&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min)) {
       min = net_action.latency_;
@@ -82,7 +82,7 @@ double HostL07Model::next_occuring_event(double now)
 
 void HostL07Model::update_actions_state(double /*now*/, double delta)
 {
-  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
+  for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
     L07Action& action = static_cast<L07Action&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     if (action.latency_ > 0) {
@@ -114,7 +114,7 @@ void HostL07Model::update_actions_state(double /*now*/, double delta)
 
     if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) ||
         ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
-      action.finish(kernel::resource::Action::State::done);
+      action.finish(kernel::resource::Action::State::FINISHED);
     } else {
       /* Need to check that none of the model has failed */
       int i = 0;
@@ -124,7 +124,7 @@ void HostL07Model::update_actions_state(double /*now*/, double delta)
         void* constraint_id = cnst->get_id();
         if (static_cast<simgrid::kernel::resource::Resource*>(constraint_id)->is_off()) {
           XBT_DEBUG("Action (%p) Failed!!", &action);
-          action.finish(kernel::resource::Action::State::failed);
+          action.finish(kernel::resource::Action::State::FAILED);
           break;
         }
         cnst = action.get_variable()->get_constraint(i);
index a36ca2e..c9bcc38 100644 (file)
@@ -68,7 +68,7 @@ double StorageN11Model::next_occuring_event(double now)
 
 void StorageN11Model::update_actions_state(double /*now*/, double delta)
 {
-  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
+  for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) {
     StorageAction& action = static_cast<StorageAction&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     action.update_remains(lrint(action.get_variable()->get_value() * delta));
@@ -78,7 +78,7 @@ void StorageN11Model::update_actions_state(double /*now*/, double delta)
 
     if (((action.get_remains_no_update() <= 0) && (action.get_variable()->get_weight() > 0)) ||
         ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
-      action.finish(kernel::resource::Action::State::done);
+      action.finish(kernel::resource::Action::State::FINISHED);
     }
   }
 }
@@ -132,7 +132,7 @@ StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost,
 
 void StorageN11Action::cancel()
 {
-  set_state(Action::State::failed);
+  set_state(Action::State::FAILED);
 }
 
 void StorageN11Action::suspend()
index 32f0c00..83b24b3 100644 (file)
@@ -161,7 +161,7 @@ static simgrid::kernel::resource::Action* ActionListExtract(simgrid::kernel::res
 
 simgrid::kernel::resource::Action* surf_model_extract_done_action_set(simgrid::kernel::resource::Model* model)
 {
-  return ActionListExtract(model->get_done_action_set());
+  return ActionListExtract(model->get_finished_action_set());
 }
 
 simgrid::kernel::resource::Action* surf_model_extract_failed_action_set(simgrid::kernel::resource::Model* model)
@@ -171,7 +171,7 @@ simgrid::kernel::resource::Action* surf_model_extract_failed_action_set(simgrid:
 
 int surf_model_running_action_set_size(simgrid::kernel::resource::Model* model)
 {
-  return model->get_running_action_set()->size();
+  return model->get_started_action_set()->size();
 }
 
 void surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound)
index 6299c7c..b483226 100644 (file)
@@ -16,15 +16,15 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 static const char* string_action(simgrid::kernel::resource::Action::State state)
 {
   switch (state) {
-    case simgrid::kernel::resource::Action::State::inited:
+    case simgrid::kernel::resource::Action::State::INITED:
       return "SURF_ACTION_INITED";
-    case simgrid::kernel::resource::Action::State::running:
+    case simgrid::kernel::resource::Action::State::STARTED:
       return "SURF_ACTION_RUNNING";
-    case simgrid::kernel::resource::Action::State::failed:
+    case simgrid::kernel::resource::Action::State::FAILED:
       return "SURF_ACTION_FAILED";
-    case simgrid::kernel::resource::Action::State::done:
+    case simgrid::kernel::resource::Action::State::FINISHED:
       return "SURF_ACTION_DONE";
-    case simgrid::kernel::resource::Action::State::ignored:
+    case simgrid::kernel::resource::Action::State::IGNORED:
       return "SURF_ACTION_IGNORED";
     default:
       return "INVALID STATE";
@@ -76,7 +76,7 @@ int main(int argc, char **argv)
       action.unref();
     }
 
-    action_list = surf_cpu_model_pm->get_done_action_set();
+    action_list = surf_cpu_model_pm->get_finished_action_set();
     while (not action_list->empty()) {
       simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   CPU Done action");
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
       action.unref();
     }
 
-    action_list = surf_network_model->get_done_action_set();
+    action_list = surf_network_model->get_finished_action_set();
     while (not action_list->empty()) {
       simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   Network Done action");
@@ -101,7 +101,7 @@ int main(int argc, char **argv)
     }
 
   } while (
-      (surf_network_model->get_running_action_set()->size() || surf_cpu_model_pm->get_running_action_set()->size()) &&
+      (surf_network_model->get_started_action_set()->size() || surf_cpu_model_pm->get_started_action_set()->size()) &&
       surf_solve(-1.0) >= 0.0);
 
   XBT_DEBUG("Simulation Terminated");