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"
25 class XBT_PRIVATE HostL07Model;
26 class XBT_PRIVATE CpuL07Model;
27 class XBT_PRIVATE NetworkL07Model;
29 class XBT_PRIVATE HostL07;
30 class XBT_PRIVATE CpuL07;
31 class XBT_PRIVATE LinkL07;
33 class XBT_PRIVATE L07Action;
41 class HostL07Model : public HostModel {
46 double shareResources(double now);
47 void updateActionsState(double now, double delta);
48 Host *createHost(const char *name,RoutingEdge *netElm, Cpu *cpu);
49 Action *executeParallelTask(int host_nb,
54 xbt_dynar_t getRoute(Host *src, Host *dst);
58 class CpuL07Model : public CpuModel {
60 CpuL07Model(HostL07Model *hmodel) : CpuModel() {p_hostModel = hmodel;};
61 ~CpuL07Model() {surf_cpu_model_pm = NULL;};
62 Cpu *createCpu(const char *name, xbt_dynar_t speedPeak,
63 int pstate, double speedScale,
64 tmgr_trace_t speedTrace, int core,
65 e_surf_resource_state_t state_initial,
66 tmgr_trace_t state_trace,
67 xbt_dict_t cpu_properties);
68 void addTraces() {DIE_IMPOSSIBLE;};
70 HostL07Model *p_hostModel;
73 class NetworkL07Model : public NetworkModel {
75 NetworkL07Model(HostL07Model *hmodel) : NetworkModel() {p_hostModel = hmodel;};
76 ~NetworkL07Model() {surf_network_model = NULL;};
77 Link* createLink(const char *name,
79 tmgr_trace_t bw_trace,
81 tmgr_trace_t lat_trace,
82 e_surf_resource_state_t
84 tmgr_trace_t state_trace,
85 e_surf_link_sharing_policy_t
86 policy, xbt_dict_t properties);
88 Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
89 void addTraces() {DIE_IMPOSSIBLE;};
90 bool shareResourcesIsIdempotent() {return true;}
92 HostL07Model *p_hostModel;
99 class HostL07 : public Host {
101 HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu);
102 bool isUsed() {DIE_IMPOSSIBLE;};
103 void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
104 Action *execute(double size) {return p_cpu->execute(size);};
105 Action *sleep(double duration) {return p_cpu->sleep(duration);};
106 e_surf_resource_state_t getState();
109 class CpuL07 : public Cpu {
110 friend void HostL07Model::addTraces();
111 tmgr_trace_event_t p_stateEvent;
112 tmgr_trace_event_t p_speedEvent;
114 CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties,
115 double power_scale, double power_initial, tmgr_trace_t power_trace,
116 int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
118 void updateState(tmgr_trace_event_t event_type, double value, double date);
119 Action *execute(double size);
120 Action *sleep(double duration);
122 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
123 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
124 int getNbPstates() {THROW_UNIMPLEMENTED;};
125 void setPstate(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
126 int getPstate() {THROW_UNIMPLEMENTED;};
127 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
130 class LinkL07 : public Link {
132 LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
134 tmgr_trace_t bw_trace,
136 tmgr_trace_t lat_trace,
137 e_surf_resource_state_t
139 tmgr_trace_t state_trace,
140 e_surf_link_sharing_policy_t policy);
144 void updateState(tmgr_trace_event_t event_type, double value, double date);
145 double getBandwidth();
146 void updateBandwidth(double value, double date=surf_get_clock());
147 void updateLatency(double value, double date=surf_get_clock());
150 tmgr_trace_event_t p_bwEvent;
156 class L07Action : public HostAction {
157 friend Action *CpuL07::execute(double size);
158 friend Action *CpuL07::sleep(double duration);
159 friend Action *HostL07Model::executeParallelTask(int host_nb,
161 double *flops_amount,
162 double *bytes_amount,
165 L07Action(Model *model, double cost, bool failed)
166 : HostAction(model, cost, failed) {};
176 void setMaxDuration(double duration);
177 void setPriority(double priority);
180 std::vector<RoutingEdge*> * p_edgeList = new std::vector<RoutingEdge*>();
181 double *p_computationAmount;
182 double *p_communicationAmount;
190 #endif /* HOST_L07_HPP_ */