Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
snake_case in resource::Resource
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 2 Apr 2018 21:06:30 +0000 (23:06 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 2 Apr 2018 21:06:30 +0000 (23:06 +0200)
18 files changed:
include/simgrid/kernel/resource/Resource.hpp
src/kernel/resource/Resource.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_link.cpp
src/simix/smx_host.cpp
src/surf/HostImpl.cpp
src/surf/StorageImpl.cpp
src/surf/StorageImpl.hpp
src/surf/cpu_cas01.cpp
src/surf/cpu_ti.cpp
src/surf/network_cm02.cpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/plugins/host_energy.cpp
src/surf/plugins/host_load.cpp
src/surf/ptask_L07.cpp
src/surf/storage_n11.cpp

index ee037cd..d6ac71f 100644 (file)
@@ -35,7 +35,7 @@ public:
   virtual ~Resource();
 
   /** @brief Get the Model of the current Resource */
-  Model* model() const;
+  Model* get_model() const;
 
   /** @brief Get the name of the current Resource */
   const std::string& get_name() const;
@@ -44,28 +44,23 @@ public:
 
   bool operator==(const Resource& other) const;
 
-  /**
-   * @brief Apply an event of external load event to that resource
-   *
-   * @param event What happened
-   * @param value [TODO]
-   */
+  /** @brief Apply an event of external load event to that resource */
   virtual void apply_event(TraceEvent* event, double value) = 0;
 
   /** @brief Check if the current Resource is used (if it currently serves an action) */
   virtual bool is_used() = 0;
 
   /** @brief returns the current load (in flops per second, byte per second or similar) */
-  virtual double getLoad();
+  virtual double get_load();
 
   /** @brief Check if the current Resource is active */
-  virtual bool isOn() const;
+  virtual bool is_on() const;
   /** @brief Check if the current Resource is shut down */
-  virtual bool isOff() const;
+  virtual bool is_off() const;
   /** @brief Turn on the current Resource */
-  virtual void turnOn();
+  virtual void turn_on();
   /** @brief Turn off the current Resource */
-  virtual void turnOff();
+  virtual void turn_off();
 
 private:
   std::string name_;
@@ -74,7 +69,7 @@ private:
 
 public: /* LMM */
   /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
-  kernel::lmm::Constraint* constraint() const;
+  lmm::Constraint* get_constraint() const;
 
 private:
   kernel::lmm::Constraint* const constraint_ = nullptr;
index 6b9ffe1..72899f0 100644 (file)
@@ -18,31 +18,31 @@ Resource::Resource(Model* model, const std::string& name, lmm::Constraint* const
 
 Resource::~Resource() = default;
 
-bool Resource::isOn() const
+bool Resource::is_on() const
 {
   return is_on_;
 }
-bool Resource::isOff() const
+bool Resource::is_off() const
 {
   return not is_on_;
 }
 
-void Resource::turnOn()
+void Resource::turn_on()
 {
   is_on_ = true;
 }
 
-void Resource::turnOff()
+void Resource::turn_off()
 {
   is_on_ = false;
 }
 
-double Resource::getLoad()
+double Resource::get_load()
 {
   return constraint_->get_usage();
 }
 
-Model* Resource::model() const
+Model* Resource::get_model() const
 {
   return model_;
 }
@@ -62,7 +62,7 @@ bool Resource::operator==(const Resource& other) const
   return name_ == other.name_;
 }
 
-kernel::lmm::Constraint* Resource::constraint() const
+kernel::lmm::Constraint* Resource::get_constraint() const
 {
   return constraint_;
 }
index c8fd8c3..025fc56 100644 (file)
@@ -97,9 +97,9 @@ double VMModel::next_occuring_event(double now)
                                                                 // this VM got in the sharing on the PM
     XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->get_cname(), ws_vm->getPm()->get_cname());
 
-    xbt_assert(cpu->model() == surf_cpu_model_vm);
-    kernel::lmm::System* vcpu_system = cpu->model()->get_maxmin_system();
-    vcpu_system->update_constraint_bound(cpu->constraint(), virt_overhead * solved_value);
+    xbt_assert(cpu->get_model() == surf_cpu_model_vm);
+    kernel::lmm::System* vcpu_system = cpu->get_model()->get_maxmin_system();
+    vcpu_system->update_constraint_bound(cpu->get_constraint(), virt_overhead * solved_value);
   }
 
   /* 2. Calculate resource share at the virtual machine layer. */
