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 WorkstationPtr createWorkstation(const char *name);
52 ActionPtr executeParallelTask(int workstation_nb,
53 void **workstation_list,
57 xbt_dynar_t getRoute(WorkstationPtr src, WorkstationPtr dst);
58 ActionPtr communicate(WorkstationPtr src, WorkstationPtr dst, double size, double rate);
60 NetworkModelPtr p_networkModel;
63 class CpuL07Model : public CpuModel {
65 CpuL07Model() : CpuModel("cpuL07") {};
66 ~CpuL07Model() {surf_cpu_model_pm = NULL;};
67 CpuPtr createCpu(const char *name, xbt_dynar_t powerPeak,
68 int pstate, double power_scale,
69 tmgr_trace_t power_trace, int core,
70 e_surf_resource_state_t state_initial,
71 tmgr_trace_t state_trace,
72 xbt_dict_t cpu_properties);
73 void addTraces() {DIE_IMPOSSIBLE;};
75 WorkstationL07ModelPtr p_workstationModel;
78 class NetworkL07Model : public NetworkModel {
80 NetworkL07Model() : NetworkModel() {};
81 ~NetworkL07Model() {surf_network_model = NULL;};
82 NetworkLinkPtr createNetworkLink(const char *name,
84 tmgr_trace_t bw_trace,
86 tmgr_trace_t lat_trace,
87 e_surf_resource_state_t
89 tmgr_trace_t state_trace,
90 e_surf_link_sharing_policy_t
91 policy, xbt_dict_t properties);
93 ActionPtr communicate(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, double /*size*/, double /*rate*/) {DIE_IMPOSSIBLE;};
94 void addTraces() {DIE_IMPOSSIBLE;};
95 WorkstationL07ModelPtr p_workstationModel;
102 class WorkstationL07 : public Workstation {
104 WorkstationL07(WorkstationModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
106 bool isUsed() {DIE_IMPOSSIBLE;};
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 double getPowerPeakAt(int pstate_index);
113 void setPstate(int pstate_index);
115 double getConsumedEnergy();
118 class CpuL07 : public Cpu {
119 friend void WorkstationL07Model::addTraces();
120 tmgr_trace_event_t p_stateEvent;
121 tmgr_trace_event_t p_powerEvent;
123 CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties,
124 double power_scale, double power_initial, tmgr_trace_t power_trace,
125 int core, 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 CpuActionPtr execute(double /*size*/) {DIE_IMPOSSIBLE;};
130 CpuActionPtr sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
132 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
133 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
134 int getNbPstates() {THROW_UNIMPLEMENTED;};
135 void setPstate(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
136 int getPstate() {THROW_UNIMPLEMENTED;};
137 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
140 class LinkL07 : public NetworkLink {
142 LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
144 tmgr_trace_t bw_trace,
146 tmgr_trace_t lat_trace,
147 e_surf_resource_state_t
149 tmgr_trace_t state_trace,
150 e_surf_link_sharing_policy_t policy);
154 void updateState(tmgr_trace_event_t event_type, double value, double date);
155 double getBandwidth();
158 void updateBandwidth(double value, double date=surf_get_clock());
159 void updateLatency(double value, double date=surf_get_clock());
162 tmgr_trace_event_t p_latEvent;
164 tmgr_trace_event_t p_bwEvent;
170 class WorkstationL07Action : public WorkstationAction {
171 friend ActionPtr WorkstationL07::execute(double size);
172 friend ActionPtr WorkstationL07::sleep(double duration);
173 friend ActionPtr WorkstationL07Model::executeParallelTask(int workstation_nb,
174 void **workstation_list,
175 double *flops_amount,
176 double *bytes_amount,
179 WorkstationL07Action(ModelPtr model, double cost, bool failed)
180 : WorkstationAction(model, cost, failed) {};
181 ~WorkstationL07Action();
190 void setMaxDuration(double duration);
191 void setPriority(double priority);
195 WorkstationPtr *p_workstationList;
196 double *p_computationAmount;
197 double *p_communicationAmount;
202 #endif /* WORKSTATION_L07_HPP_ */