Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 27 Mar 2018 06:14:24 +0000 (08:14 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 27 Mar 2018 06:14:24 +0000 (08:14 +0200)
21 files changed:
include/simgrid/kernel/resource/Action.hpp
src/kernel/lmm/maxmin.cpp
src/kernel/resource/Action.cpp
src/kernel/resource/Model.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/simdag/sd_task.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_ib.cpp
src/surf/network_interface.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 20e877c..4961cef 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_;
-  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;
@@ -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 */
-  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_; }
@@ -117,6 +117,8 @@ public:
    *  @param delta Amount to remove from the remaining time */
   void update_remains(double delta);
 
+  virtual void update_remains_lazy(double now) = 0;
+
   /** @brief Set the remaining time of the current action */
   void set_remains(double value) { remains_ = value; }
 
@@ -131,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)
-   *  @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 */
@@ -145,7 +146,7 @@ public:
   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_; }
@@ -177,34 +178,36 @@ private:
   double max_duration_   = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
   double remains_;           /**< How much of that cost remains to be done in the currently running task */
   double start_time_;        /**< start time  */
-  char* category_ = nullptr; /**< tracing category for categorized resource utilization monitoring */
-  double finish_time_ =
-      -1; /**< finish time : this is modified during the run and fluctuates until the task is completed */
+  double finish_time_ = -1;  /**< finish time (may fluctuate until the task is completed) */
+  char* category_     = nullptr; /**< tracing category for categorized resource utilization monitoring */
 
   double cost_;
   simgrid::kernel::resource::Model* model_;
   void* data_ = nullptr; /**< for your convenience */
 
   /* LMM */
-  double last_update_                                  = 0;
-  double last_value_                                   = 0;
-  kernel::lmm::Variable* variable_                    = nullptr;
-  Action::Type type_                                  = Action::Type::NOTSET;
-  boost::optional<heap_type::handle_type> heap_handle_ = boost::none;
+  double last_update_                                = 0;
+  double last_value_                                 = 0;
+  kernel::lmm::Variable* variable_                   = nullptr;
+  Action::Type type_                                 = Action::Type::NOTSET;
+  boost::optional<heap_type::handle_type> heap_hook_ = boost::none;
 
 public:
-  virtual void updateRemainingLazy(double now) = 0;
-  void heapInsert(heap_type& heap, double key, Action::Type hat);
-  void heapRemove(heap_type& heap);
-  void heapUpdate(heap_type& heap, double key, Action::Type hat);
-  void clearHeapHandle() { heap_handle_ = boost::none; }
-  kernel::lmm::Variable* getVariable() const { return variable_; }
-  void setVariable(kernel::lmm::Variable* var) { variable_ = var; }
-  double getLastUpdate() const { return last_update_; }
-  void refreshLastUpdate();
-  double getLastValue() const { return last_value_; }
-  void setLastValue(double val) { last_value_ = val; }
-  Action::Type getType() const { return type_; }
+  void heapInsert(double key, Action::Type hat);
+  void heapRemove();
+  void heapUpdate(double key, Action::Type hat);
+  void clearHeapHandle() { heap_hook_ = boost::none; }
+
+  lmm::Variable* get_variable() const { return variable_; }
+  void set_variable(lmm::Variable* var) { variable_ = var; }
+
+  double get_last_update() const { return last_update_; }
+  void set_last_update();
+
+  double get_last_value() const { return last_value_; }
+  void set_last_value(double val) { last_value_ = val; }
+
+  Action::Type get_type() const { return type_; }
 
 protected:
   Action::SuspendStates suspended_ = Action::SuspendStates::not_suspended;
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);
-        if (modified_set_ && not action->isLinkedModifiedSet())
+        if (modified_set_ && not action->is_within_modified_set())
           modified_set_->push_back(*action);
       }
     }
index bac3a43..52a857c 100644 (file)
@@ -34,11 +34,11 @@ Action::~Action()
 {
   if (state_set_hook_.is_linked())
     simgrid::xbt::intrusive_erase(*state_set_, *this);
-  if (getVariable())
-    get_model()->getMaxminSystem()->variable_free(getVariable());
+  if (get_variable())
+    get_model()->getMaxminSystem()->variable_free(get_variable());
   if (get_model()->getUpdateMechanism() == UM_LAZY) {
     /* remove from heap */
-    heapRemove(get_model()->getActionHeap());
+    heapRemove();
     if (modified_set_hook_.is_linked())
       simgrid::xbt::intrusive_erase(*get_model()->getModifiedSet(), *this);
   }
@@ -101,8 +101,8 @@ void Action::set_bound(double bound)
   if (variable_)
     get_model()->getMaxminSystem()->update_variable_bound(variable_, bound);
 
-  if (get_model()->getUpdateMechanism() == UM_LAZY && getLastUpdate() != surf_get_clock())
-    heapRemove(get_model()->getActionHeap());
+  if (get_model()->getUpdateMechanism() == UM_LAZY && get_last_update() != surf_get_clock())
+    heapRemove();
   XBT_OUT();
 }
 
@@ -120,17 +120,17 @@ void Action::set_max_duration(double duration)
 {
   max_duration_ = duration;
   if (get_model()->getUpdateMechanism() == UM_LAZY) // remove action from the heap
-    heapRemove(get_model()->getActionHeap());
+    heapRemove();
 }
 
 void Action::set_priority(double weight)
 {
   XBT_IN("(%p,%g)", this, weight);
   sharing_priority_ = weight;
-  get_model()->getMaxminSystem()->update_variable_weight(getVariable(), weight);
+  get_model()->getMaxminSystem()->update_variable_weight(get_variable(), weight);
 
   if (get_model()->getUpdateMechanism() == UM_LAZY)
-    heapRemove(get_model()->getActionHeap());
+    heapRemove();
   XBT_OUT();
 }
 
