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 void parseInit(sg_platf_host_cbarg_t host);
33 CpuPtr createResource(const char *name, xbt_dynar_t power_peak, int pstate,
35 tmgr_trace_t power_trace, int core,
36 e_surf_resource_state_t state_initial,
37 tmgr_trace_t state_trace,
38 xbt_dict_t cpu_properties);
39 double shareResourcesFull(double now);
41 ActionListPtr p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
48 class CpuCas01 : public Cpu {
50 CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t power_peak,
51 int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
52 e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
53 xbt_dict_t properties) ;
55 void updateState(tmgr_trace_event_t event_type, double value, double date);
56 CpuActionPtr execute(double size);
57 CpuActionPtr sleep(double duration);
59 double getCurrentPowerPeak();
60 double getPowerPeakAt(int pstate_index);
62 void setPowerPeakAt(int pstate_index);
64 void setStateEvent(tmgr_trace_event_t stateEvent);
65 void setPowerEvent(tmgr_trace_event_t stateEvent);
66 xbt_dynar_t getPowerPeakList();
71 tmgr_trace_event_t p_stateEvent;
72 tmgr_trace_event_t p_powerEvent;
73 xbt_dynar_t p_powerPeakList; /*< List of supported CPU capacities */
74 int m_pstate; /*< Current pstate (index in the power_peak_list)*/
80 class CpuCas01Action: public CpuAction {
81 friend CpuActionPtr CpuCas01::execute(double size);
82 friend CpuActionPtr CpuCas01::sleep(double duration);
85 CpuCas01Action(ModelPtr model, double cost, bool failed, double power, lmm_constraint_t constraint);