X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fc646b32904fce0465f564d149a830c8e7aeffe4..6a842fbc88eba9f783c6599c541577e70c49aa1a:/src/surf/cpu_interface.hpp diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index f96a75d46e..cb672bef21 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -38,7 +38,7 @@ public: * This ignores any potential external load coming from a trace. * @param core The number of core of this Cpu */ - virtual Cpu* create_cpu(s4u::Host* host, const std::vector& speed_per_pstate) = 0; + virtual CpuImpl* create_cpu(s4u::Host* host, const std::vector& speed_per_pstate) = 0; void update_actions_state_lazy(double now, double delta) override; void update_actions_state_full(double now, double delta) override; @@ -48,7 +48,7 @@ public: * Resource * ************/ -class XBT_PUBLIC Cpu : public Resource_T { +class XBT_PUBLIC CpuImpl : public Resource_T { friend vm::VirtualMachineImpl; // Resets the VCPU s4u::Host* piface_; @@ -64,15 +64,15 @@ public: * @param host The host in which this Cpu should be plugged * @param speed_per_pstate Processor speed (in flop per second) for each pstate */ - Cpu(s4u::Host* host, const std::vector& speed_per_pstate); + CpuImpl(s4u::Host* host, const std::vector& speed_per_pstate); - Cpu(const Cpu&) = delete; - Cpu& operator=(const Cpu&) = delete; + CpuImpl(const CpuImpl&) = delete; + CpuImpl& operator=(const CpuImpl&) = delete; /** @brief Public interface */ s4u::Host* get_iface() { return piface_; } - Cpu* set_core_count(int core_count); + CpuImpl* set_core_count(int core_count); virtual int get_core_count(); void seal() override; @@ -97,13 +97,20 @@ public: virtual int get_pstate_count() const { return speed_per_pstate_.size(); } - virtual void set_pstate(int pstate_index); virtual int get_pstate() const { return pstate_; } + virtual CpuImpl* set_pstate(int pstate_index); - /*< @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) + /*< @brief Setup the profile file with availability events (peak speed changes due to external load). + * Profile must contain relative values (ratio between 0 and 1) */ - virtual void set_speed_profile(profile::Profile* profile); + virtual CpuImpl* set_speed_profile(profile::Profile* profile); + + /** + * @brief Set the CPU's speed + * + * @param speed_per_state list of powers for this processor (default power is at index 0) + */ + CpuImpl* set_pstate_speed(const std::vector& speed_per_state); /** * @brief Execute some quantity of computation @@ -139,7 +146,7 @@ protected: * Used to reset a VCPU when its VM migrates to another host, so it only resets the fields that should be in this *case. **/ - virtual void reset_vcpu(Cpu* that); + virtual void reset_vcpu(CpuImpl* that); Metric speed_ = {1.0, 0, nullptr}; }; @@ -163,7 +170,7 @@ public: void set_state(Action::State state) override; void update_remains_lazy(double now) override; - std::list cpus() const; + std::list cpus() const; void suspend() override; void resume() override;