@@ -140,7 +140,7 @@ void Action::cancel()
   if (get_model()->getUpdateMechanism() == UM_LAZY) {
     if (modified_set_hook_.is_linked())
       simgrid::xbt::intrusive_erase(*get_model()->getModifiedSet(), *this);
-    heapRemove(get_model()->getActionHeap());
+    heapRemove();
   }
 }
 
@@ -158,13 +158,12 @@ void Action::suspend()
 {
   XBT_IN("(%p)", this);
   if (suspended_ != SuspendStates::sleeping) {
-    get_model()->getMaxminSystem()->update_variable_weight(getVariable(), 0.0);
+    get_model()->getMaxminSystem()->update_variable_weight(get_variable(), 0.0);
     if (get_model()->getUpdateMechanism() == UM_LAZY) {
-      heapRemove(get_model()->getActionHeap());
-      if (get_model()->getUpdateMechanism() == UM_LAZY && state_set_ == get_model()->getRunningActionSet() &&
-          sharing_priority_ > 0) {
+      heapRemove();
+      if (state_set_ == get_model()->getRunningActionSet() && sharing_priority_ > 0) {
         // If we have a lazy model, we need to update the remaining value accordingly
-        updateRemainingLazy(surf_get_clock());
+        update_remains_lazy(surf_get_clock());
       }
     }
     suspended_ = SuspendStates::suspended;
@@ -176,15 +175,15 @@ void Action::resume()
 {
   XBT_IN("(%p)", this);
   if (suspended_ != SuspendStates::sleeping) {
-    get_model()->getMaxminSystem()->update_variable_weight(getVariable(), get_priority());
+    get_model()->getMaxminSystem()->update_variable_weight(get_variable(), get_priority());
     suspended_ = SuspendStates::not_suspended;
     if (get_model()->getUpdateMechanism() == UM_LAZY)
-      heapRemove(get_model()->getActionHeap());
+      heapRemove();
   }
   XBT_OUT();
 }
 
-bool Action::isSuspended()
+bool Action::is_suspended()
 {
   return suspended_ == SuspendStates::suspended;
 }
@@ -195,28 +194,28 @@ bool Action::isSuspended()
  * LATENCY = this is a heap entry to warn us when the latency is payed
  * MAX_DURATION =this is a heap entry to warn us when the max_duration limit is reached
  */
-void Action::heapInsert(heap_type& heap, double key, Action::Type hat)
+void Action::heapInsert(double key, Action::Type hat)
 {
   type_       = hat;
-  heap_handle_ = heap.emplace(std::make_pair(key, this));
+  heap_hook_  = get_model()->getActionHeap().emplace(std::make_pair(key, this));
 }
 
-void Action::heapRemove(heap_type& heap)
+void Action::heapRemove()
 {
   type_ = Action::Type::NOTSET;
-  if (heap_handle_) {
-    heap.erase(*heap_handle_);
+  if (heap_hook_) {
+    get_model()->getActionHeap().erase(*heap_hook_);
     clearHeapHandle();
   }
 }
 
-void Action::heapUpdate(heap_type& heap, double key, Action::Type hat)
+void Action::heapUpdate(double key, Action::Type hat)
 {
   type_ = hat;
-  if (heap_handle_) {
-    heap.update(*heap_handle_, std::make_pair(key, this));
+  if (heap_hook_) {
+    get_model()->getActionHeap().update(*heap_hook_, std::make_pair(key, this));
   } else {
-    heap_handle_ = heap.emplace(std::make_pair(key, this));
+    heap_hook_ = get_model()->getActionHeap().emplace(std::make_pair(key, this));
   }
 }
 
@@ -225,7 +224,7 @@ double Action::get_remains()
   XBT_IN("(%p)", this);
   /* update remains before return it */
   if (get_model()->getUpdateMechanism() == UM_LAZY) /* update remains before return it */
-    updateRemainingLazy(surf_get_clock());
+    update_remains_lazy(surf_get_clock());
   XBT_OUT();
   return remains_;
 }
@@ -239,7 +238,7 @@ void Action::update_remains(double delta)
   double_update(&remains_, delta, sg_maxmin_precision * sg_surf_precision);
 }
 
-void Action::refreshLastUpdate()
+void Action::set_last_update()
 {
   last_update_ = surf_get_clock();
 }
index 77560d6..c257fff 100644 (file)
@@ -62,13 +62,13 @@ double Model::nextOccuringEventLazy(double now)
       continue;
 
     /* bogus priority, skip it */
-    if (action->get_priority() <= 0 || action->getType() == Action::Type::LATENCY)
+    if (action->get_priority() <= 0 || action->get_type() == Action::Type::LATENCY)
       continue;
 
-    action->updateRemainingLazy(now);
+    action->update_remains_lazy(now);
 
     double min   = -1;
-    double share = action->getVariable()->get_value();
+    double share = action->get_variable()->get_value();
 
     if (share > 0) {
       double time_to_completion;
@@ -87,13 +87,13 @@ double Model::nextOccuringEventLazy(double now)
       max_dur_flag = true;
     }
 
-    XBT_DEBUG("Action(%p) corresponds to variable %d", action, action->getVariable()->id_int);
+    XBT_DEBUG("Action(%p) corresponds to variable %d", action, action->get_variable()->id_int);
 
     XBT_DEBUG("Action(%p) Start %f. May finish at %f (got a share of %f). Max_duration %f", action,
               action->get_start_time(), min, share, action->get_max_duration());
 
     if (min > -1) {
-      action->heapUpdate(action_heap_, min, max_dur_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
+      action->heapUpdate(min, max_dur_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
       XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min, now);
     } else
       DIE_IMPOSSIBLE;
@@ -117,7 +117,7 @@ double Model::nextOccuringEventFull(double /*now*/)
   double min = -1;
 
   for (Action& action : *getRunningActionSet()) {
-    double value = action.getVariable()->get_value();
+    double value = action.get_variable()->get_value();
     if (value > 0) {
       if (action.get_remains() > 0)
         value = action.get_remains_no_update() / value;
index da17d4a..4a3881d 100644 (file)
@@ -92,8 +92,9 @@ double VMModel::nextOccuringEvent(double now)
     surf::Cpu* cpu = ws_vm->pimpl_cpu;
     xbt_assert(cpu, "cpu-less host");
 
-    double solved_value = ws_vm->getImpl()->action_->getVariable()->get_value(); // this is X1 in comment above, what
-                                                                                 // this VM got in the sharing on the PM
+    double solved_value =
+        ws_vm->getImpl()->action_->get_variable()->get_value(); // this is X1 in comment above, what
+                                                                // this VM got in the sharing on the PM
     XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getCname(), ws_vm->getPm()->getCname());
 
     xbt_assert(cpu->model() == surf_cpu_model_vm);
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){
-      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
@@ -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 */
-    return task->surf_action->getFinishTime();
+    return task->surf_action->get_finish_time();
   else
     return task->finish_time;
 }
index de1baf8..b19c922 100644 (file)
@@ -100,7 +100,7 @@ void CpuCas01::onSpeedChange() {
   while ((var = constraint()->get_variable(&elem))) {
     CpuCas01Action* action = static_cast<CpuCas01Action*>(var->get_id());
 
-    model()->getMaxminSystem()->update_variable_bound(action->getVariable(),
+    model()->getMaxminSystem()->update_variable_bound(action->get_variable(),
                                                       action->requestedCore() * speed_.scale * speed_.peak);
   }
 
@@ -180,9 +180,9 @@ CpuAction *CpuCas01::sleep(double duration)
     action->get_state_set()->push_back(*action);
   }
 
-  model()->getMaxminSystem()->update_variable_weight(action->getVariable(), 0.0);
+  model()->getMaxminSystem()->update_variable_weight(action->get_variable(), 0.0);
   if (model()->getUpdateMechanism() == UM_LAZY) { // remove action from the heap
-    action->heapRemove(model()->getActionHeap());
+    action->heapRemove();
     // this is necessary for a variable with weight 0 since such variables are ignored in lmm and we need to set its
     // max_duration correctly at the next call to share_resources
     model()->getModifiedSet()->push_front(*action);
@@ -202,10 +202,10 @@ CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool
     , requestedCore_(requestedCore)
 {
   if (model->getUpdateMechanism() == UM_LAZY) {
-    refreshLastUpdate();
-    setLastValue(0.0);
+    set_last_update();
+    set_last_value(0.0);
   }
-  model->getMaxminSystem()->expand(constraint, getVariable(), 1.0);
+  model->getMaxminSystem()->expand(constraint, get_variable(), 1.0);
 }
 
 CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
index d854732..4307bd8 100644 (file)
@@ -27,24 +27,21 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
     CpuAction* action = static_cast<CpuAction*>(actionHeapPop());
     XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
     if (TRACE_is_enabled()) {
-      Cpu* cpu = static_cast<Cpu*>(action->getVariable()->get_constraint(0)->get_id());
-      TRACE_surf_host_set_utilization(cpu->getCname(), action->get_category(), action->getVariable()->get_value(),
-                                      action->getLastUpdate(), now - action->getLastUpdate());
+      Cpu* cpu = static_cast<Cpu*>(action->get_variable()->get_constraint(0)->get_id());
+      TRACE_surf_host_set_utilization(cpu->getCname(), action->get_category(), action->get_variable()->get_value(),
+                                      action->get_last_update(), now - action->get_last_update());
     }
 
     action->finish(kernel::resource::Action::State::done);
     XBT_CDEBUG(surf_kernel, "Action %p finished", action);
-
-    /* set the remains to 0 due to precision problems when updating the remaining amount */
-    action->set_remains(0);
   }
   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 : *getRunningActionSet()) {
-      if (smaller < 0 || action.getLastUpdate() < smaller)
-        smaller = action.getLastUpdate();
+      if (smaller < 0 || action.get_last_update() < smaller)
+        smaller = action.get_last_update();
     }
     if (smaller > 0) {
       TRACE_last_timestamp_to_dump = smaller;
@@ -58,18 +55,18 @@ void CpuModel::updateActionsStateFull(double now, double delta)
     CpuAction& action = static_cast<CpuAction&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     if (TRACE_is_enabled()) {
-      Cpu* cpu = static_cast<Cpu*>(action.getVariable()->get_constraint(0)->get_id());
-      TRACE_surf_host_set_utilization(cpu->getCname(), action.get_category(), action.getVariable()->get_value(),
+      Cpu* cpu = static_cast<Cpu*>(action.get_variable()->get_constraint(0)->get_id());
+      TRACE_surf_host_set_utilization(cpu->getCname(), action.get_category(), action.get_variable()->get_value(),
                                       now - delta, delta);
       TRACE_last_timestamp_to_dump = now - delta;
     }
 
-    action.update_remains(action.getVariable()->get_value() * delta);
+    action.update_remains(action.get_variable()->get_value() * delta);
 
     if (action.get_max_duration() != NO_MAX_DURATION)
       action.update_max_duration(delta);
 
-    if (((action.get_remains_no_update() <= 0) && (action.getVariable()->get_weight() > 0)) ||
+    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);
     }
@@ -173,28 +170,28 @@ void Cpu::setSpeedTrace(tmgr_trace_t trace)
  * Action *
  **********/
 
-void CpuAction::updateRemainingLazy(double now)
+void CpuAction::update_remains_lazy(double now)
 {
   xbt_assert(get_state_set() == get_model()->getRunningActionSet(), "You're updating an action that is not running.");
   xbt_assert(get_priority() > 0, "You're updating an action that seems suspended.");
 
-  double delta = now - getLastUpdate();
+  double delta = now - get_last_update();
 
   if (get_remains_no_update() > 0) {
     XBT_CDEBUG(surf_kernel, "Updating action(%p): remains was %f, last_update was: %f", this, get_remains_no_update(),
-               getLastUpdate());
-    update_remains(getLastValue() * delta);
+               get_last_update());
+    update_remains(get_last_value() * delta);
 
     if (TRACE_is_enabled()) {
-      Cpu* cpu = static_cast<Cpu*>(getVariable()->get_constraint(0)->get_id());
-      TRACE_surf_host_set_utilization(cpu->getCname(), get_category(), getLastValue(), getLastUpdate(),
-                                      now - getLastUpdate());
+      Cpu* cpu = static_cast<Cpu*>(get_variable()->get_constraint(0)->get_id());
+      TRACE_surf_host_set_utilization(cpu->getCname(), get_category(), get_last_value(), get_last_update(),
+                                      now - get_last_update());
     }
     XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, get_remains_no_update());
   }
 
-  refreshLastUpdate();
-  setLastValue(getVariable()->get_value());
+  set_last_update();
+  set_last_value(get_variable()->get_value());
 }
 
 simgrid::xbt::signal<void(simgrid::surf::CpuAction*, kernel::resource::Action::State)> CpuAction::onStateChange;
@@ -220,13 +217,13 @@ void CpuAction::set_state(Action::State state)
 /** @brief returns a list of all CPUs that this action is using */
 std::list<Cpu*> CpuAction::cpus() {
   std::list<Cpu*> retlist;
-  int llen = getVariable()->get_number_of_constraint();
+  int llen = get_variable()->get_number_of_constraint();
 
   for (int i = 0; i < llen; i++) {
     /* Beware of composite actions: ptasks put links and cpus together */
     // extra pb: we cannot dynamic_cast from void*...
     kernel::resource::Resource* resource =
-        static_cast<kernel::resource::Resource*>(getVariable()->get_constraint(i)->get_id());
+        static_cast<kernel::resource::Resource*>(get_variable()->get_constraint(i)->get_id());
     Cpu* cpu           = dynamic_cast<Cpu*>(resource);
     if (cpu != nullptr)
       retlist.push_back(cpu);
index c642170..8b66b85 100644 (file)
@@ -163,7 +163,7 @@ public:
 
   void set_state(simgrid::kernel::resource::Action::State state) override;
 
-  void updateRemainingLazy(double now) override;
+  void update_remains_lazy(double now) override;
   std::list<Cpu*> cpus();
   
   void suspend() override;
index c2b3eb6..f4db720 100644 (file)
@@ -362,8 +362,6 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/)
     CpuTiAction* action = static_cast<CpuTiAction*>(actionHeapPop());
     XBT_DEBUG("Action %p: finish", action);
     action->finish(kernel::resource::Action::State::done);
-    /* set the remains to 0 due to precision problems when updating the remaining amount */
-    action->set_remains(0);
     /* update remaining amount of all actions */
     action->cpu_->updateRemainingAmount(surf_get_clock());
   }
@@ -444,7 +442,7 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value)
             action.get_state() == kernel::resource::Action::State::not_in_the_system) {
           action.set_finish_time(date);
           action.set_state(kernel::resource::Action::State::failed);
-          action.heapRemove(model()->getActionHeap());
+          action.heapRemove();
         }
       }
     }
