* This ignores any potential external load coming from a trace.
* @param core The number of core of this Cpu
*/
- virtual Cpu* create_cpu(simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core) = 0;
+ virtual Cpu* create_cpu(simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) = 0;
void update_actions_state_lazy(double now, double delta) override;
void update_actions_state_full(double now, double delta) override;
* @param speedPerPstate Processor speed (in flop per second) for each pstate
* @param core The number of core of this Cpu
*/
- Cpu(simgrid::kernel::resource::Model * model, simgrid::s4u::Host * host, kernel::lmm::Constraint * constraint,
- std::vector<double> * speedPerPstate, int core);
+ Cpu(simgrid::kernel::resource::Model* model, simgrid::s4u::Host* host, kernel::lmm::Constraint* constraint,
+ const std::vector<double>& speed_per_pstate, int core);
/**
* @brief Cpu constructor
* @param speedPerPstate Processor speed (in flop per second) for each pstate
* @param core The number of core of this Cpu
*/
- Cpu(simgrid::kernel::resource::Model * model, simgrid::s4u::Host * host, std::vector<double> * speedPerPstate,
+ Cpu(simgrid::kernel::resource::Model* model, simgrid::s4u::Host* host, const std::vector<double>& speed_per_pstate,
int core);
Cpu(const Cpu&) = delete;
Cpu& operator=(const Cpu&) = delete;
- ~Cpu();
/**
* @brief Execute some quantity of computation
*
* If you want to know the amount of flops currently delivered, use load = get_load()*get_speed_ratio()
*/
- virtual double get_speed(double load);
+ virtual double get_speed(double load) const;
protected:
/** @brief Take speed changes (either load or max) into account */
virtual double get_speed_ratio();
/** @brief Get the peak processor speed (in flops/s), at the specified pstate */
- virtual double get_pstate_peak_speed(int pstate_index);
+ virtual double get_pstate_peak_speed(int pstate_index) const;
- virtual int get_pstate_count();
+ virtual int get_pstate_count() const;
virtual void set_pstate(int pstate_index);
- virtual int get_pstate();
+ virtual int get_pstate() const;
simgrid::s4u::Host* get_host() { return host_; }
simgrid::s4u::Host* host_;
int pstate_ = 0; /*< Current pstate (index in the speed_per_pstate_)*/
- std::vector<double> speed_per_pstate_; /*< List of supported CPU capacities (pstate related) */
+ const std::vector<double> speed_per_pstate_; /*< List of supported CPU capacities (pstate related) */
public:
/*< @brief Setup the trace file with availability events (peak speed changes due to external load).