Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
privatize some fields of kernel::resource::Cpu
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 20 May 2018 13:36:55 +0000 (15:36 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 20 May 2018 13:36:55 +0000 (15:36 +0200)
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.hpp

index 4d6329f..0b61967 100644 (file)
@@ -111,7 +111,7 @@ void CpuCas01::onSpeedChange() {
   const kernel::lmm::Element* elem = nullptr;
 
   get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(),
-                                                            cores_count_ * speed_.scale * speed_.peak);
+                                                            get_cores_count() * speed_.scale * speed_.peak);
   while ((var = get_constraint()->get_variable(&elem))) {
     CpuCas01Action* action = static_cast<CpuCas01Action*>(var->get_id());
 
@@ -126,7 +126,7 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value)
 {
   if (event == speed_.event) {
     /* TODO (Hypervisor): do the same thing for constraint_core[i] */
-    xbt_assert(cores_count_ == 1, "FIXME: add speed scaling code also for constraint_core[i]");
+    xbt_assert(get_cores_count() == 1, "FIXME: add speed scaling code also for constraint_core[i]");
 
     speed_.scale = value;
     onSpeedChange();
@@ -134,7 +134,7 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value)
     tmgr_trace_event_unref(&speed_.event);
   } else if (event == state_event_) {
     /* TODO (Hypervisor): do the same thing for constraint_core[i] */
-    xbt_assert(cores_count_ == 1, "FIXME: add state change code also for constraint_core[i]");
+    xbt_assert(get_cores_count() == 1, "FIXME: add state change code also for constraint_core[i]");
 
     if (value > 0) {
       if (is_off())
index 10f6232..26f76ac 100644 (file)
@@ -125,12 +125,15 @@ public:
 
   simgrid::s4u::Host* get_host() { return host_; }
 
+private:
   int cores_count_ = 1;
   simgrid::s4u::Host* host_;
 
-  std::vector<double> speed_per_pstate_; /*< List of supported CPU capacities (pstate related) */
   int pstate_ = 0;                     /*< Current pstate (index in the speedPeakList)*/
+protected:
+  std::vector<double> speed_per_pstate_; /*< List of supported CPU capacities (pstate related) */
 
+public:
   virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values (0 or 1). */
   virtual void
   set_speed_trace(tmgr_trace_t trace); /*< setup the trace file with availability events (peak speed changes due to