@@ -496,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.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.getFinishTime();
+        min_finish = action.get_finish_time();
     } else {
       /* put the max duration time on heap */
       if (action.get_max_duration() > NO_MAX_DURATION)
@@ -507,12 +505,12 @@ void CpuTi::updateActionsFinishTime(double now)
     }
     /* add in action heap */
     if (min_finish > NO_MAX_DURATION)
-      action.heapUpdate(model()->getActionHeap(), min_finish, kernel::resource::Action::Type::NOTSET);
+      action.heapUpdate(min_finish, kernel::resource::Action::Type::NOTSET);
     else
-      action.heapRemove(model()->getActionHeap());
+      action.heapRemove();
 
     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);
@@ -558,7 +556,7 @@ void CpuTi::updateRemainingAmount(double 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 */
@@ -631,7 +629,7 @@ CpuTiAction::~CpuTiAction()
   if (action_ti_hook.is_linked())
     simgrid::xbt::intrusive_erase(cpu_->actionSet_, *this);
   /* remove from heap */
-  heapRemove(get_model()->getActionHeap());
+  heapRemove();
   cpu_->modified(true);
 }
 
@@ -644,7 +642,7 @@ void CpuTiAction::set_state(Action::State state)
 void CpuTiAction::cancel()
 {
   this->set_state(Action::State::failed);
-  heapRemove(get_model()->getActionHeap());
+  heapRemove();
   cpu_->modified(true);
 }
 