index 5cb5695..14d3a0e 100644 (file)
@@ -103,7 +103,7 @@ void Host::turnOn() {
   if (isOff()) {
     simgrid::simix::kernelImmediate([this] {
       this->extension<simgrid::simix::Host>()->turnOn();
-      this->pimpl_cpu->turnOn();
+      this->pimpl_cpu->turn_on();
       onStateChange(*this);
     });
   }
@@ -120,7 +120,7 @@ void Host::turnOff() {
 }
 
 bool Host::isOn() {
-  return this->pimpl_cpu->isOn();
+  return this->pimpl_cpu->is_on();
 }
 
 int Host::getPstatesCount() const
@@ -270,7 +270,7 @@ void Host::execute(double flops)
 
 double Host::getLoad()
 {
-  return this->pimpl_cpu->getLoad();
+  return this->pimpl_cpu->get_load();
 }
 
 } // namespace simgrid
index a7d6c2a..d9a5089 100644 (file)
@@ -114,20 +114,16 @@ int Link::sharingPolicy()
 
 double Link::getUsage()
 {
-  return this->pimpl_->constraint()->get_usage();
+  return this->pimpl_->get_constraint()->get_usage();
 }
 
 void Link::turnOn()
 {
-  simgrid::simix::kernelImmediate([this]() {
-    this->pimpl_->turnOn();
-  });
+  simgrid::simix::kernelImmediate([this]() { this->pimpl_->turn_on(); });
 }
 void Link::turnOff()
 {
-  simgrid::simix::kernelImmediate([this]() {
-    this->pimpl_->turnOff();
-  });
+  simgrid::simix::kernelImmediate([this]() { this->pimpl_->turn_off(); });
 }
 
 void* Link::getData()
