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. */
13 #include "host_interface.hpp"
22 class XBT_PRIVATE HostL07Model;
23 class XBT_PRIVATE CpuL07Model;
24 class XBT_PRIVATE NetworkL07Model;
26 class XBT_PRIVATE HostL07;
27 class XBT_PRIVATE CpuL07;
28 class XBT_PRIVATE LinkL07;
30 class XBT_PRIVATE L07Action;
38 class HostL07Model : public HostModel {
43 double shareResources(double now);
44 void updateActionsState(double now, double delta);
45 Host *createHost(const char *name,RoutingEdge *netElm, Cpu *cpu);
46 Action *executeParallelTask(int host_nb,
51 xbt_dynar_t getRoute(Host *src, Host *dst);
55 class CpuL07Model : public CpuModel {
57 CpuL07Model(HostL07Model *hmodel) : CpuModel() {p_hostModel = hmodel;};
58 ~CpuL07Model() {surf_cpu_model_pm = NULL;};
59 Cpu *createCpu(const char *name, xbt_dynar_t speedPeak,
60 int pstate, double speedScale,
61 tmgr_trace_t speedTrace, int core,
62 e_surf_resource_state_t state_initial,
63 tmgr_trace_t state_trace,
64 xbt_dict_t cpu_properties);
65 void addTraces() {DIE_IMPOSSIBLE;};
67 HostL07Model *p_hostModel;
70 class NetworkL07Model : public NetworkModel {
72 NetworkL07Model(HostL07Model *hmodel) : NetworkModel() {p_hostModel = hmodel;};
73 ~NetworkL07Model() {surf_network_model = NULL;};
74 Link* createLink(const char *name,
76 tmgr_trace_t bw_trace,
78 tmgr_trace_t lat_trace,
79 e_surf_resource_state_t
81 tmgr_trace_t state_trace,
82 e_surf_link_sharing_policy_t
83 policy, xbt_dict_t properties);
85 Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
86 void addTraces() {DIE_IMPOSSIBLE;};
87 bool shareResourcesIsIdempotent() {return true;}
89 HostL07Model *p_hostModel;
96 class HostL07 : public Host {
98 HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu);
99 bool isUsed() {DIE_IMPOSSIBLE;};
100 void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
101 Action *execute(double size) {return p_cpu->execute(size);};
102 Action *sleep(double duration) {return p_cpu->sleep(duration);};
103 e_surf_resource_state_t getState();
106 class CpuL07 : public Cpu {
107 friend void HostL07Model::addTraces();
108 tmgr_trace_event_t p_stateEvent;
109 tmgr_trace_event_t p_speedEvent;
111 CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties,
112 double power_scale, double power_initial, tmgr_trace_t power_trace,
113 int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
115 void updateState(tmgr_trace_event_t event_type, double value, double date);
116 Action *execute(double size);
117 Action *sleep(double duration);
119 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
120 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
121 int getNbPstates() {THROW_UNIMPLEMENTED;};
122 void setPstate(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
123 int getPstate() {THROW_UNIMPLEMENTED;};
124 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
127 class LinkL07 : public Link {
129 LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
131 tmgr_trace_t bw_trace,
133 tmgr_trace_t lat_trace,
134 e_surf_resource_state_t
136 tmgr_trace_t state_trace,
137 e_surf_link_sharing_policy_t policy);
141 void updateState(tmgr_trace_event_t event_type, double value, double date);
142 double getBandwidth();
143 void updateBandwidth(double value, double date=surf_get_clock());
144 void updateLatency(double value, double date=surf_get_clock());
147 tmgr_trace_event_t p_bwEvent;
153 class L07Action : public HostAction {
154 friend Action *CpuL07::execute(double size);
155 friend Action *CpuL07::sleep(double duration);
156 friend Action *HostL07Model::executeParallelTask(int host_nb,
158 double *flops_amount,
159 double *bytes_amount,
162 L07Action(Model *model, double cost, bool failed)
163 : HostAction(model, cost, failed) {};
173 void setMaxDuration(double duration);
174 void setPriority(double priority);
177 std::vector<RoutingEdge*> * p_edgeList = new std::vector<RoutingEdge*>();
178 double *p_computationAmount;
179 double *p_communicationAmount;
184 #endif /* HOST_L07_HPP_ */