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 CpuPtr createResource(const char *name, xbt_dynar_t powerPeak,
79 int pstate, double power_scale,
80 tmgr_trace_t power_trace, int core,
81 e_surf_resource_state_t state_initial,
82 tmgr_trace_t state_trace,
83 xbt_dict_t cpu_properties);
84 void addTraces() {DIE_IMPOSSIBLE;};
86 WorkstationL07ModelPtr p_workstationModel;
89 class NetworkL07Model : public NetworkModel {
91 NetworkL07Model() : NetworkModel() {};
92 ~NetworkL07Model() {surf_network_model = NULL;};
93 NetworkLinkPtr createResource(const char *name,
95 tmgr_trace_t bw_trace,
97 tmgr_trace_t lat_trace,
98 e_surf_resource_state_t
100 tmgr_trace_t state_trace,
101 e_surf_link_sharing_policy_t
102 policy, xbt_dict_t properties);
104 ActionPtr communicate(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, double /*size*/, double /*rate*/) {DIE_IMPOSSIBLE;};
105 void addTraces() {DIE_IMPOSSIBLE;};
106 WorkstationL07ModelPtr p_workstationModel;
113 class WorkstationL07 : public Workstation {
115 WorkstationL07(WorkstationModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
117 bool isUsed() {DIE_IMPOSSIBLE;};
118 void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
119 ActionPtr execute(double size);
120 ActionPtr sleep(double duration);
121 e_surf_resource_state_t getState();
122 double getPowerPeakAt(int pstate_index);
124 void setPowerPeakAt(int pstate_index);
125 double getConsumedEnergy();
128 class CpuL07 : public Cpu {
129 friend void WorkstationL07Model::addTraces();
130 tmgr_trace_event_t p_stateEvent;
131 tmgr_trace_event_t p_powerEvent;
133 CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties,
135 double power_initial, tmgr_trace_t power_trace,
136 e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
138 //bool isUsed() {DIE_IMPOSSIBLE;};
139 void updateState(tmgr_trace_event_t event_type, double value, double date);
140 CpuActionPtr execute(double /*size*/) {DIE_IMPOSSIBLE;};
141 CpuActionPtr sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
143 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
144 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
145 int getNbPstates() {THROW_UNIMPLEMENTED;};
146 void setPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
147 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
150 class LinkL07 : public NetworkLink {
152 LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
154 tmgr_trace_t bw_trace,
156 tmgr_trace_t lat_trace,
157 e_surf_resource_state_t
159 tmgr_trace_t state_trace,
160 e_surf_link_sharing_policy_t policy);
164 void updateState(tmgr_trace_event_t event_type, double value, double date);
165 double getBandwidth();
168 void updateBandwidth(double value, double date=surf_get_clock());
169 void updateLatency(double value, double date=surf_get_clock());
172 tmgr_trace_event_t p_latEvent;
174 tmgr_trace_event_t p_bwEvent;
180 class WorkstationL07Action : public WorkstationAction {
181 friend ActionPtr WorkstationL07::execute(double size);
182 friend ActionPtr WorkstationL07::sleep(double duration);
183 friend ActionPtr WorkstationL07Model::executeParallelTask(int workstation_nb,
184 void **workstation_list,
186 *computation_amount, double
187 *communication_amount,
190 WorkstationL07Action(ModelPtr model, double cost, bool failed)
191 : WorkstationAction(model, cost, failed) {};
192 ~WorkstationL07Action();
201 void setMaxDuration(double duration);
202 void setPriority(double priority);
206 WorkstationPtr *p_workstationList;
207 double *p_computationAmount;
208 double *p_communicationAmount;
213 #endif /* WORKSTATION_L07_HPP_ */