@@ -653,7 +651,7 @@ void CpuTiAction::suspend()
   XBT_IN("(%p)", this);
   if (suspended_ != Action::SuspendStates::sleeping) {
     suspended_ = Action::SuspendStates::suspended;
-    heapRemove(get_model()->getActionHeap());
+    heapRemove();
     cpu_->modified(true);
   }
   XBT_OUT();
@@ -678,13 +676,13 @@ void CpuTiAction::set_max_duration(double duration)
   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
-    min_finish = getFinishTime();
+    min_finish = get_finish_time();
 
   /* add in action heap */
-  heapUpdate(get_model()->getActionHeap(), min_finish, Action::Type::NOTSET);
+  heapUpdate(min_finish, Action::Type::NOTSET);
 
   XBT_OUT();
 }
index b5af233..01a14ea 100644 (file)
@@ -176,33 +176,32 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
     NetworkCm02Action* action = static_cast<NetworkCm02Action*>(actionHeapPop());
     XBT_DEBUG("Something happened to action %p", action);
     if (TRACE_is_enabled()) {
-      int n = action->getVariable()->get_number_of_constraint();
+      int n = action->get_variable()->get_number_of_constraint();
 
       for (int i = 0; i < n; i++){
-        kernel::lmm::Constraint* constraint = action->getVariable()->get_constraint(i);
+        kernel::lmm::Constraint* constraint = action->get_variable()->get_constraint(i);
         NetworkCm02Link* link       = static_cast<NetworkCm02Link*>(constraint->get_id());
-        double value = action->getVariable()->get_value() * action->getVariable()->get_constraint_weight(i);
-        TRACE_surf_link_set_utilization(link->getCname(), action->get_category(), value, action->getLastUpdate(),
-                                        now - action->getLastUpdate());
+        double value = action->get_variable()->get_value() * action->get_variable()->get_constraint_weight(i);
+        TRACE_surf_link_set_utilization(link->getCname(), action->get_category(), value, action->get_last_update(),
+                                        now - action->get_last_update());
       }
     }
 
     // if I am wearing a latency hat
