1 #include "workstation_interface.hpp"
3 #ifndef WORKSTATION_L07_HPP_
4 #define WORKSTATION_L07_HPP_
10 class WorkstationL07Model;
11 typedef WorkstationL07Model *WorkstationL07ModelPtr;
14 typedef CpuL07Model *CpuL07ModelPtr;
16 class NetworkL07Model;
17 typedef NetworkL07Model *NetworkL07ModelPtr;
20 typedef WorkstationL07 *WorkstationL07Ptr;
23 typedef CpuL07 *CpuL07Ptr;
26 typedef LinkL07 *LinkL07Ptr;
28 class WorkstationL07Action;
29 typedef WorkstationL07Action *WorkstationL07ActionPtr;
38 class WorkstationL07Model : public WorkstationModel {
40 WorkstationL07Model();
41 ~WorkstationL07Model();
43 double shareResources(double now);
44 void updateActionsState(double now, double delta);
45 ResourcePtr createResource(const char *name, double power_scale,
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,
56 xbt_dynar_t getRoute(WorkstationPtr src, WorkstationPtr dst);
57 ActionPtr communicate(WorkstationPtr src, WorkstationPtr dst, double size, double rate);
59 NetworkModelPtr p_networkModel;
62 class CpuL07Model : public CpuModel {
64 CpuL07Model() : CpuModel("cpuL07") {};
65 ~CpuL07Model() {surf_cpu_model_pm = NULL;};
66 ResourcePtr createResource(const char *name, double power_scale,
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;};
74 WorkstationL07ModelPtr p_workstationModel;
77 class NetworkL07Model : public NetworkModel {
79 NetworkL07Model() : NetworkModel() {};
80 ~NetworkL07Model() {surf_network_model = NULL;};
81 NetworkLinkPtr createResource(const char *name,
83 tmgr_trace_t bw_trace,
85 tmgr_trace_t lat_trace,
86 e_surf_resource_state_t
88 tmgr_trace_t state_trace,
89 e_surf_link_sharing_policy_t
90 policy, xbt_dict_t properties);
92 ActionPtr communicate(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, double /*size*/, double /*rate*/) {DIE_IMPOSSIBLE;};
93 void addTraces() {DIE_IMPOSSIBLE;};
94 WorkstationL07ModelPtr p_workstationModel;
101 class WorkstationL07 : public Workstation {
103 WorkstationL07(WorkstationModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
105 bool isUsed() {DIE_IMPOSSIBLE;};
106 void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
107 ActionPtr execute(double size);
108 ActionPtr sleep(double duration);
109 e_surf_resource_state_t getState();
110 double getPowerPeakAt(int pstate_index);
112 void setPowerPeakAt(int pstate_index);
113 double getConsumedEnergy();
116 class CpuL07 : public Cpu {
118 s_surf_metric_t p_power;
119 tmgr_trace_event_t p_stateEvent;
122 CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties,
124 double power_initial, tmgr_trace_t power_trace,
125 e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
127 //bool isUsed() {DIE_IMPOSSIBLE;};
128 void updateState(tmgr_trace_event_t event_type, double value, double date);
129 e_surf_resource_state_t getState();
130 double getSpeed(double load);
131 double getAvailableSpeed();
132 CpuActionPtr execute(double /*size*/) {DIE_IMPOSSIBLE;};
133 CpuActionPtr sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
135 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
136 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
137 int getNbPstates() {THROW_UNIMPLEMENTED;};
138 void setPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
139 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
141 double m_powerCurrent;
144 class LinkL07 : public NetworkLink {
146 LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
148 tmgr_trace_t bw_trace,
150 tmgr_trace_t lat_trace,
151 e_surf_resource_state_t
153 tmgr_trace_t state_trace,
154 e_surf_link_sharing_policy_t policy);
158 void updateState(tmgr_trace_event_t event_type, double value, double date);
159 double getBandwidth();
164 tmgr_trace_event_t p_latEvent;
166 tmgr_trace_event_t p_bwEvent;
172 class WorkstationL07Action : public WorkstationAction {
173 friend ActionPtr WorkstationL07::execute(double size);
174 friend ActionPtr WorkstationL07::sleep(double duration);
175 friend ActionPtr WorkstationL07Model::executeParallelTask(int workstation_nb,
176 void **workstation_list,
178 *computation_amount, double
179 *communication_amount,
182 WorkstationL07Action(ModelPtr model, double cost, bool failed)
183 : WorkstationAction(model, cost, failed) {};
184 ~WorkstationL07Action();
193 void setMaxDuration(double duration);
194 void setPriority(double priority);
198 WorkstationPtr *p_workstationList;
199 double *p_computationAmount;
200 double *p_communicationAmount;
205 #endif /* WORKSTATION_L07_HPP_ */