From b7138be693dd610dad629018e62b874f7654e390 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 20 May 2018 15:36:55 +0200 Subject: [PATCH] privatize some fields of kernel::resource::Cpu --- src/surf/cpu_cas01.cpp | 6 +++--- src/surf/cpu_interface.hpp | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 4d6329f18a..0b61967404 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -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(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()) diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 10f6232abb..26f76ac088 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -125,12 +125,15 @@ public: simgrid::s4u::Host* get_host() { return host_; } +private: int cores_count_ = 1; simgrid::s4u::Host* host_; - std::vector speed_per_pstate_; /*< List of supported CPU capacities (pstate related) */ int pstate_ = 0; /*< Current pstate (index in the speedPeakList)*/ +protected: + std::vector 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 -- 2.20.1