* 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<double>& speed_per_pstate, int core) = 0;
+ virtual CpuImpl* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) = 0;
void update_actions_state_lazy(double now, double delta) override;
void update_actions_state_full(double now, double delta) override;
* Resource *
************/
-class XBT_PUBLIC Cpu : public Resource_T<Cpu> {
+class XBT_PUBLIC CpuImpl : public Resource_T<CpuImpl> {
friend vm::VirtualMachineImpl; // Resets the VCPU
s4u::Host* piface_;
* @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<double>& speed_per_pstate);
+ CpuImpl(s4u::Host* host, const std::vector<double>& 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;
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<double>& speed_per_state);
/**
* @brief Execute some quantity of computation
* 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};
};
void set_state(Action::State state) override;
void update_remains_lazy(double now) override;
- std::list<Cpu*> cpus() const;
+ std::list<CpuImpl*> cpus() const;
void suspend() override;
void resume() override;