Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix tests
[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
45   double shareResources(double now);
46   void updateActionsState(double now, double delta);
47   ResourcePtr createResource(const char *name, double power_scale,
48                                  double power_initial,
49                                  tmgr_trace_t power_trace,
50                                  e_surf_resource_state_t state_initial,
51                                  tmgr_trace_t state_trace,
52                                  xbt_dict_t cpu_properties);
53   ActionPtr executeParallelTask(int workstation_nb,
54                                         void **workstation_list,
55                                         double *computation_amount,
56                                         double *communication_amount,
57                                         double rate);
58   xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst);
59   ActionPtr communicate(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst, double size, double rate);
60   void addTraces();
61   CpuL07ModelPtr p_cpuModel;
62   NetworkL07ModelPtr p_networkModel;
63 };
64
65 class CpuL07Model : public CpuModel {
66 public:
67   CpuL07Model() : CpuModel("cpuL07") {};
68   ResourcePtr createResource(const char *name, double power_scale,
69                                  double power_initial,
70                                  tmgr_trace_t power_trace,
71                                  e_surf_resource_state_t state_initial,
72                                  tmgr_trace_t state_trace,
73                                  xbt_dict_t cpu_properties);
74   void addTraces() {DIE_IMPOSSIBLE;};
75   WorkstationL07ModelPtr p_workstationModel;
76 };
77
78 class NetworkL07Model : public NetworkCm02Model {
79 public:
80   NetworkL07Model() : NetworkCm02Model(0) {};
81   ResourcePtr 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   NetworkCm02ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
92                                            double size, double rate);
93   xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst) {DIE_IMPOSSIBLE;};
94   ActionPtr communicate(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst, double size, double rate) {DIE_IMPOSSIBLE;};
95   void addTraces() {DIE_IMPOSSIBLE;};
96   WorkstationL07ModelPtr p_workstationModel;
97 };
98
99 /************
100  * Resource *
101  ************/
102
103 class WorkstationL07 : public WorkstationCLM03Lmm {
104 public:
105   WorkstationL07(WorkstationModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
106   bool isUsed();
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 };
112
113 class CpuL07 : public CpuLmm {
114 public:
115   CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties);
116   bool isUsed() {DIE_IMPOSSIBLE;};
117   void updateState(tmgr_trace_event_t event_type, double value, double date);
118   e_surf_resource_state_t getState();
119   double getSpeed(double load);
120   double getAvailableSpeed();
121   ActionPtr execute(double size) {DIE_IMPOSSIBLE;};
122   ActionPtr sleep(double duration) {DIE_IMPOSSIBLE;};
123   double m_powerCurrent;
124 };
125
126 class LinkL07 : public NetworkCm02LinkLmm {
127 public:
128   LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props);
129   bool isUsed() {DIE_IMPOSSIBLE;};
130   void updateState(tmgr_trace_event_t event_type, double value, double date);
131   double getBandwidth();
132   double getLatency();
133   bool isShared();
134
135   double m_latCurrent;
136   tmgr_trace_event_t p_latEvent;
137   double m_bwCurrent;
138   tmgr_trace_event_t p_bwEvent;
139 };
140
141 /**********
142  * Action *
143  **********/
144 class WorkstationL07ActionLmm : public WorkstationActionLmm {
145 public:
146   WorkstationL07ActionLmm(ModelPtr model, double cost, bool failed)
147   : Action(model, cost, failed), WorkstationActionLmm(model, cost, failed) {};
148  ~WorkstationL07ActionLmm();
149
150   void updateBound();
151
152   int unref();
153   void cancel();
154   void suspend();
155   void resume();
156   bool isSuspended();
157   void setMaxDuration(double duration);
158   void setPriority(double priority);
159   double getRemains();
160
161   int m_workstationNb;
162   WorkstationCLM03Ptr *p_workstationList;
163   double *p_computationAmount;
164   double *p_communicationAmount;
165   double m_latency;
166   double m_rate;
167 };
168
169 #endif /* WORKSTATION_L07_HPP_ */