-    if (action->getType() == kernel::resource::Action::Type::LATENCY) {
+    if (action->get_type() == kernel::resource::Action::Type::LATENCY) {
       XBT_DEBUG("Latency paid for action %p. Activating", action);
-      maxmin_system_->update_variable_weight(action->getVariable(), action->weight_);
-      action->heapRemove(getActionHeap());
-      action->refreshLastUpdate();
+      maxmin_system_->update_variable_weight(action->get_variable(), action->weight_);
+      action->heapRemove();
+      action->set_last_update();
 
-        // if I am wearing a max_duration or normal hat
-    } else if (action->getType() == kernel::resource::Action::Type::MAX_DURATION ||
-               action->getType() == kernel::resource::Action::Type::NORMAL) {
+      // if I am wearing a max_duration or normal hat
+    } else if (action->get_type() == kernel::resource::Action::Type::MAX_DURATION ||
+               action->get_type() == kernel::resource::Action::Type::NORMAL) {
       // no need to communicate anymore
       // assume that flows that reached max_duration have remaining of 0
       XBT_DEBUG("Action %p finished", action);
-      action->set_remains(0);
       action->finish(kernel::resource::Action::State::done);
-      action->heapRemove(getActionHeap());
+      action->heapRemove();
     }
   }
 }
@@ -223,32 +222,32 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
         double_update(&deltap, action.latency_, sg_surf_precision);
         action.latency_ = 0.0;
       }
-      if (action.latency_ <= 0.0 && not action.isSuspended())
-        maxmin_system_->update_variable_weight(action.getVariable(), action.weight_);
+      if (action.latency_ <= 0.0 && not action.is_suspended())
+        maxmin_system_->update_variable_weight(action.get_variable(), action.weight_);
     }
     if (TRACE_is_enabled()) {
-      int n = action.getVariable()->get_number_of_constraint();
+      int n = action.get_variable()->get_number_of_constraint();
       for (int i = 0; i < n; i++) {
-        kernel::lmm::Constraint* constraint = action.getVariable()->get_constraint(i);
+        kernel::lmm::Constraint* constraint = action.get_variable()->get_constraint(i);
         NetworkCm02Link* link = static_cast<NetworkCm02Link*>(constraint->get_id());
         TRACE_surf_link_set_utilization(
             link->getCname(), action.get_category(),
-            (action.getVariable()->get_value() * action.getVariable()->get_constraint_weight(i)),
-            action.getLastUpdate(), now - action.getLastUpdate());
+            (action.get_variable()->get_value() * action.get_variable()->get_constraint_weight(i)),
+            action.get_last_update(), now - action.get_last_update());
       }
     }
-    if (not action.getVariable()->get_number_of_constraint()) {
+    if (not action.get_variable()->get_number_of_constraint()) {
       /* There is actually no link used, hence an infinite bandwidth. This happens often when using models like
        * vivaldi. In such case, just make sure that the action completes immediately.
        */
       action.update_remains(action.get_remains());
     }
-    action.update_remains(action.getVariable()->get_value() * delta);
+    action.update_remains(action.get_variable()->get_value() * delta);
 
     if (action.get_max_duration() > NO_MAX_DURATION)
       action.update_max_duration(delta);
 
-    if (((action.get_remains() <= 0) && (action.getVariable()->get_weight() > 0)) ||
+    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);
     }
