Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
finish snake_casing resource::Action
[simgrid.git] / src / kernel / resource / Model.cpp
index 2755f5d..77560d6 100644 (file)
@@ -16,32 +16,32 @@ Model::Model() = default;
 
 Model::~Model()
 {
-  delete readyActionSet_;
-  delete runningActionSet_;
-  delete failedActionSet_;
-  delete doneActionSet_;
-  delete maxminSystem_;
+  delete ready_action_set_;
+  delete running_action_set_;
+  delete failed_action_set_;
+  delete done_action_set_;
+  delete maxmin_system_;
 }
 
 Action* Model::actionHeapPop()
 {
-  Action* action = actionHeap_.top().second;
-  actionHeap_.pop();
+  Action* action = action_heap_.top().second;
+  action_heap_.pop();
   action->clearHeapHandle();
   return action;
 }
 
-ActionLmmListPtr Model::getModifiedSet() const
+Action::ModifiedSet* Model::getModifiedSet() const
 {
-  return maxminSystem_->modified_set_;
+  return maxmin_system_->modified_set_;
 }
 
 double Model::nextOccuringEvent(double now)
 {
   // FIXME: set the good function once and for all
-  if (updateMechanism_ == UM_LAZY)
+  if (update_mechanism_ == UM_LAZY)
     return nextOccuringEventLazy(now);
-  else if (updateMechanism_ == UM_FULL)
+  else if (update_mechanism_ == UM_FULL)
     return nextOccuringEventFull(now);
   else
     xbt_die("Invalid cpu update mechanism!");
@@ -49,20 +49,20 @@ double Model::nextOccuringEvent(double now)
 
 double Model::nextOccuringEventLazy(double now)
 {
-  XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxminSystem_->modified_set_->size());
-  lmm_solve(maxminSystem_);
-  XBT_DEBUG("After share resources, The size of modified actions set is %zu", maxminSystem_->modified_set_->size());
+  XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxmin_system_->modified_set_->size());
+  lmm_solve(maxmin_system_);
+  XBT_DEBUG("After share resources, The size of modified actions set is %zu", maxmin_system_->modified_set_->size());
 
-  while (not maxminSystem_->modified_set_->empty()) {
-    Action* action = &(maxminSystem_->modified_set_->front());
-    maxminSystem_->modified_set_->pop_front();
+  while (not maxmin_system_->modified_set_->empty()) {
+    Action* action = &(maxmin_system_->modified_set_->front());
+    maxmin_system_->modified_set_->pop_front();
     bool max_dur_flag = false;
 
-    if (action->getStateSet() != runningActionSet_)
+    if (action->get_state_set() != running_action_set_)
       continue;
 
     /* bogus priority, skip it */
-    if (action->getPriority() <= 0 || action->getType() == Action::Type::LATENCY)
+    if (action->get_priority() <= 0 || action->getType() == Action::Type::LATENCY)
       continue;
 
     action->updateRemainingLazy(now);
@@ -72,28 +72,28 @@ double Model::nextOccuringEventLazy(double now)
 
     if (share > 0) {
       double time_to_completion;
-      if (action->getRemains() > 0) {
-        time_to_completion = action->getRemainsNoUpdate() / share;
+      if (action->get_remains() > 0) {
+        time_to_completion = action->get_remains_no_update() / share;
       } else {
         time_to_completion = 0.0;
       }
       min = now + time_to_completion; // when the task will complete if nothing changes
     }
 
-    if ((action->getMaxDuration() > NO_MAX_DURATION) &&
-        (min <= -1 || action->getStartTime() + action->getMaxDuration() < min)) {
+    if ((action->get_max_duration() > NO_MAX_DURATION) &&
+        (min <= -1 || action->get_start_time() + action->get_max_duration() < min)) {
       // when the task will complete anyway because of the deadline if any
-      min          = action->getStartTime() + action->getMaxDuration();
+      min          = action->get_start_time() + action->get_max_duration();
       max_dur_flag = true;
     }
 
     XBT_DEBUG("Action(%p) corresponds to variable %d", action, action->getVariable()->id_int);
 
     XBT_DEBUG("Action(%p) Start %f. May finish at %f (got a share of %f). Max_duration %f", action,
-              action->getStartTime(), min, share, action->getMaxDuration());
+              action->get_start_time(), min, share, action->get_max_duration());
 
     if (min > -1) {
-      action->heapUpdate(actionHeap_, min, max_dur_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
+      action->heapUpdate(action_heap_, 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;
@@ -112,15 +112,15 @@ double Model::nextOccuringEventLazy(double now)
 
 double Model::nextOccuringEventFull(double /*now*/)
 {
-  maxminSystem_->solve_fun(maxminSystem_);
+  maxmin_system_->solve_fun(maxmin_system_);
 
   double min = -1;
 
   for (Action& action : *getRunningActionSet()) {
     double value = action.getVariable()->get_value();
     if (value > 0) {
-      if (action.getRemains() > 0)
-        value = action.getRemainsNoUpdate() / value;
+      if (action.get_remains() > 0)
+        value = action.get_remains_no_update() / value;
       else
         value = 0.0;
       if (min < 0 || value < min) {
@@ -128,8 +128,8 @@ double Model::nextOccuringEventFull(double /*now*/)
         XBT_DEBUG("Updating min (value) with %p: %f", &action, min);
       }
     }
-    if ((action.getMaxDuration() >= 0) && (min < 0 || action.getMaxDuration() < min)) {
-      min = action.getMaxDuration();
+    if ((action.get_max_duration() >= 0) && (min < 0 || action.get_max_duration() < min)) {
+      min = action.get_max_duration();
       XBT_DEBUG("Updating min (duration) with %p: %f", &action, min);
     }
   }
@@ -140,9 +140,9 @@ double Model::nextOccuringEventFull(double /*now*/)
 
 void Model::updateActionsState(double now, double delta)
 {
-  if (updateMechanism_ == UM_FULL)
+  if (update_mechanism_ == UM_FULL)
     updateActionsStateFull(now, delta);
-  else if (updateMechanism_ == UM_LAZY)
+  else if (update_mechanism_ == UM_LAZY)
     updateActionsStateLazy(now, delta);
   else
     xbt_die("Invalid cpu update mechanism!");