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 "host_interface.hpp"
17 typedef HostL07Model *HostL07ModelPtr;
20 typedef CpuL07Model *CpuL07ModelPtr;
22 class NetworkL07Model;
23 typedef NetworkL07Model *NetworkL07ModelPtr;
26 typedef HostL07 *HostL07Ptr;
29 typedef CpuL07 *CpuL07Ptr;
32 typedef LinkL07 *LinkL07Ptr;
35 typedef HostL07Action *HostL07ActionPtr;
44 class HostL07Model : public HostModel {
49 double shareResources(double now);
50 void updateActionsState(double now, double delta);
51 HostPtr createHost(const char *name);
52 ActionPtr executeParallelTask(int host_nb,
57 xbt_dynar_t getRoute(HostPtr src, HostPtr dst);
58 ActionPtr communicate(HostPtr src, HostPtr 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 HostL07ModelPtr p_hostModel;
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 HostL07ModelPtr p_hostModel;
102 class HostL07 : public Host {
104 HostL07(HostModelPtr 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 HostL07Model::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 HostL07Action : public HostAction {
171 friend ActionPtr HostL07::execute(double size);
172 friend ActionPtr HostL07::sleep(double duration);
173 friend ActionPtr HostL07Model::executeParallelTask(int host_nb,
175 double *flops_amount,
176 double *bytes_amount,
179 HostL07Action(ModelPtr model, double cost, bool failed)
180 : HostAction(model, cost, failed) {};
190 void setMaxDuration(double duration);
191 void setPriority(double priority);
196 double *p_computationAmount;
197 double *p_communicationAmount;
202 #endif /* HOST_L07_HPP_ */