@@ -285,7 +284,7 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos
   action->latency_ = latency;
   action->rate_ = rate;
   if (getUpdateMechanism() == UM_LAZY) {
-    action->refreshLastUpdate();
+    action->set_last_update();
   }
 
   double bandwidth_bound = -1.0;
@@ -306,34 +305,34 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos
   constraints_per_variable += back_route.size();
 
   if (action->latency_ > 0) {
-    action->setVariable(maxmin_system_->variable_new(action, 0.0, -1.0, constraints_per_variable));
+    action->set_variable(maxmin_system_->variable_new(action, 0.0, -1.0, constraints_per_variable));
     if (getUpdateMechanism() == UM_LAZY) {
       // add to the heap the event when the latency is payed
-      XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->getLastUpdate());
-      action->heapInsert(getActionHeap(), action->latency_ + action->getLastUpdate(),
-                         route.empty() ? kernel::resource::Action::Type::NORMAL
-                                       : kernel::resource::Action::Type::LATENCY);
+      XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->get_last_update());
+      action->heapInsert(action->latency_ + action->get_last_update(), route.empty()
+                                                                           ? kernel::resource::Action::Type::NORMAL
+                                                                           : kernel::resource::Action::Type::LATENCY);
     }
   } else
-    action->setVariable(maxmin_system_->variable_new(action, 1.0, -1.0, constraints_per_variable));
+    action->set_variable(maxmin_system_->variable_new(action, 1.0, -1.0, constraints_per_variable));
 
   if (action->rate_ < 0) {
     maxmin_system_->update_variable_bound(
-        action->getVariable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
+        action->get_variable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
   } else {
-    maxmin_system_->update_variable_bound(action->getVariable(),
+    maxmin_system_->update_variable_bound(action->get_variable(),
                                           (action->latCurrent_ > 0)
                                               ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
                                               : action->rate_);
   }
 
   for (auto const& link : route)
-    maxmin_system_->expand(link->constraint(), action->getVariable(), 1.0);
+    maxmin_system_->expand(link->constraint(), action->get_variable(), 1.0);
 
   if (not back_route.empty()) { //  sg_network_crosstraffic was activated
     XBT_DEBUG("Crosstraffic active adding backward flow using 5%%");
     for (auto const& link : back_route)
-      maxmin_system_->expand(link->constraint(), action->getVariable(), .05);
+      maxmin_system_->expand(link->constraint(), action->get_variable(), .05);
 
     // Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
     // (You would also have to change simgrid::kernel::lmm::Element::get_concurrency())
@@ -420,8 +419,8 @@ 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;
-      if (not action->isSuspended())
-        model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_);
+      if (not action->is_suspended())
+        model()->getMaxminSystem()->update_variable_weight(action->get_variable(), action->weight_);
     }
   }
 }
@@ -441,11 +440,11 @@ void NetworkCm02Link::setLatency(double value)
     action->latCurrent_ += delta;
     action->weight_ += delta;
     if (action->rate_ < 0)
-      model()->getMaxminSystem()->update_variable_bound(action->getVariable(),
+      model()->getMaxminSystem()->update_variable_bound(action->get_variable(),
                                                         sg_tcp_gamma / (2.0 * action->latCurrent_));
     else {
       model()->getMaxminSystem()->update_variable_bound(
-          action->getVariable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)));
+          action->get_variable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)));
 
       if (action->rate_ < sg_tcp_gamma / (2.0 * action->latCurrent_)) {
         XBT_INFO("Flow is limited BYBANDWIDTH");
@@ -453,8 +452,8 @@ void NetworkCm02Link::setLatency(double value)
         XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->latCurrent_);
       }
     }
-    if (not action->isSuspended())
-      model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_);
+    if (not action->is_suspended())
+      model()->getMaxminSystem()->update_variable_weight(action->get_variable(), action->weight_);
   }
 }
 
@@ -462,18 +461,18 @@ void NetworkCm02Link::setLatency(double value)
  * Action *
  **********/
 
-void NetworkCm02Action::updateRemainingLazy(double now)
+void NetworkCm02Action::update_remains_lazy(double now)
 {
   if (suspended_ != Action::SuspendStates::not_suspended)
     return;
 
-  double delta        = now - getLastUpdate();
+  double delta        = now - get_last_update();
   double max_duration = get_max_duration();
 
   if (get_remains_no_update() > 0) {
     XBT_DEBUG("Updating action(%p): remains was %f, last_update was: %f", this, get_remains_no_update(),
-              getLastUpdate());
-    update_remains(getLastValue() * delta);
+              get_last_update());
+    update_remains(get_last_value() * delta);
 
     XBT_DEBUG("Updating action(%p): remains is now %f", this, get_remains_no_update());
   }
@@ -483,14 +482,14 @@ void NetworkCm02Action::updateRemainingLazy(double now)
     set_max_duration(max_duration);
   }
 
