1 /* Copyright (c) 2013-2015. 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. */
9 #include "host_interface.hpp"
18 class XBT_PRIVATE HostL07Model;
19 class XBT_PRIVATE CpuL07Model;
20 class XBT_PRIVATE NetworkL07Model;
22 class XBT_PRIVATE HostL07;
23 class XBT_PRIVATE CpuL07;
24 class XBT_PRIVATE LinkL07;
26 class XBT_PRIVATE L07Action;
35 class HostL07Model : public HostModel {
40 double shareResources(double now);
41 void updateActionsState(double now, double delta);
42 Host *createHost(const char *name);
43 Action *executeParallelTask(int host_nb,
48 xbt_dynar_t getRoute(Host *src, Host *dst);
50 NetworkModel *p_networkModel;
53 class CpuL07Model : public CpuModel {
55 CpuL07Model() : CpuModel() {};
56 ~CpuL07Model() {surf_cpu_model_pm = NULL;};
57 Cpu *createCpu(const char *name, xbt_dynar_t powerPeak,
58 int pstate, double power_scale,
59 tmgr_trace_t power_trace, int core,
60 e_surf_resource_state_t state_initial,
61 tmgr_trace_t state_trace,
62 xbt_dict_t cpu_properties);
63 void addTraces() {DIE_IMPOSSIBLE;};
65 HostL07Model *p_hostModel;
68 class NetworkL07Model : public NetworkModel {
70 NetworkL07Model() : NetworkModel() {};
71 ~NetworkL07Model() {surf_network_model = NULL;};
72 Link* createLink(const char *name,
74 tmgr_trace_t bw_trace,
76 tmgr_trace_t lat_trace,
77 e_surf_resource_state_t
79 tmgr_trace_t state_trace,
80 e_surf_link_sharing_policy_t
81 policy, xbt_dict_t properties);
83 Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
84 void addTraces() {DIE_IMPOSSIBLE;};
85 bool shareResourcesIsIdempotent() {return true;}
87 HostL07Model *p_hostModel;
94 class HostL07 : public Host {
96 HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu);
98 bool isUsed() {DIE_IMPOSSIBLE;};
99 void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
100 Action *execute(double size);
101 Action *sleep(double duration);
102 e_surf_resource_state_t getState();
103 double getPowerPeakAt(int pstate_index);
105 void setPstate(int pstate_index);
107 double getConsumedEnergy();
110 class CpuL07 : public Cpu {
111 friend void HostL07Model::addTraces();
112 tmgr_trace_event_t p_stateEvent;
113 tmgr_trace_event_t p_powerEvent;
115 CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties,
116 double power_scale, double power_initial, tmgr_trace_t power_trace,
117 int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
119 //bool isUsed() {DIE_IMPOSSIBLE;};
120 void updateState(tmgr_trace_event_t event_type, double value, double date);
121 CpuAction *execute(double /*size*/) {DIE_IMPOSSIBLE;};
122 CpuAction *sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
124 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
125 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
126 int getNbPstates() {THROW_UNIMPLEMENTED;};
127 void setPstate(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
128 int getPstate() {THROW_UNIMPLEMENTED;};
129 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
132 class LinkL07 : public Link {
134 LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
136 tmgr_trace_t bw_trace,
138 tmgr_trace_t lat_trace,
139 e_surf_resource_state_t
141 tmgr_trace_t state_trace,
142 e_surf_link_sharing_policy_t policy);
146 void updateState(tmgr_trace_event_t event_type, double value, double date);
147 double getBandwidth();
150 void updateBandwidth(double value, double date=surf_get_clock());
151 void updateLatency(double value, double date=surf_get_clock());
154 tmgr_trace_event_t p_latEvent;
156 tmgr_trace_event_t p_bwEvent;
162 class L07Action : public HostAction {
163 friend Action *HostL07::execute(double size);
164 friend Action *HostL07::sleep(double duration);
165 friend Action *HostL07Model::executeParallelTask(int host_nb,
167 double *flops_amount,
168 double *bytes_amount,
171 L07Action(Model *model, double cost, bool failed)
172 : HostAction(model, cost, failed) {};
182 void setMaxDuration(double duration);
183 void setPriority(double priority);
186 vector<RoutingEdge*> * p_edgeList = new vector<RoutingEdge*>();
187 double *p_computationAmount;
188 double *p_communicationAmount;
193 #endif /* HOST_L07_HPP_ */