Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Action::is_suspended() does not need to be virtual (+ more snake_casing)
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 26 Mar 2018 16:49:05 +0000 (18:49 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 26 Mar 2018 16:49:05 +0000 (18:49 +0200)
include/simgrid/kernel/resource/Action.hpp
src/kernel/lmm/maxmin.cpp
src/kernel/resource/Action.cpp
src/simdag/sd_task.cpp
src/surf/cpu_ti.cpp
src/surf/network_cm02.cpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/ptask_L07.cpp
src/surf/storage_n11.cpp
src/surf/storage_n11.hpp

index f3fa297..7b876d0 100644 (file)
@@ -29,7 +29,7 @@ class XBT_PUBLIC Action {
 public:
   /* Lazy update needs this Set hook to maintain a list of the tracked actions */
   boost::intrusive::list_member_hook<> modified_set_hook_;
 public:
   /* Lazy update needs this Set hook to maintain a list of the tracked actions */
   boost::intrusive::list_member_hook<> modified_set_hook_;
-  bool isLinkedModifiedSet() const { return modified_set_hook_.is_linked(); }
+  bool is_within_modified_set() const { return modified_set_hook_.is_linked(); }
   typedef boost::intrusive::list<
       Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::modified_set_hook_>>
       ModifiedSet;
   typedef boost::intrusive::list<
       Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::modified_set_hook_>>
       ModifiedSet;
@@ -97,7 +97,7 @@ public:
   /** @brief Get the start time of the current action */
   double get_start_time() const { return start_time_; }
   /** @brief Get the finish time of the current action */
   /** @brief Get the start time of the current action */
   double get_start_time() const { return start_time_; }
   /** @brief Get the finish time of the current action */
-  double getFinishTime() const { return finish_time_; }
+  double get_finish_time() const { return finish_time_; }
 
   /** @brief Get the user data associated to the current action */
   void* get_data() const { return data_; }
 
   /** @brief Get the user data associated to the current action */
   void* get_data() const { return data_; }
@@ -133,8 +133,7 @@ public:
   /**@brief Add a reference to the current action (refcounting) */
   void ref();
   /** @brief Unref that action (and destroy it if refcount reaches 0)
   /**@brief Add a reference to the current action (refcounting) */
   void ref();
   /** @brief Unref that action (and destroy it if refcount reaches 0)
-   *  @return true if the action was destroyed and false if someone still has references on it
-   */
+   *  @return true if the action was destroyed and false if someone still has references on it */
   int unref();
 
   /** @brief Cancel the current Action if running */
   int unref();
 
   /** @brief Cancel the current Action if running */
@@ -147,7 +146,7 @@ public:
   virtual void resume();
 
   /** @brief Returns true if the current action is running */
   virtual void resume();
 
   /** @brief Returns true if the current action is running */
-  virtual bool isSuspended();
+  bool is_suspended();
 
   /** @brief Get the maximum duration of the current action */
   double get_max_duration() const { return max_duration_; }
 
   /** @brief Get the maximum duration of the current action */
   double get_max_duration() const { return max_duration_; }
index aace67e..8bd4eca 100644 (file)
@@ -536,7 +536,7 @@ template <class CnstList> void System::solve(CnstList& cnst_list)
 
         elem.make_active();
         simgrid::kernel::resource::Action* action = static_cast<simgrid::kernel::resource::Action*>(elem.variable->id);
 
         elem.make_active();
         simgrid::kernel::resource::Action* action = static_cast<simgrid::kernel::resource::Action*>(elem.variable->id);
-        if (modified_set_ && not action->isLinkedModifiedSet())
+        if (modified_set_ && not action->is_within_modified_set())
           modified_set_->push_back(*action);
       }
     }
           modified_set_->push_back(*action);
       }
     }
index a0ad4e1..3fd917c 100644 (file)
@@ -184,7 +184,7 @@ void Action::resume()
   XBT_OUT();
 }
 
   XBT_OUT();
 }
 
-bool Action::isSuspended()
+bool Action::is_suspended()
 {
   return suspended_ == SuspendStates::suspended;
 }
 {
   return suspended_ == SuspendStates::suspended;
 }
