Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix doxygen comments.
[simgrid.git] / src / surf / cpu_cas01.hpp
1 /* Copyright (c) 2013-2014. 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 "cpu_interface.hpp"
8
9 /***********
10  * Classes *
11  ***********/
12 class CpuCas01Model;
13 typedef CpuCas01Model *CpuCas01ModelPtr;
14
15 class CpuCas01;
16 typedef CpuCas01 *CpuCas01Ptr;
17
18 class CpuCas01Action;
19 typedef CpuCas01Action *CpuCas01ActionPtr;
20
21 /*********
22  * Model *
23  *********/
24 class CpuCas01Model : public CpuModel {
25 public:
26   CpuCas01Model();
27   ~CpuCas01Model();
28
29   double (CpuCas01Model::*shareResources)(double now);
30   void (CpuCas01Model::*updateActionsState)(double now, double delta);
31
32   void parseInit(sg_platf_host_cbarg_t host);  
33   CpuPtr createResource(const char *name, xbt_dynar_t power_peak, int pstate,
34                                   double power_scale,
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);  
40   void addTraces();
41   ActionListPtr p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
42 };
43
44 /************
45  * Resource *
46  ************/
47
48 class CpuCas01 : public Cpu {
49 public:
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) ;
54   ~CpuCas01();
55   void updateState(tmgr_trace_event_t event_type, double value, double date);
56   CpuActionPtr execute(double size);
57   CpuActionPtr sleep(double duration);
58
59   double getCurrentPowerPeak();
60   double getPowerPeakAt(int pstate_index);
61   int getNbPstates();
62   void setPowerPeakAt(int pstate_index);
63   bool isUsed();
64   void setStateEvent(tmgr_trace_event_t stateEvent);
65   void setPowerEvent(tmgr_trace_event_t stateEvent);
66   xbt_dynar_t getPowerPeakList();
67
68   int getPState();
69
70 private:
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)*/
75 };
76
77 /**********
78  * Action *
79  **********/
80 class CpuCas01Action: public CpuAction {
81   friend CpuActionPtr CpuCas01::execute(double size);
82   friend CpuActionPtr CpuCas01::sleep(double duration);
83 public:
84   CpuCas01Action() {};
85   CpuCas01Action(ModelPtr model, double cost, bool failed, double power, lmm_constraint_t constraint);
86
87   ~CpuCas01Action() {};
88 };