Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make HostL07 behave more like the regular Host
[simgrid.git] / src / surf / cpu_cas01.hpp
1 /* Copyright (c) 2013-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include <xbt/base.h>
8
9 #include "cpu_interface.hpp"
10
11 /***********
12  * Classes *
13  ***********/
14 class XBT_PRIVATE CpuCas01Model;
15 class XBT_PRIVATE CpuCas01;
16 class XBT_PRIVATE CpuCas01Action;
17
18 /*********
19  * Model *
20  *********/
21 class CpuCas01Model : public CpuModel {
22 public:
23   CpuCas01Model();
24   ~CpuCas01Model();
25
26   double (CpuCas01Model::*shareResources)(double now);
27   void (CpuCas01Model::*updateActionsState)(double now, double delta);
28
29   Cpu *createCpu(const char *name, xbt_dynar_t power_peak, int pstate,
30                    double power_scale,
31                           tmgr_trace_t power_trace, int core,
32                           e_surf_resource_state_t state_initial,
33                           tmgr_trace_t state_trace,
34                           xbt_dict_t cpu_properties);
35   double shareResourcesFull(double now);
36   void addTraces();
37   ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
38 };
39
40 /************
41  * Resource *
42  ************/
43
44 class CpuCas01 : public Cpu {
45 public:
46   CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t power_peak,
47         int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
48         e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
49         xbt_dict_t properties) ;
50   ~CpuCas01();
51   void updateState(tmgr_trace_event_t event_type, double value, double date);
52   CpuAction *execute(double size);
53   CpuAction *sleep(double duration);
54
55   double getCurrentPowerPeak();
56   double getPowerPeakAt(int pstate_index);
57   int getNbPstates();
58   void setPstate(int pstate_index);
59   int  getPstate();
60   bool isUsed();
61   void setStateEvent(tmgr_trace_event_t stateEvent);
62   void setPowerEvent(tmgr_trace_event_t stateEvent);
63   xbt_dynar_t getPowerPeakList();
64
65   int getPState();
66
67 private:
68   tmgr_trace_event_t p_stateEvent;
69   tmgr_trace_event_t p_powerEvent;
70   xbt_dynar_t p_powerPeakList;       /*< List of supported CPU capacities */
71   int m_pstate;                      /*< Current pstate (index in the power_peak_list)*/
72 };
73
74 /**********
75  * Action *
76  **********/
77 class CpuCas01Action: public CpuAction {
78   friend CpuAction *CpuCas01::execute(double size);
79   friend CpuAction *CpuCas01::sleep(double duration);
80 public:
81   CpuCas01Action(Model *model, double cost, bool failed, double power,
82                  lmm_constraint_t constraint);
83
84   ~CpuCas01Action() {};
85 };