index dcc5b11..a6c81da 100644 (file)
@@ -289,7 +289,7 @@ void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state)
     sd_global->completed_tasks->insert(task);
     task->start_time = task->surf_action->get_start_time();
     if (new_state == SD_DONE){
     sd_global->completed_tasks->insert(task);
     task->start_time = task->surf_action->get_start_time();
     if (new_state == SD_DONE){
-      task->finish_time = task->surf_action->getFinishTime();
+      task->finish_time = task->surf_action->get_finish_time();
 #if SIMGRID_HAVE_JEDULE
       jedule_log_sd_event(task);
 #endif
 #if SIMGRID_HAVE_JEDULE
       jedule_log_sd_event(task);
 #endif
@@ -848,7 +848,7 @@ double SD_task_get_start_time(SD_task_t task)
 double SD_task_get_finish_time(SD_task_t task)
 {
   if (task->surf_action)        /* should never happen as actions are destroyed right after their completion */
 double SD_task_get_finish_time(SD_task_t task)
 {
   if (task->surf_action)        /* should never happen as actions are destroyed right after their completion */
-    return task->surf_action->getFinishTime();
+    return task->surf_action->get_finish_time();
   else
     return task->finish_time;
 }
   else
     return task->finish_time;
 }
index 5f63aa3..1fb74c0 100644 (file)
@@ -494,10 +494,10 @@ void CpuTi::updateActionsFinishTime(double now)
       action.set_finish_time(speedIntegratedTrace_->solve(now, total_area));
       /* verify which event will happen before (max_duration or finish time) */
       if (action.get_max_duration() > NO_MAX_DURATION &&
       action.set_finish_time(speedIntegratedTrace_->solve(now, total_area));
       /* verify which event will happen before (max_duration or finish time) */
       if (action.get_max_duration() > NO_MAX_DURATION &&
-          action.get_start_time() + action.get_max_duration() < action.getFinishTime())
+          action.get_start_time() + action.get_max_duration() < action.get_finish_time())
         min_finish = action.get_start_time() + action.get_max_duration();
       else
         min_finish = action.get_start_time() + action.get_max_duration();
       else
-        min_finish = action.getFinishTime();
+        min_finish = action.get_finish_time();
     } else {
       /* put the max duration time on heap */
       if (action.get_max_duration() > NO_MAX_DURATION)
     } else {
       /* put the max duration time on heap */
       if (action.get_max_duration() > NO_MAX_DURATION)
@@ -510,7 +510,7 @@ void CpuTi::updateActionsFinishTime(double now)
       action.heapRemove(model()->getActionHeap());
 
     XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", getCname(),
       action.heapRemove(model()->getActionHeap());
 
     XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", getCname(),
-              &action, action.get_start_time(), action.getFinishTime(), action.get_max_duration());
+              &action, action.get_start_time(), action.get_finish_time(), action.get_max_duration());
   }
   /* remove from modified cpu */
   modified(false);
   }
   /* remove from modified cpu */
   modified(false);
@@ -556,7 +556,7 @@ void CpuTi::updateRemainingAmount(double now)
       continue;
 
     /* skip action that are finishing now */
       continue;
 
     /* skip action that are finishing now */
-    if (action.getFinishTime() >= 0 && action.getFinishTime() <= now)
+    if (action.get_finish_time() >= 0 && action.get_finish_time() <= now)
       continue;
 
     /* update remaining */
       continue;
 
     /* update remaining */
@@ -676,10 +676,10 @@ void CpuTiAction::set_max_duration(double duration)
   Action::set_max_duration(duration);
 
   if (duration >= 0)
   Action::set_max_duration(duration);
 
   if (duration >= 0)
-    min_finish = (get_start_time() + get_max_duration()) < getFinishTime() ? (get_start_time() + get_max_duration())
-                                                                           : getFinishTime();
+    min_finish = (get_start_time() + get_max_duration()) < get_finish_time() ? (get_start_time() + get_max_duration())
+                                                                             : get_finish_time();
   else
   else
-    min_finish = getFinishTime();
+    min_finish = get_finish_time();
 
   /* add in action heap */
   heapUpdate(get_model()->getActionHeap(), min_finish, Action::Type::NOTSET);
 
   /* add in action heap */
   heapUpdate(get_model()->getActionHeap(), min_finish, Action::Type::NOTSET);