index 29a81f4..a4ab78c 100644 (file)
@@ -70,7 +70,7 @@ void SIMIX_host_off(sg_host_t h, smx_actor_t issuer)
   xbt_assert((host != nullptr), "Invalid parameters");
 
   if (h->isOn()) {
-    h->pimpl_cpu->turnOff();
+    h->pimpl_cpu->turn_off();
 
     /* Clean Simulator data */
     if (not host->process_list.empty()) {
index d910bac..f4c07b3 100644 (file)
@@ -29,7 +29,7 @@ void HostModel::ignore_empty_vm_in_pm_LMM()
   /* iterate for all virtual machines */
   for (s4u::VirtualMachine* const& ws_vm : vm::VirtualMachineImpl::allVms_) {
     Cpu* cpu = ws_vm->pimpl_cpu;
-    int active_tasks = cpu->constraint()->get_variable_amount();
+    int active_tasks = cpu->get_constraint()->get_variable_amount();
 
     /* The impact of the VM over its PM is the min between its vCPU amount and the amount of tasks it contains */
     int impact = std::min(active_tasks, ws_vm->getImpl()->coreAmount());
index 2916346..999ec2a 100644 (file)
@@ -54,7 +54,7 @@ StorageImpl::StorageImpl(kernel::resource::Model* model, std::string name, kerne
     , size_(size)
     , attach_(attach)
 {
-  StorageImpl::turnOn();
+  StorageImpl::turn_on();
   XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
   constraintRead_  = maxminSystem->constraint_new(this, bread);
   constraintWrite_ = maxminSystem->constraint_new(this, bwrite);
@@ -76,17 +76,17 @@ void StorageImpl::apply_event(tmgr_trace_event_t /*event*/, double /*value*/)
   THROW_UNIMPLEMENTED;
 }
 
-void StorageImpl::turnOn()
+void StorageImpl::turn_on()
 {
-  if (isOff()) {
-    Resource::turnOn();
+  if (is_off()) {
+    Resource::turn_on();
     storageStateChangedCallbacks(this, 0, 1);
   }
 }
-void StorageImpl::turnOff()
+void StorageImpl::turn_off()
 {
-  if (isOn()) {
-    Resource::turnOff();
+  if (is_on()) {
+    Resource::turn_off();
     storageStateChangedCallbacks(this, 1, 0);
   }
 }
index f0c29a6..5e2f7e0 100644 (file)
@@ -98,8 +98,8 @@ public:
 
   void apply_event(tmgr_trace_event_t event, double value) override;
 
-  void turnOn() override;
-  void turnOff() override;
+  void turn_on() override;
+  void turn_off() override;
 
   /**
    * @brief Read a file
index a9a8110..d03c3c0 100644 (file)
@@ -96,7 +96,7 @@ CpuCas01::CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, std::vector<d
 
 CpuCas01::~CpuCas01()
 {
-  if (model() == surf_cpu_model_pm)
+  if (get_model() == surf_cpu_model_pm)
     speedPerPstate_.clear();
 }
 
@@ -106,7 +106,7 @@ std::vector<double> * CpuCas01::getSpeedPeakList(){
 
 bool CpuCas01::is_used()
 {
-  return model()->get_maxmin_system()->constraint_used(constraint());
+  return get_model()->get_maxmin_system()->constraint_used(get_constraint());
 }
 
 /** @brief take into account changes of speed (either load or max) */
@@ -114,12 +114,13 @@ void CpuCas01::onSpeedChange() {
   kernel::lmm::Variable* var = nullptr;
   const_lmm_element_t elem = nullptr;
 
-  model()->get_maxmin_system()->update_constraint_bound(constraint(), coresAmount_ * speed_.scale * speed_.peak);
-  while ((var = constraint()->get_variable(&elem))) {
+  get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(),
+                                                            coresAmount_ * speed_.scale * speed_.peak);
+  while ((var = get_constraint()->get_variable(&elem))) {
     CpuCas01Action* action = static_cast<CpuCas01Action*>(var->get_id());
 
-    model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
-                                                        action->requestedCore() * speed_.scale * speed_.peak);
+    get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
+                                                            action->requestedCore() * speed_.scale * speed_.peak);
   }
 
   Cpu::onSpeedChange();
@@ -140,16 +141,16 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value)
     xbt_assert(coresAmount_ == 1, "FIXME: add state change code also for constraint_core[i]");
 
     if (value > 0) {
-      if(isOff())
+      if (is_off())
         host_that_restart.push_back(getHost());
-      turnOn();
+      turn_on();
     } else {
-      kernel::lmm::Constraint* cnst = constraint();
+      kernel::lmm::Constraint* cnst = get_constraint();
       kernel::lmm::Variable* var    = nullptr;
       const_lmm_element_t elem = nullptr;
       double date              = surf_get_clock();
 
-      turnOff();
+      turn_off();
 
       while ((var = cnst->get_variable(&elem))) {
         kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
@@ -172,12 +173,12 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value)
 /** @brief Start a new execution on this CPU lasting @param size flops and using one core */
 CpuAction* CpuCas01::execution_start(double size)
 {
-  return new CpuCas01Action(model(), size, isOff(), speed_.scale * speed_.peak, constraint());
+  return new CpuCas01Action(get_model(), size, is_off(), speed_.scale * speed_.peak, get_constraint());
 }
 
 CpuAction* CpuCas01::execution_start(double size, int requestedCores)
 {
-  return new CpuCas01Action(model(), size, isOff(), speed_.scale * speed_.peak, constraint(), requestedCores);
+  return new CpuCas01Action(get_model(), size, is_off(), speed_.scale * speed_.peak, get_constraint(), requestedCores);
 }
 
 CpuAction *CpuCas01::sleep(double duration)
@@ -186,7 +187,7 @@ CpuAction *CpuCas01::sleep(double duration)
     duration = std::max(duration, sg_surf_precision);
 
   XBT_IN("(%s,%g)", get_cname(), duration);
-  CpuCas01Action* action = new CpuCas01Action(model(), 1.0, isOff(), speed_.scale * speed_.peak, constraint());
+  CpuCas01Action* action = new CpuCas01Action(get_model(), 1.0, is_off(), speed_.scale * speed_.peak, get_constraint());
 
   // FIXME: sleep variables should not consume 1.0 in System::expand()
   action->set_max_duration(duration);
@@ -194,16 +195,16 @@ CpuAction *CpuCas01::sleep(double duration)
   if (duration < 0) { // NO_MAX_DURATION
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
     simgrid::xbt::intrusive_erase(*action->get_state_set(), *action);
-    action->state_set_ = &static_cast<CpuCas01Model*>(model())->cpuRunningActionSetThatDoesNotNeedBeingChecked_;
+    action->state_set_ = &static_cast<CpuCas01Model*>(get_model())->cpuRunningActionSetThatDoesNotNeedBeingChecked_;
     action->get_state_set()->push_back(*action);
   }
 
-  model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
-  if (model()->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy) { // remove action from the heap
-    model()->get_action_heap().remove(action);
+  get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
+  if (get_model()->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy) { // remove action from the heap
+    get_model()->get_action_heap().remove(action);
     // 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()->get_modified_set()->push_front(*action);
+    get_model()->get_modified_set()->push_front(*action);
   }
 
   XBT_OUT();
index 5800817..c1c9ec4 100644 (file)
@@ -411,11 +411,11 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value)
 
   } else if (event == stateEvent_) {
     if (value > 0) {
-      if(isOff())
+      if (is_off())
         host_that_restart.push_back(getHost());
-      turnOn();
+      turn_on();
     } else {
-      turnOff();
+      turn_off();
       double date = surf_get_clock();
 
       /* put all action running on cpu to failed */
@@ -425,7 +425,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);
-          model()->get_action_heap().remove(&action);
+          get_model()->get_action_heap().remove(&action);
         }
       }
     }
@@ -485,9 +485,9 @@ void CpuTi::update_actions_finish_time(double now)
     }
     /* add in action heap */
     if (min_finish > NO_MAX_DURATION)
-      model()->get_action_heap().update(&action, min_finish, kernel::resource::ActionHeap::Type::unset);
+      get_model()->get_action_heap().update(&action, min_finish, kernel::resource::ActionHeap::Type::unset);
     else
-      model()->get_action_heap().remove(&action);
+      get_model()->get_action_heap().remove(&action);
 
     XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", get_cname(),
               &action, action.get_start_time(), action.get_finish_time(), action.get_max_duration());
