1 /* Copyright (c) 2013-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "workstation_interface.hpp"
9 #ifndef WORKSTATION_L07_HPP_
10 #define WORKSTATION_L07_HPP_
16 class WorkstationL07Model;
17 typedef WorkstationL07Model *WorkstationL07ModelPtr;
20 typedef CpuL07Model *CpuL07ModelPtr;
22 class NetworkL07Model;
23 typedef NetworkL07Model *NetworkL07ModelPtr;
26 typedef WorkstationL07 *WorkstationL07Ptr;
29 typedef CpuL07 *CpuL07Ptr;
32 typedef LinkL07 *LinkL07Ptr;
34 class WorkstationL07Action;
35 typedef WorkstationL07Action *WorkstationL07ActionPtr;
44 class WorkstationL07Model : public WorkstationModel {
46 WorkstationL07Model();
47 ~WorkstationL07Model();
49 double shareResources(double now);
50 void updateActionsState(double now, double delta);
51 ResourcePtr createResource(const char *name, double power_scale,
53 tmgr_trace_t power_trace,
54 e_surf_resource_state_t state_initial,
55 tmgr_trace_t state_trace,
56 xbt_dict_t cpu_properties);
57 ActionPtr executeParallelTask(int workstation_nb,
58 void **workstation_list,
59 double *computation_amount,
60 double *communication_amount,
62 xbt_dynar_t getRoute(WorkstationPtr src, WorkstationPtr dst);
63 ActionPtr communicate(WorkstationPtr src, WorkstationPtr dst, double size, double rate);
65 NetworkModelPtr p_networkModel;
68 class CpuL07Model : public CpuModel {
70 CpuL07Model() : CpuModel("cpuL07") {};
71 ~CpuL07Model() {surf_cpu_model_pm = NULL;};
72 ResourcePtr createResource(const char *name, double power_scale,
74 tmgr_trace_t power_trace,
75 e_surf_resource_state_t state_initial,
76 tmgr_trace_t state_trace,
77 xbt_dict_t cpu_properties);
78 void addTraces() {DIE_IMPOSSIBLE;};
80 WorkstationL07ModelPtr p_workstationModel;
83 class NetworkL07Model : public NetworkModel {
85 NetworkL07Model() : NetworkModel() {};
86 ~NetworkL07Model() {surf_network_model = NULL;};
87 NetworkLinkPtr createResource(const char *name,
89 tmgr_trace_t bw_trace,
91 tmgr_trace_t lat_trace,
92 e_surf_resource_state_t
94 tmgr_trace_t state_trace,
95 e_surf_link_sharing_policy_t
96 policy, xbt_dict_t properties);
98 ActionPtr communicate(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, double /*size*/, double /*rate*/) {DIE_IMPOSSIBLE;};
99 void addTraces() {DIE_IMPOSSIBLE;};
100 WorkstationL07ModelPtr p_workstationModel;
107 class WorkstationL07 : public Workstation {
109 WorkstationL07(WorkstationModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
111 bool isUsed() {DIE_IMPOSSIBLE;};
112 void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
113 ActionPtr execute(double size);
114 ActionPtr sleep(double duration);
115 e_surf_resource_state_t getState();
116 double getPowerPeakAt(int pstate_index);
118 void setPowerPeakAt(int pstate_index);
119 double getConsumedEnergy();
122 class CpuL07 : public Cpu {
124 s_surf_metric_t p_power;
125 tmgr_trace_event_t p_stateEvent;
128 CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties,
130 double power_initial, tmgr_trace_t power_trace,
131 e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
133 //bool isUsed() {DIE_IMPOSSIBLE;};
134 void updateState(tmgr_trace_event_t event_type, double value, double date);
135 double getSpeed(double load);
136 double getAvailableSpeed();
137 CpuActionPtr execute(double /*size*/) {DIE_IMPOSSIBLE;};
138 CpuActionPtr sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
140 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
141 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
142 int getNbPstates() {THROW_UNIMPLEMENTED;};
143 void setPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
144 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
146 double m_powerCurrent;
149 class LinkL07 : public NetworkLink {
151 LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
153 tmgr_trace_t bw_trace,
155 tmgr_trace_t lat_trace,
156 e_surf_resource_state_t
158 tmgr_trace_t state_trace,
159 e_surf_link_sharing_policy_t policy);
163 void updateState(tmgr_trace_event_t event_type, double value, double date);
164 double getBandwidth();
169 tmgr_trace_event_t p_latEvent;
171 tmgr_trace_event_t p_bwEvent;
177 class WorkstationL07Action : public WorkstationAction {
178 friend ActionPtr WorkstationL07::execute(double size);
179 friend ActionPtr WorkstationL07::sleep(double duration);
180 friend ActionPtr WorkstationL07Model::executeParallelTask(int workstation_nb,
181 void **workstation_list,
183 *computation_amount, double
184 *communication_amount,
187 WorkstationL07Action(ModelPtr model, double cost, bool failed)
188 : WorkstationAction(model, cost, failed) {};
189 ~WorkstationL07Action();
198 void setMaxDuration(double duration);
199 void setPriority(double priority);
203 WorkstationPtr *p_workstationList;
204 double *p_computationAmount;
205 double *p_communicationAmount;
210 #endif /* WORKSTATION_L07_HPP_ */