From f3da0e53f20a27db79c661314020550b7b9d0bcd Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 21 May 2018 21:04:55 +0200 Subject: [PATCH 1/1] make k:r:Cpu::speed_per_pstate_ private as it should --- src/surf/cpu_cas01.cpp | 10 +--------- src/surf/cpu_cas01.hpp | 2 -- src/surf/cpu_interface.cpp | 6 +++++- src/surf/cpu_interface.hpp | 13 ++++++++----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 0b61967404..7f5c672df0 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -90,15 +90,7 @@ CpuCas01::CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, std::vector * CpuCas01::getSpeedPeakList(){ - return &speed_per_pstate_; -} +CpuCas01::~CpuCas01() = default; bool CpuCas01::is_used() { diff --git a/src/surf/cpu_cas01.hpp b/src/surf/cpu_cas01.hpp index 0009db9af2..da01315ea7 100644 --- a/src/surf/cpu_cas01.hpp +++ b/src/surf/cpu_cas01.hpp @@ -44,8 +44,6 @@ public: bool is_used() override; - std::vector * getSpeedPeakList(); // FIXME: killme to hide our internals - protected: void onSpeedChange() override; }; diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index a8b793d17f..7fffcb5ab7 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -75,7 +75,11 @@ Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, kernel::lmm:: } } -Cpu::~Cpu() = default; +Cpu::~Cpu() +{ + if (get_model() == surf_cpu_model_pm) + speed_per_pstate_.clear(); +} int Cpu::get_pstates_count() { diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 26f76ac088..83115b9a38 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -130,14 +130,17 @@ private: simgrid::s4u::Host* host_; 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 - external load). Trace must contain relative values (ratio between 0 and 1) */ + /** @brief Setup the trace file with states events (ON or OFF). + * Trace must contain boolean values (0 or 1). + */ + virtual void setStateTrace(tmgr_trace_t trace); + /*< @brief Setup the trace file with availability events (peak speed changes due to external load). + * Trace must contain relative values (ratio between 0 and 1) + */ + virtual void set_speed_trace(tmgr_trace_t trace); tmgr_trace_event_t state_event_ = nullptr; Metric speed_ = {1.0, 0, nullptr}; -- 2.20.1