@@ -520,7 +520,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() != model()->get_running_action_set())
+    if (action.get_state_set() != get_model()->get_running_action_set())
       continue;
 
     /* bogus priority, skip it */
@@ -549,7 +549,7 @@ void CpuTi::update_remaining_amount(double now)
 CpuAction *CpuTi::execution_start(double size)
 {
   XBT_IN("(%s,%g)", get_cname(), size);
-  CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), size, isOff(), this);
+  CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(get_model()), size, is_off(), this);
 
   action_set_.push_back(*action);
 
@@ -564,14 +564,14 @@ CpuAction *CpuTi::sleep(double duration)
     duration = std::max(duration, sg_surf_precision);
 
   XBT_IN("(%s,%g)", get_cname(), duration);
-  CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), 1.0, isOff(), this);
+  CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(get_model()), 1.0, is_off(), this);
 
   action->set_max_duration(duration);
   action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
   if (duration == NO_MAX_DURATION) {
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
     simgrid::xbt::intrusive_erase(*action->get_state_set(), *action);
-    action->state_set_ = &static_cast<CpuTiModel*>(model())->runningActionSetThatDoesNotNeedBeingChecked_;
+    action->state_set_ = &static_cast<CpuTiModel*>(get_model())->runningActionSetThatDoesNotNeedBeingChecked_;
     action->get_state_set()->push_back(*action);
   }
 
@@ -583,7 +583,7 @@ CpuAction *CpuTi::sleep(double duration)
 
 void CpuTi::set_modified(bool modified)
 {
-  CpuTiList& modifiedCpu = static_cast<CpuTiModel*>(model())->modified_cpus_;
+  CpuTiList& modifiedCpu = static_cast<CpuTiModel*>(get_model())->modified_cpus_;
   if (modified) {
     if (not cpu_ti_hook.is_linked()) {
       modifiedCpu.push_back(*this);
index 64f405b..c264794 100644 (file)
@@ -256,13 +256,13 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos
              src->get_cname(), dst->get_cname());
 
   for (auto const& link : route)
-    if (link->isOff())
+    if (link->is_off())
       failed = 1;
 
   if (sg_network_crosstraffic == 1) {
     dst->routeTo(src, back_route, nullptr);
     for (auto const& link : back_route)
-      if (link->isOff())
+      if (link->is_off())
         failed = 1;
   }
 
@@ -319,12 +319,12 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos
   }
 
   for (auto const& link : route)
-    get_maxmin_system()->expand(link->constraint(), action->get_variable(), 1.0);
+    get_maxmin_system()->expand(link->get_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)
-      get_maxmin_system()->expand(link->constraint(), action->get_variable(), .05);
+      get_maxmin_system()->expand(link->get_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())
@@ -350,7 +350,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& nam
   latency_.peak  = latency;
 
   if (policy == SURF_LINK_FATPIPE)
-    constraint()->unshare();
+    get_constraint()->unshare();
 
   simgrid::s4u::Link::onCreation(this->piface_);
 }
