Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replace surf by surf++ and make it compile
[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 CpuL07;
14 typedef CpuL07 *CpuL07Ptr;
15
16 class LinkL07;
17 typedef LinkL07 *LinkL07Ptr;
18
19 class WorkstationL07ActionLmm;
20 typedef WorkstationL07ActionLmm *WorkstationL07ActionLmmPtr;
21
22 /*FIXME:class WorkstationActionLmm;
23 typedef WorkstationActionLmm *WorkstationActionLmmPtr;*/
24
25 /*********
26  * Tools *
27  *********/
28
29 /*********
30  * Model *
31  *********/
32 class WorkstationL07Model : public WorkstationModel {
33 public:
34   WorkstationL07Model();
35   void parseInit(sg_platf_host_cbarg_t host);
36   WorkstationCLM03Ptr createCpuResource(const char *name, double power_scale,
37                                  double power_initial,
38                                  tmgr_trace_t power_trace,
39                                  e_surf_resource_state_t state_initial,
40                                  tmgr_trace_t state_trace,
41                                  xbt_dict_t cpu_properties);
42   WorkstationCLM03Ptr createLinkResource(const char *name,
43                                                    double bw_initial,
44                                                    tmgr_trace_t bw_trace,
45                                                    double lat_initial,
46                                                    tmgr_trace_t lat_trace,
47                                                    e_surf_resource_state_t
48                                                    state_initial,
49                                                    tmgr_trace_t state_trace,
50                                                    e_surf_link_sharing_policy_t
51                                                    policy, xbt_dict_t properties);
52   double shareResources(double now);
53   void updateActionsState(double now, double delta);
54   void addTraces();
55
56   ActionPtr executeParallelTask(int workstation_nb,
57                                         void **workstation_list,
58                                         double *computation_amount,
59                                         double *communication_amount,
60                                         double rate);
61  xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst);
62  ActionPtr communicate(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst, double size, double rate);
63 };
64
65 class NetworkL07Model : public NetworkCm02Model {
66 public:
67   NetworkL07Model(): NetworkCm02Model() {};
68   xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst) {DIE_IMPOSSIBLE;};
69   ActionPtr communicate(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst, double size, double rate) {DIE_IMPOSSIBLE;};
70   void addTraces() {DIE_IMPOSSIBLE;};
71 };
72
73 /************
74  * Resource *
75  ************/
76
77 class CpuL07 : public WorkstationCLM03Lmm {
78 public:
79   CpuL07(WorkstationL07ModelPtr model, const char* name, xbt_dict_t properties);
80   bool isUsed();
81   void updateState(tmgr_trace_event_t event_type, double value, double date);
82   e_surf_resource_state_t getState();
83   double getSpeed(double load);
84   double getAvailableSpeed();
85   ActionPtr execute(double size);
86   ActionPtr sleep(double duration);
87
88   double m_powerCurrent;
89   RoutingEdgePtr p_info;
90 };
91
92 class LinkL07 : public WorkstationCLM03Lmm {
93 public:
94   LinkL07(WorkstationL07ModelPtr model, const char* name, xbt_dict_t props);
95   bool isUsed();
96   void updateState(tmgr_trace_event_t event_type, double value, double date);
97   double getBandwidth();
98   double getLatency();
99   bool isShared();
100
101   double m_latCurrent;
102   tmgr_trace_event_t p_latEvent;
103   double m_bwCurrent;
104   tmgr_trace_event_t p_bwEvent;
105 };
106
107 /**********
108  * Action *
109  **********/
110 class WorkstationL07ActionLmm : public WorkstationActionLmm {
111 public:
112   WorkstationL07ActionLmm(ModelPtr model, double cost, bool failed): WorkstationActionLmm(model, cost, failed) {};
113  ~WorkstationL07ActionLmm();
114
115   void updateBound();
116
117   int unref();
118   void cancel();
119   void suspend();
120   void resume();
121   bool isSuspended();
122   void setMaxDuration(double duration);
123   void setPriority(double priority);
124   double getRemains();
125
126   int m_workstationNb;
127   WorkstationCLM03Ptr *p_workstationList;
128   double *p_computationAmount;
129   double *p_communicationAmount;
130   double m_latency;
131   double m_rate;
132 };
133
134 #endif /* WORKSTATION_L07_HPP_ */