Logo AND Algorithmique Numérique Distribuée

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