X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4736926935eb52f1e561715d2fa5a3fc4144a188..d152b8d41e99f1c87e94bf1030576f9ccf34898b:/src/surf/cpu_interface.hpp diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 4f1b156247..0ab1e484c8 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -74,10 +74,6 @@ public: */ XBT_PUBLIC_CLASS Cpu : public simgrid::surf::Resource { public: - static simgrid::xbt::Extension EXTENSION_ID; - static void classInit(); - Cpu(); - /** * @brief Cpu constructor * @@ -89,8 +85,9 @@ public: * @param speedScale The speed scale of this Cpu in [0;1] (available amount) * @param stateInitial whether it is created running or crashed */ - Cpu(simgrid::surf::Model *model, simgrid::Host *host, - lmm_constraint_t constraint, int core, double speedPeak, double speedScale, + Cpu(simgrid::surf::Model *model, simgrid::Host *host, lmm_constraint_t constraint, + xbt_dynar_t speedPeakList, int pstate, + int core, double speedPeak, double speedScale, e_surf_resource_state_t stateInitial); /** @@ -104,14 +101,10 @@ public: * @param stateInitial whether it is created running or crashed */ Cpu(simgrid::surf::Model *model, simgrid::Host *host, + xbt_dynar_t speedPeakList, int pstate, int core, double speedPeak, double speedScale, e_surf_resource_state_t stateInitial); - Cpu(simgrid::surf::Model *model, simgrid::Host *host, - lmm_constraint_t constraint, int core, double speedPeak, double speedScale); - Cpu(simgrid::surf::Model *model, simgrid::Host *host, - int core, double speedPeak, double speedScale); - ~Cpu(); /** @@ -136,17 +129,22 @@ public: /** @brief Get the speed, accounting for the trace load and provided process load instead of the real current one */ virtual double getSpeed(double load); +protected: + /** @brief Take speed changes (either load or max) into account */ + virtual void onSpeedChange(); + +public: /** @brief Get the available speed of the current Cpu */ virtual double getAvailableSpeed(); /** @brief Get the current Cpu power peak */ virtual double getCurrentPowerPeak(); - virtual double getPowerPeakAt(int pstate_index)=0; + virtual double getPowerPeakAt(int pstate_index); - virtual int getNbPstates()=0; - virtual void setPstate(int pstate_index)=0; - virtual int getPstate()=0; + virtual int getNbPStates(); + virtual void setPState(int pstate_index); + virtual int getPState(); void addTraces(void); simgrid::Host* getHost() { return m_host; } @@ -157,6 +155,9 @@ public: double m_speedScale; /*< Percentage of CPU available according to the trace, in [O,1] */ simgrid::Host* m_host; + xbt_dynar_t p_speedPeakList = NULL; /*< List of supported CPU capacities (pstate related) */ + int m_pstate = 0; /*< Current pstate (index in the speedPeakList)*/ + /* Note (hypervisor): */ lmm_constraint_t *p_constraintCore=NULL; void **p_constraintCoreId=NULL;