1 #include "cpu_interface.hpp"
7 typedef CpuCas01Model *CpuCas01ModelPtr;
10 typedef CpuCas01 *CpuCas01Ptr;
13 typedef CpuCas01Action *CpuCas01ActionPtr;
18 class CpuCas01Model : public CpuModel {
23 double (CpuCas01Model::*shareResources)(double now);
24 void (CpuCas01Model::*updateActionsState)(double now, double delta);
26 void parseInit(sg_platf_host_cbarg_t host);
27 CpuPtr createResource(const char *name, xbt_dynar_t power_peak, int pstate,
29 tmgr_trace_t power_trace, int core,
30 e_surf_resource_state_t state_initial,
31 tmgr_trace_t state_trace,
32 xbt_dict_t cpu_properties);
33 double shareResourcesFull(double now);
35 ActionListPtr p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
42 * Energy-related properties for the cpu_cas01 model
44 typedef struct energy_cpu_cas01 {
45 xbt_dynar_t power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */
46 double total_energy; /*< Total energy consumed by the host */
47 double last_updated; /*< Timestamp of the last energy update event*/
48 } s_energy_cpu_cas01_t, *energy_cpu_cas01_t;
50 class CpuCas01 : public Cpu {
52 tmgr_trace_event_t p_stateEvent;
54 CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t power_peak,
55 int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
56 e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
57 xbt_dict_t properties) ;
59 void updateState(tmgr_trace_event_t event_type, double value, double date);
60 CpuActionPtr execute(double size);
61 CpuActionPtr sleep(double duration);
63 xbt_dynar_t getWattsRangeList();
64 double getCurrentWattsValue(double cpu_load);
65 void updateEnergy(double cpu_load);
67 double getCurrentPowerPeak();
68 double getPowerPeakAt(int pstate_index);
70 void setPowerPeakAt(int pstate_index);
71 double getConsumedEnergy();
75 tmgr_trace_event_t p_powerEvent;
76 xbt_dynar_t p_powerPeakList; /*< List of supported CPU capacities */
77 int m_pstate; /*< Current pstate (index in the power_peak_list)*/
78 energy_cpu_cas01_t p_energy; /*< Structure with energy-consumption data */
84 class CpuCas01Action: public CpuAction {
85 friend CpuActionPtr CpuCas01::execute(double size);
86 friend CpuActionPtr CpuCas01::sleep(double duration);
89 CpuCas01Action(ModelPtr model, double cost, bool failed, double power, lmm_constraint_t constraint);