-  if ((get_remains_no_update() <= 0 && (getVariable()->get_weight() > 0)) ||
+  if ((get_remains_no_update() <= 0 && (get_variable()->get_weight() > 0)) ||
       ((max_duration > NO_MAX_DURATION) && (max_duration <= 0))) {
     finish(Action::State::done);
-    heapRemove(get_model()->getActionHeap());
+    heapRemove();
   }
 
-  refreshLastUpdate();
-  setLastValue(getVariable()->get_value());
+  set_last_update();
+  set_last_value(get_variable()->get_value());
 }
 
 }
index f9904fd..aa76ddf 100644 (file)
@@ -69,7 +69,7 @@ class NetworkCm02Action : public NetworkAction {
 public:
   NetworkCm02Action(kernel::resource::Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
   virtual ~NetworkCm02Action() = default;
-  void updateRemainingLazy(double now) override;
+  void update_remains_lazy(double now) override;
 };
 }
 }
index 9a582d7..9424f59 100644 (file)
@@ -84,7 +84,7 @@ NetworkConstantAction::NetworkConstantAction(NetworkConstantModel* model_, doubl
 
 NetworkConstantAction::~NetworkConstantAction() = default;
 
-void NetworkConstantAction::updateRemainingLazy(double /*now*/)
+void NetworkConstantAction::update_remains_lazy(double /*now*/)
 {
   THROW_IMPOSSIBLE;
 }
index 198dd8a..0336b1e 100644 (file)
@@ -42,7 +42,7 @@ namespace simgrid {
       NetworkConstantAction(NetworkConstantModel *model_, double size, double latency);
       ~NetworkConstantAction();
       double initialLatency_;
-      void updateRemainingLazy(double now) override;
+      void update_remains_lazy(double now) override;
     };
 
   }
index ceb99fc..354b99d 100644 (file)
@@ -174,7 +174,7 @@ void NetworkIBModel::computeIBfactors(IBNode* root)
     if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) {
       XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,
                 (*it)->destination->id, (*it)->action, penalized_bw, (*it)->action->get_bound(), (*it)->init_rate);
-      maxmin_system_->update_variable_bound((*it)->action->getVariable(), penalized_bw);
+      maxmin_system_->update_variable_bound((*it)->action->get_variable(), penalized_bw);
     } else {
       XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id, (*it)->destination->id,
                 (*it)->action, penalized_bw, (*it)->init_rate);
index d49a04e..1834d38 100644 (file)
@@ -196,13 +196,13 @@ namespace simgrid {
     std::list<LinkImpl*> NetworkAction::links()
     {
       std::list<LinkImpl*> retlist;
-      int llen = getVariable()->get_number_of_constraint();
+      int llen = get_variable()->get_number_of_constraint();
 
       for (int i = 0; i < llen; i++) {
         /* Beware of composite actions: ptasks put links and cpus together */
         // extra pb: we cannot dynamic_cast from void*...
         kernel::resource::Resource* resource =
-            static_cast<kernel::resource::Resource*>(getVariable()->get_constraint(i)->get_id());
+            static_cast<kernel::resource::Resource*>(get_variable()->get_constraint(i)->get_id());
         LinkImpl* link     = dynamic_cast<LinkImpl*>(resource);
         if (link != nullptr)
           retlist.push_back(link);
index 3821b8a..a11bc1f 100644 (file)
@@ -339,17 +339,11 @@ std::list<LinkImpl*> NetworkNS3Action::links()
 {
   THROW_UNIMPLEMENTED;
 }
-void NetworkNS3Action::updateRemainingLazy(double /*now*/)
+void NetworkNS3Action::update_remains_lazy(double /*now*/)
 {
   THROW_IMPOSSIBLE;
 }
 
-/* Test whether a flow is suspended */
-bool NetworkNS3Action::isSuspended()
-{
-  return false;
-}
-
 }
 }
 
index dbf99ea..a180ed2 100644 (file)
@@ -47,11 +47,10 @@ class XBT_PRIVATE NetworkNS3Action : public NetworkAction {
 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 updateRemainingLazy(double now) override;
+  void update_remains_lazy(double now) override;
 
   // private:
   double lastSent_ = 0;
index b670036..4a7d7c1 100644 (file)
@@ -93,14 +93,14 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
       } 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);
+        maxmin_system_->update_variable_weight(action.get_variable(), 1.0);
       }
     }
     XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", &action, action.get_remains(),
-              action.getVariable()->get_value() * delta);
-    action.update_remains(action.getVariable()->get_value() * delta);
+              action.get_variable()->get_value() * delta);
+    action.update_remains(action.get_variable()->get_value() * delta);
 
     if (action.get_max_duration() > NO_MAX_DURATION)
       action.update_max_duration(delta);
@@ -113,13 +113,13 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
      * If it's not done, it may have failed.
      */
 
-    if (((action.get_remains() <= 0) && (action.getVariable()->get_weight() > 0)) ||
+    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);
     } else {
       /* Need to check that none of the model has failed */
       int i = 0;
-      kernel::lmm::Constraint* cnst = action.getVariable()->get_constraint(i);
+      kernel::lmm::Constraint* cnst = action.get_variable()->get_constraint(i);
       while (cnst != nullptr) {
         i++;
         void* constraint_id = cnst->get_id();
@@ -128,7 +128,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
           action.finish(kernel::resource::Action::State::failed);
           break;
         }
-        cnst = action.getVariable()->get_constraint(i);
+        cnst = action.get_variable()->get_constraint(i);
       }
     }
   }
@@ -181,13 +181,13 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos
   XBT_DEBUG("Creating a parallel task (%p) with %d hosts and %d unique links.", this, host_nb, nb_link);
   latency_ = latency;
 
