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,
54 double *computation_amount,
55 double *communication_amount,
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 setPowerPeakAt(int pstate_index);
114 double getConsumedEnergy();
117 class CpuL07 : public Cpu {
118 friend void WorkstationL07Model::addTraces();
119 tmgr_trace_event_t p_stateEvent;
120 tmgr_trace_event_t p_powerEvent;
122 CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties,
123 double power_scale, double power_initial, tmgr_trace_t power_trace,
124 int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
126 //bool isUsed() {DIE_IMPOSSIBLE;};
127 void updateState(tmgr_trace_event_t event_type, double value, double date);
128 CpuActionPtr execute(double /*size*/) {DIE_IMPOSSIBLE;};
129 CpuActionPtr sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
131 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
132 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
133 int getNbPstates() {THROW_UNIMPLEMENTED;};
134 void setPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
135 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
138 class LinkL07 : public NetworkLink {
140 LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
142 tmgr_trace_t bw_trace,
144 tmgr_trace_t lat_trace,
145 e_surf_resource_state_t
147 tmgr_trace_t state_trace,
148 e_surf_link_sharing_policy_t policy);
152 void updateState(tmgr_trace_event_t event_type, double value, double date);
153 double getBandwidth();
156 void updateBandwidth(double value, double date=surf_get_clock());
157 void updateLatency(double value, double date=surf_get_clock());
160 tmgr_trace_event_t p_latEvent;
162 tmgr_trace_event_t p_bwEvent;
168 class WorkstationL07Action : public WorkstationAction {
169 friend ActionPtr WorkstationL07::execute(double size);
170 friend ActionPtr WorkstationL07::sleep(double duration);
171 friend ActionPtr WorkstationL07Model::executeParallelTask(int workstation_nb,
172 void **workstation_list,
174 *computation_amount, double
175 *communication_amount,
178 WorkstationL07Action(ModelPtr model, double cost, bool failed)
179 : WorkstationAction(model, cost, failed) {};
180 ~WorkstationL07Action();
189 void setMaxDuration(double duration);
190 void setPriority(double priority);
194 WorkstationPtr *p_workstationList;
195 double *p_computationAmount;
196 double *p_communicationAmount;
201 #endif /* WORKSTATION_L07_HPP_ */