@@ -368,14 +368,14 @@ void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
 
   } else if (triggered == stateEvent_) {
     if (value > 0)
-      turnOn();
+      turn_on();
     else {
       kernel::lmm::Variable* var = nullptr;
       const_lmm_element_t elem = nullptr;
       double now               = surf_get_clock();
 
-      turnOff();
-      while ((var = constraint()->get_variable(&elem))) {
+      turn_off();
+      while ((var = get_constraint()->get_variable(&elem))) {
         kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
         if (action->get_state() == kernel::resource::Action::State::running ||
@@ -390,15 +390,16 @@ void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
     xbt_die("Unknown event!\n");
   }
 
-  XBT_DEBUG("There was a resource state event, need to update actions related to the constraint (%p)", constraint());
+  XBT_DEBUG("There was a resource state event, need to update actions related to the constraint (%p)",
+            get_constraint());
 }
 
 void NetworkCm02Link::setBandwidth(double value)
 {
   bandwidth_.peak = value;
 
-  model()->get_maxmin_system()->update_constraint_bound(constraint(),
-                                                        sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
+  get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(),
+                                                            sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
   TRACE_surf_link_set_bandwidth(surf_get_clock(), get_cname(),
                                 sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale);
 
@@ -409,11 +410,11 @@ void NetworkCm02Link::setBandwidth(double value)
     const_lmm_element_t elem     = nullptr;
     const_lmm_element_t nextelem = nullptr;
     int numelem                  = 0;
-    while ((var = constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
+    while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
       NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
       action->weight_ += delta;
       if (not action->is_suspended())
-        model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
+        get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
     }
   }
 }
@@ -428,15 +429,15 @@ void NetworkCm02Link::setLatency(double value)
 
   latency_.peak = value;
 
-  while ((var = constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
+  while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
     NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
     action->lat_current_ += delta;
     action->weight_ += delta;
     if (action->rate_ < 0)
-      model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
-                                                          sg_tcp_gamma / (2.0 * action->lat_current_));
+      get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
+                                                              sg_tcp_gamma / (2.0 * action->lat_current_));
     else {
-      model()->get_maxmin_system()->update_variable_bound(
+      get_model()->get_maxmin_system()->update_variable_bound(
           action->get_variable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->lat_current_)));
 
       if (action->rate_ < sg_tcp_gamma / (2.0 * action->lat_current_)) {
@@ -446,7 +447,7 @@ void NetworkCm02Link::setLatency(double value)
       }
     }
     if (not action->is_suspended())
-      model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
+      get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
   }
 }
 
index d843caa..480a1a5 100644 (file)
@@ -133,7 +133,7 @@ namespace simgrid {
 
     bool LinkImpl::is_used()
     {
-      return model()->get_maxmin_system()->constraint_used(constraint());
+      return get_model()->get_maxmin_system()->constraint_used(get_constraint());
     }
 
     double LinkImpl::latency()
@@ -148,20 +148,20 @@ namespace simgrid {
 
     int LinkImpl::sharingPolicy()
     {
-      return constraint()->get_sharing_policy();
+      return get_constraint()->get_sharing_policy();
     }
 
-    void LinkImpl::turnOn()
+    void LinkImpl::turn_on()
     {
-      if (isOff()) {
-        Resource::turnOn();
+      if (is_off()) {
+        Resource::turn_on();
         s4u::Link::onStateChange(this->piface_);
       }
     }
-    void LinkImpl::turnOff()
+    void LinkImpl::turn_off()
     {
-      if (isOn()) {
-        Resource::turnOff();
+      if (is_on()) {
+        Resource::turn_off();
         s4u::Link::onStateChange(this->piface_);
       }
     }
index f29e835..3cf8c35 100644 (file)
@@ -143,8 +143,8 @@ public:
   /** @brief Check if the Link is used */
   bool is_used() override;
 
-  void turnOn() override;
-  void turnOff() override;
+  void turn_on() override;
+  void turn_off() override;
 
   virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF).
                                                           Trace must contain boolean values. */
index d7cbb73..44736f3 100644 (file)
@@ -237,7 +237,7 @@ double HostEnergy::getCurrentWattsValue()
     // We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN
     cpu_load = 1;
   else
-    cpu_load = host->pimpl_cpu->constraint()->get_usage() / current_speed;
+    cpu_load = host->pimpl_cpu->get_constraint()->get_usage() / current_speed;
 
   /** Divide by the number of cores here **/
   cpu_load /= host->pimpl_cpu->coreCount();
index 9fc9f07..5f54170 100644 (file)
@@ -60,7 +60,7 @@ HostLoad::HostLoad(simgrid::s4u::Host* ptr)
     , last_updated(surf_get_clock())
     , last_reset(surf_get_clock())
     , current_speed(host->getSpeed())
-    , current_flops(host->pimpl_cpu->constraint()->get_usage())
+    , current_flops(host->pimpl_cpu->get_constraint()->get_usage())
     , theor_max_flops(0)
     , was_prev_idle(current_flops == 0)
 {
@@ -74,7 +74,7 @@ void HostLoad::update()
 
   /* Current flop per second computed by the cpu; current_flops = k * pstate_speed_in_flops, k \in {0, 1, ..., cores}
    * number of active cores */
-  current_flops = host->pimpl_cpu->constraint()->get_usage();
+  current_flops = host->pimpl_cpu->get_constraint()->get_usage();
 
   /* flops == pstate_speed * cores_being_currently_used */
   computed_flops += (now - last_updated) * current_flops;
@@ -137,7 +137,7 @@ void HostLoad::reset()
   idle_time       = 0;
   computed_flops  = 0;
   theor_max_flops = 0;
-  current_flops   = host->pimpl_cpu->constraint()->get_usage();
+  current_flops   = host->pimpl_cpu->get_constraint()->get_usage();
   current_speed   = host->getSpeed();
   was_prev_idle   = (current_flops == 0);
 }
index 0b04f61..0e41e56 100644 (file)
@@ -125,7 +125,7 @@ void HostL07Model::update_actions_state(double /*now*/, double delta)
       while (cnst != nullptr) {
         i++;
         void* constraint_id = cnst->get_id();
-        if (static_cast<simgrid::kernel::resource::Resource*>(constraint_id)->isOff()) {
+        if (static_cast<simgrid::kernel::resource::Resource*>(constraint_id)->is_off()) {
           XBT_DEBUG("Action (%p) Failed!!", &action);
           action.finish(kernel::resource::Action::State::failed);
           break;
@@ -189,7 +189,7 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos
     model->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
 
   for (int i = 0; i < host_nb; i++)
-    model->get_maxmin_system()->expand(host_list[i]->pimpl_cpu->constraint(), get_variable(), flops_amount[i]);
+    model->get_maxmin_system()->expand(host_list[i]->pimpl_cpu->get_constraint(), get_variable(), flops_amount[i]);
 
   if(bytes_amount != nullptr) {
     for (int i = 0; i < host_nb; i++) {
@@ -199,7 +199,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->get_maxmin_system()->expand_add(link->constraint(), this->get_variable(),
+            model->get_maxmin_system()->expand_add(link->get_constraint(), this->get_variable(),
                                                    bytes_amount[i * host_nb + j]);
         }
       }
@@ -256,7 +256,7 @@ LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwid
   latency_.peak   = latency;
 
   if (policy == SURF_LINK_FATPIPE)
-    constraint()->unshare();
+    get_constraint()->unshare();
 
   s4u::Link::onCreation(this->piface_);
 }
@@ -269,7 +269,7 @@ kernel::resource::Action* CpuL07::execution_start(double size)
   host_list[0] = getHost();
   flops_amount[0] = size;
 
-  return static_cast<CpuL07Model*>(model())->hostModel_->execute_parallel(1, host_list, flops_amount, nullptr, -1);
+  return static_cast<CpuL07Model*>(get_model())->hostModel_->execute_parallel(1, host_list, flops_amount, nullptr, -1);
 }
 
 kernel::resource::Action* CpuL07::sleep(double duration)
@@ -277,14 +277,14 @@ 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()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
+  get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
 
   return action;
 }
 
 bool CpuL07::is_used()
 {
-  return model()->get_maxmin_system()->constraint_used(constraint());
+  return get_model()->get_maxmin_system()->constraint_used(get_constraint());
 }
 
 /** @brief take into account changes of speed (either load or max) */
@@ -292,11 +292,11 @@ void CpuL07::onSpeedChange() {
   kernel::lmm::Variable* var = nullptr;
   const_lmm_element_t elem = nullptr;
 
-  model()->get_maxmin_system()->update_constraint_bound(constraint(), speed_.peak * speed_.scale);
-  while ((var = constraint()->get_variable(&elem))) {
+  get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), speed_.peak * speed_.scale);
+  while ((var = get_constraint()->get_variable(&elem))) {
     kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
-    model()->get_maxmin_system()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
+    get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
   }
 
   Cpu::onSpeedChange();
@@ -304,7 +304,7 @@ void CpuL07::onSpeedChange() {
 
 bool LinkL07::is_used()
 {
-  return model()->get_maxmin_system()->constraint_used(constraint());
+  return get_model()->get_maxmin_system()->constraint_used(get_constraint());
 }
 
 void CpuL07::apply_event(tmgr_trace_event_t triggered, double value)
@@ -317,9 +317,9 @@ void CpuL07::apply_event(tmgr_trace_event_t triggered, double value)
 
   } else if (triggered == stateEvent_) {
     if (value > 0)
-      turnOn();
+      turn_on();
     else
-      turnOff();
+      turn_off();
     tmgr_trace_event_unref(&stateEvent_);
 
   } else {
@@ -340,9 +340,9 @@ void LinkL07::apply_event(tmgr_trace_event_t triggered, double value)
 
   } else if (triggered == stateEvent_) {
     if (value > 0)
-      turnOn();
+      turn_on();
     else
-      turnOff();
+      turn_off();
     tmgr_trace_event_unref(&stateEvent_);
 
   } else {
@@ -353,7 +353,7 @@ void LinkL07::apply_event(tmgr_trace_event_t triggered, double value)
 void LinkL07::setBandwidth(double value)
 {
   bandwidth_.peak = value;
-  model()->get_maxmin_system()->update_constraint_bound(constraint(), bandwidth_.peak * bandwidth_.scale);
+  get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), bandwidth_.peak * bandwidth_.scale);
 }
 
 void LinkL07::setLatency(double value)
@@ -363,7 +363,7 @@ void LinkL07::setLatency(double value)
   const_lmm_element_t elem = nullptr;
 
   latency_.peak = value;
-  while ((var = constraint()->get_variable(&elem))) {
+  while ((var = get_constraint()->get_variable(&elem))) {
     action = static_cast<L07Action*>(var->get_id());
     action->updateBound();
   }
index 897c3b7..b2059f1 100644 (file)
@@ -106,12 +106,12 @@ StorageN11::StorageN11(StorageModel* model, std::string name, kernel::lmm::Syste
 
 StorageAction* StorageN11::read(sg_size_t size)
 {
-  return new StorageN11Action(model(), size, isOff(), this, READ);
+  return new StorageN11Action(get_model(), size, is_off(), this, READ);
 }
 
 StorageAction* StorageN11::write(sg_size_t size)
 {
-  return new StorageN11Action(model(), size, isOff(), this, WRITE);
+  return new StorageN11Action(get_model(), size, is_off(), this, WRITE);
 }
 
 /**********
@@ -125,7 +125,7 @@ StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost,
   XBT_IN("(%s,%g", storage->get_cname(), cost);
 
   // Must be less than the max bandwidth for all actions
-  model->get_maxmin_system()->expand(storage->constraint(), get_variable(), 1.0);
+  model->get_maxmin_system()->expand(storage->get_constraint(), get_variable(), 1.0);
   switch(type) {
   case READ:
     model->get_maxmin_system()->expand(storage->constraintRead_, get_variable(), 1.0);