-  setVariable(model->getMaxminSystem()->variable_new(this, 1.0, (rate > 0 ? rate : -1.0), host_nb + nb_link));
+  set_variable(model->getMaxminSystem()->variable_new(this, 1.0, (rate > 0 ? rate : -1.0), host_nb + nb_link));
 
   if (latency_ > 0)
-    model->getMaxminSystem()->update_variable_weight(getVariable(), 0.0);
+    model->getMaxminSystem()->update_variable_weight(get_variable(), 0.0);
 
   for (int i = 0; i < host_nb; i++)
-    model->getMaxminSystem()->expand(host_list[i]->pimpl_cpu->constraint(), getVariable(), flops_amount[i]);
+    model->getMaxminSystem()->expand(host_list[i]->pimpl_cpu->constraint(), get_variable(), flops_amount[i]);
 
   if(bytes_amount != nullptr) {
     for (int i = 0; i < host_nb; i++) {
@@ -197,7 +197,7 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos
           hostList_->at(i)->routeTo(hostList_->at(j), route, nullptr);
 
           for (auto const& link : route)
-            model->getMaxminSystem()->expand_add(link->constraint(), this->getVariable(),
+            model->getMaxminSystem()->expand_add(link->constraint(), this->get_variable(),
                                                  bytes_amount[i * host_nb + j]);
         }
       }
@@ -275,7 +275,7 @@ kernel::resource::Action* CpuL07::sleep(double duration)
   L07Action *action = static_cast<L07Action*>(execution_start(1.0));
   action->set_max_duration(duration);
   action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
-  model()->getMaxminSystem()->update_variable_weight(action->getVariable(), 0.0);
+  model()->getMaxminSystem()->update_variable_weight(action->get_variable(), 0.0);
 
   return action;
 }
@@ -293,7 +293,7 @@ void CpuL07::onSpeedChange() {
   while ((var = constraint()->get_variable(&elem))) {
     kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
-    model()->getMaxminSystem()->update_variable_bound(action->getVariable(), speed_.scale * speed_.peak);
+    model()->getMaxminSystem()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
   }
 
   Cpu::onSpeedChange();
@@ -401,9 +401,9 @@ void L07Action::updateBound()
   XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
   if ((latency_ <= 0.0) && (suspended_ == Action::SuspendStates::not_suspended)) {
     if (rate_ < 0)
-      get_model()->getMaxminSystem()->update_variable_bound(getVariable(), lat_bound);
+      get_model()->getMaxminSystem()->update_variable_bound(get_variable(), lat_bound);
     else
-      get_model()->getMaxminSystem()->update_variable_bound(getVariable(), std::min(rate_, lat_bound));
+      get_model()->getMaxminSystem()->update_variable_bound(get_variable(), std::min(rate_, lat_bound));
   }
 }
 
index 47234a0..2e3c492 100644 (file)
@@ -80,12 +80,12 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
   for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
     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.getVariable()->get_value() * delta));
+    action.update_remains(lrint(action.get_variable()->get_value() * delta));
 
     if (action.get_max_duration() > NO_MAX_DURATION)
       action.update_max_duration(delta);
 
-    if (((action.get_remains_no_update() <= 0) && (action.getVariable()->get_weight() > 0)) ||
+    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);
     }
@@ -125,13 +125,13 @@ StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost,
   XBT_IN("(%s,%g", storage->getCname(), cost);
 
   // Must be less than the max bandwidth for all actions
-  model->getMaxminSystem()->expand(storage->constraint(), getVariable(), 1.0);
+  model->getMaxminSystem()->expand(storage->constraint(), get_variable(), 1.0);
   switch(type) {
   case READ:
-    model->getMaxminSystem()->expand(storage->constraintRead_, getVariable(), 1.0);
+    model->getMaxminSystem()->expand(storage->constraintRead_, get_variable(), 1.0);
     break;
   case WRITE:
-    model->getMaxminSystem()->expand(storage->constraintWrite_, getVariable(), 1.0);
+    model->getMaxminSystem()->expand(storage->constraintWrite_, get_variable(), 1.0);
     break;
   default:
     THROW_UNIMPLEMENTED;
@@ -148,7 +148,7 @@ void StorageN11Action::suspend()
 {
   XBT_IN("(%p)", this);
   if (suspended_ != Action::SuspendStates::sleeping) {
-    get_model()->getMaxminSystem()->update_variable_weight(getVariable(), 0.0);
+    get_model()->getMaxminSystem()->update_variable_weight(get_variable(), 0.0);
     suspended_ = Action::SuspendStates::suspended;
   }
   XBT_OUT();
@@ -159,11 +159,6 @@ void StorageN11Action::resume()
   THROW_UNIMPLEMENTED;
 }
 
-bool StorageN11Action::isSuspended()
-{
-  return suspended_ == Action::SuspendStates::suspended;
-}
-
 void StorageN11Action::set_max_duration(double /*duration*/)
 {
   THROW_UNIMPLEMENTED;
@@ -173,7 +168,7 @@ void StorageN11Action::set_priority(double /*priority*/)
 {
   THROW_UNIMPLEMENTED;
 }
-void StorageN11Action::updateRemainingLazy(double /*now*/)
+void StorageN11Action::update_remains_lazy(double /*now*/)
 {
   THROW_IMPOSSIBLE;
 }
index 1e4d342..dfcd33e 100644 (file)
@@ -57,10 +57,9 @@ public:
   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 updateRemainingLazy(double now) override;
+  void update_remains_lazy(double now) override;
 };
 
 }