Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No vm when ptask on
[simgrid.git] / src / surf / workstation_ptask_L07.hpp
1 #include "workstation.hpp"
2
3 #ifndef WORKSTATION_L07_HPP_
4 #define WORKSTATION_L07_HPP_
5
6 /***********
7  * Classes *
8  ***********/
9
10 class WorkstationL07Model;
11 typedef WorkstationL07Model *WorkstationL07ModelPtr;
12
13 class CpuL07Model;
14 typedef CpuL07Model *CpuL07ModelPtr;
15
16 class NetworkL07Model;
17 typedef NetworkL07Model *NetworkL07ModelPtr;
18
19 class WorkstationL07;
20 typedef WorkstationL07 *WorkstationL07Ptr;
21
22 class CpuL07;
23 typedef CpuL07 *CpuL07Ptr;
24
25 class LinkL07;
26 typedef LinkL07 *LinkL07Ptr;
27
28 class WorkstationL07ActionLmm;
29 typedef WorkstationL07ActionLmm *WorkstationL07ActionLmmPtr;
30
31 /*FIXME:class WorkstationActionLmm;
32 typedef WorkstationActionLmm *WorkstationActionLmmPtr;*/
33
34 /*********
35  * Tools *
36  *********/
37
38 /*********
39  * Model *
40  *********/
41 class WorkstationL07Model : public WorkstationModel {
42 public:
43   WorkstationL07Model();
44   ~WorkstationL07Model();
45
46   double shareResources(double now);
47   void updateActionsState(double now, double delta);
48   ResourcePtr createResource(const char *name, double power_scale,
49                                  double power_initial,
50                                  tmgr_trace_t power_trace,
51                                  e_surf_resource_state_t state_initial,
52                                  tmgr_trace_t state_trace,
53                                  xbt_dict_t cpu_properties);
54   ActionPtr executeParallelTask(int workstation_nb,
55                                         void **workstation_list,
56                                         double *computation_amount,
57                                         double *communication_amount,
58                                         double rate);
59   xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst);
60   ActionPtr communicate(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst, double size, double rate);
61   void addTraces();
62   CpuL07ModelPtr p_cpuModel;
63   NetworkL07ModelPtr p_networkModel;
64 };
65
66 class CpuL07Model : public CpuModel {
67 public:
68   CpuL07Model() : CpuModel("cpuL07") {};
69   ~CpuL07Model() {surf_cpu_model_pm = NULL;};
70   ResourcePtr createResource(const char *name, double power_scale,
71                                  double power_initial,
72                                  tmgr_trace_t power_trace,
73                                  e_surf_resource_state_t state_initial,
74                                  tmgr_trace_t state_trace,
75                                  xbt_dict_t cpu_properties);
76   void addTraces() {DIE_IMPOSSIBLE;};
77   WorkstationL07ModelPtr p_workstationModel;
78 };
79
80 class NetworkL07Model : public NetworkCm02Model {
81 public:
82   NetworkL07Model() : NetworkCm02Model(0) {};
83   ~NetworkL07Model() {surf_network_model = NULL;};
84   ResourcePtr createResource(const char *name,
85                                                    double bw_initial,
86                                                    tmgr_trace_t bw_trace,
87                                                    double lat_initial,
88                                                    tmgr_trace_t lat_trace,
89                                                    e_surf_resource_state_t
90                                                    state_initial,
91                                                    tmgr_trace_t state_trace,
92                                                    e_surf_link_sharing_policy_t
93                                                    policy, xbt_dict_t properties);
94
95   xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst) {DIE_IMPOSSIBLE;};
96   ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate) {DIE_IMPOSSIBLE;};
97   void addTraces() {DIE_IMPOSSIBLE;};
98   WorkstationL07ModelPtr p_workstationModel;
99 };
100
101 /************
102  * Resource *
103  ************/
104
105 class WorkstationL07 : public WorkstationCLM03Lmm {
106 public:
107   WorkstationL07(WorkstationModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
108   //bool isUsed();
109   bool isUsed() {DIE_IMPOSSIBLE;};
110   void updateState(tmgr_trace_event_t event_type, double value, double date) {DIE_IMPOSSIBLE;};
111   ActionPtr execute(double size);
112   ActionPtr sleep(double duration);
113   e_surf_resource_state_t getState();
114   double getPowerPeakAt(int pstate_index);
115   int getNbPstates();
116   void setPowerPeakAt(int pstate_index);
117   double getConsumedEnergy();
118 };
119
120 class CpuL07 : public CpuLmm {
121 public:
122   CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties);
123   bool isUsed();
124   //bool isUsed() {DIE_IMPOSSIBLE;};
125   void updateState(tmgr_trace_event_t event_type, double value, double date);
126   e_surf_resource_state_t getState();
127   double getSpeed(double load);
128   double getAvailableSpeed();
129   ActionPtr execute(double size) {DIE_IMPOSSIBLE;};
130   ActionPtr sleep(double duration) {DIE_IMPOSSIBLE;};
131
132   double getCurrentPowerPeak() {};
133   double getPowerPeakAt(int pstate_index) {};
134   int getNbPstates() {};
135   void setPowerPeakAt(int pstate_index) {};
136   double getConsumedEnergy() {};
137
138   double m_powerCurrent;
139 };
140
141 class LinkL07 : public NetworkCm02LinkLmm {
142 public:
143   LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props);
144   bool isUsed();
145   void updateState(tmgr_trace_event_t event_type, double value, double date);
146   double getBandwidth();
147   double getLatency();
148   bool isShared();
149
150   double m_latCurrent;
151   tmgr_trace_event_t p_latEvent;
152   double m_bwCurrent;
153   tmgr_trace_event_t p_bwEvent;
154 };
155
156 /**********
157  * Action *
158  **********/
159 class WorkstationL07ActionLmm : public WorkstationActionLmm {
160 public:
161   WorkstationL07ActionLmm(ModelPtr model, double cost, bool failed)
162   : Action(model, cost, failed), WorkstationActionLmm(model, cost, failed) {};
163  ~WorkstationL07ActionLmm();
164
165   void updateBound();
166
167   int unref();
168   void cancel();
169   void suspend();
170   void resume();
171   bool isSuspended();
172   void setMaxDuration(double duration);
173   void setPriority(double priority);
174   double getRemains();
175
176   int m_workstationNb;
177   WorkstationCLM03Ptr *p_workstationList;
178   double *p_computationAmount;
179   double *p_communicationAmount;
180   double m_latency;
181   double m_rate;
182 };
183
184 #endif /* WORKSTATION_L07_HPP_ */