index 6e7e60b..87c2993 100644 (file)
@@ -222,7 +222,7 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
         double_update(&deltap, action.latency_, sg_surf_precision);
         action.latency_ = 0.0;
       }
         double_update(&deltap, action.latency_, sg_surf_precision);
         action.latency_ = 0.0;
       }
-      if (action.latency_ <= 0.0 && not action.isSuspended())
+      if (action.latency_ <= 0.0 && not action.is_suspended())
         maxmin_system_->update_variable_weight(action.getVariable(), action.weight_);
     }
     if (TRACE_is_enabled()) {
         maxmin_system_->update_variable_weight(action.getVariable(), action.weight_);
     }
     if (TRACE_is_enabled()) {
@@ -419,7 +419,7 @@ void NetworkCm02Link::setBandwidth(double value)
     while ((var = constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
       NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
       action->weight_ += delta;
     while ((var = constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
       NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
       action->weight_ += delta;
-      if (not action->isSuspended())
+      if (not action->is_suspended())
         model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_);
     }
   }
         model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_);
     }
   }
@@ -452,7 +452,7 @@ void NetworkCm02Link::setLatency(double value)
         XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->latCurrent_);
       }
     }
         XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->latCurrent_);
       }
     }
-    if (not action->isSuspended())
+    if (not action->is_suspended())
       model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_);
   }
 }
       model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_);
   }
 }
index b041a13..a11bc1f 100644 (file)
@@ -344,12 +344,6 @@ void NetworkNS3Action::update_remains_lazy(double /*now*/)
   THROW_IMPOSSIBLE;
 }
 
   THROW_IMPOSSIBLE;
 }
 
-/* Test whether a flow is suspended */
-bool NetworkNS3Action::isSuspended()
-{
-  return false;
-}
-
 }
 }
 
 }
 }
 
index 15d4f5f..a180ed2 100644 (file)
@@ -47,7 +47,6 @@ class XBT_PRIVATE NetworkNS3Action : public NetworkAction {
 public:
   NetworkNS3Action(kernel::resource::Model* model, double cost, s4u::Host* src, s4u::Host* dst);
 
 public:
   NetworkNS3Action(kernel::resource::Model* model, double cost, s4u::Host* src, s4u::Host* dst);
 
-  bool isSuspended() override;
   void suspend() override;
   void resume() override;
   std::list<LinkImpl*> links() override;
   void suspend() override;
   void resume() override;
   std::list<LinkImpl*> links() override;
index b670036..9e80916 100644 (file)
@@ -93,7 +93,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
       } else {
         action.latency_ = 0.0;
       }
       } else {
         action.latency_ = 0.0;
       }
-      if ((action.latency_ <= 0.0) && (action.isSuspended() == 0)) {
+      if ((action.latency_ <= 0.0) && (action.is_suspended() == 0)) {
         action.updateBound();
         maxmin_system_->update_variable_weight(action.getVariable(), 1.0);
       }
         action.updateBound();
         maxmin_system_->update_variable_weight(action.getVariable(), 1.0);
       }
index 5fb3125..68b0ca3 100644 (file)
@@ -159,11 +159,6 @@ void StorageN11Action::resume()
   THROW_UNIMPLEMENTED;
 }
 
   THROW_UNIMPLEMENTED;
 }
 
-bool StorageN11Action::isSuspended()
-{
-  return suspended_ == Action::SuspendStates::suspended;
-}
-
 void StorageN11Action::set_max_duration(double /*duration*/)
 {
   THROW_UNIMPLEMENTED;
 void StorageN11Action::set_max_duration(double /*duration*/)
 {
   THROW_UNIMPLEMENTED;
index 0570669..dfcd33e 100644 (file)
@@ -57,7 +57,6 @@ public:
   void suspend() override;
   void cancel() override;
   void resume() override;
   void suspend() override;
   void cancel() override;
   void resume() override;
-  bool isSuspended() override;
   void set_max_duration(double duration) override;
   void set_priority(double priority) override;
   void update_remains_lazy(double now) override;
   void set_max_duration(double duration) override;
   void set_priority(double priority) override;
   void update_remains_lazy(double now) override;