1 /* Copyright (c) 2013-2015. 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. */
9 #include "cpu_interface.hpp"
18 class XBT_PRIVATE CpuCas01Model;
19 class XBT_PRIVATE CpuCas01;
20 class XBT_PRIVATE CpuCas01Action;
26 class CpuCas01Model : public simgrid::surf::CpuModel {
31 double (CpuCas01Model::*shareResources)(double now);
32 void (CpuCas01Model::*updateActionsState)(double now, double delta);
34 Cpu *createCpu(simgrid::Host *host, xbt_dynar_t speedPeak, int pstate,
36 tmgr_trace_t speedTrace, int core,
37 e_surf_resource_state_t state_initial,
38 tmgr_trace_t state_trace);
39 double shareResourcesFull(double now);
41 ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
48 class CpuCas01 : public Cpu {
50 CpuCas01(CpuCas01Model *model, simgrid::Host *host, xbt_dynar_t speedPeak,
51 int pstate, double speedScale, tmgr_trace_t speedTrace, int core,
52 e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace) ;
54 void updateState(tmgr_trace_event_t event_type, double value, double date);
55 CpuAction *execute(double size);
56 CpuAction *sleep(double duration);
58 double getCurrentPowerPeak();
59 double getPowerPeakAt(int pstate_index);
61 void setPstate(int pstate_index);
64 void setStateEvent(tmgr_trace_event_t stateEvent);
65 void setPowerEvent(tmgr_trace_event_t stateEvent);
66 xbt_dynar_t getSpeedPeakList();
71 tmgr_trace_event_t p_stateEvent;
72 tmgr_trace_event_t p_speedEvent;
73 xbt_dynar_t p_speedPeakList; /*< List of supported CPU capacities (pstate related) */
74 int m_pstate; /*< Current pstate (index in the speedPeakList)*/
80 class CpuCas01Action: public CpuAction {
81 friend CpuAction *CpuCas01::execute(double size);
82 friend CpuAction *CpuCas01::sleep(double duration);
84 CpuCas01Action(Model *model, double cost, bool failed, double speed,
85 lmm_constraint_t constraint);