1 /* Copyright (c) 2013-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "cpu_interface.hpp"
13 typedef CpuCas01Model *CpuCas01ModelPtr;
16 typedef CpuCas01 *CpuCas01Ptr;
19 typedef CpuCas01Action *CpuCas01ActionPtr;
24 class CpuCas01Model : public CpuModel {
29 double (CpuCas01Model::*shareResources)(double now);
30 void (CpuCas01Model::*updateActionsState)(double now, double delta);
32 CpuPtr createCpu(const char *name, xbt_dynar_t power_peak, int pstate,
34 tmgr_trace_t power_trace, int core,
35 e_surf_resource_state_t state_initial,
36 tmgr_trace_t state_trace,
37 xbt_dict_t cpu_properties);
38 double shareResourcesFull(double now);
40 ActionListPtr p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
47 class CpuCas01 : public Cpu {
49 CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t power_peak,
50 int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
51 e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
52 xbt_dict_t properties) ;
54 void updateState(tmgr_trace_event_t event_type, double value, double date);
55 CpuActionPtr execute(double size);
56 CpuActionPtr sleep(double duration);
58 double getCurrentPowerPeak();
59 double getPowerPeakAt(int pstate_index);
61 void setPowerPeakAt(int pstate_index);
63 void setStateEvent(tmgr_trace_event_t stateEvent);
64 void setPowerEvent(tmgr_trace_event_t stateEvent);
65 xbt_dynar_t getPowerPeakList();
70 tmgr_trace_event_t p_stateEvent;
71 tmgr_trace_event_t p_powerEvent;
72 xbt_dynar_t p_powerPeakList; /*< List of supported CPU capacities */
73 int m_pstate; /*< Current pstate (index in the power_peak_list)*/
79 class CpuCas01Action: public CpuAction {
80 friend CpuActionPtr CpuCas01::execute(double size);
81 friend CpuActionPtr CpuCas01::sleep(double duration);
83 CpuCas01Action(ModelPtr model, double cost, bool failed, double power,
84 lmm_constraint_t constraint);