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;
34 class HostL07Model : public HostModel {
39 double shareResources(double now);
40 void updateActionsState(double now, double delta);
41 Host *createHost(const char *name,RoutingEdge *netElm, Cpu *cpu);
42 Action *executeParallelTask(int host_nb,
47 xbt_dynar_t getRoute(Host *src, Host *dst);
49 NetworkModel *p_networkModel;
52 class CpuL07Model : public CpuModel {
54 CpuL07Model(HostL07Model *hmodel) : CpuModel() {p_hostModel = hmodel;};
55 ~CpuL07Model() {surf_cpu_model_pm = NULL;};
56 Cpu *createCpu(const char *name, xbt_dynar_t powerPeak,
57 int pstate, double power_scale,
58 tmgr_trace_t power_trace, int core,
59 e_surf_resource_state_t state_initial,
60 tmgr_trace_t state_trace,
61 xbt_dict_t cpu_properties);
62 void addTraces() {DIE_IMPOSSIBLE;};
64 HostL07Model *p_hostModel;
67 class NetworkL07Model : public NetworkModel {
69 NetworkL07Model(HostL07Model *hmodel) : NetworkModel() {p_hostModel = hmodel;};
70 ~NetworkL07Model() {surf_network_model = NULL;};
71 Link* createLink(const char *name,
73 tmgr_trace_t bw_trace,
75 tmgr_trace_t lat_trace,
76 e_surf_resource_state_t
78 tmgr_trace_t state_trace,
79 e_surf_link_sharing_policy_t
80 policy, xbt_dict_t properties);
82 Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
83 void addTraces() {DIE_IMPOSSIBLE;};
84 bool shareResourcesIsIdempotent() {return true;}
86 HostL07Model *p_hostModel;
93 class HostL07 : public Host {
95 HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu);
96 bool isUsed() {DIE_IMPOSSIBLE;};
97 void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
98 Action *execute(double size) {return p_cpu->execute(size);};
99 Action *sleep(double duration) {return p_cpu->sleep(duration);};
100 e_surf_resource_state_t getState();
103 class CpuL07 : public Cpu {
104 friend void HostL07Model::addTraces();
105 tmgr_trace_event_t p_stateEvent;
106 tmgr_trace_event_t p_powerEvent;
108 CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties,
109 double power_scale, double power_initial, tmgr_trace_t power_trace,
110 int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
112 void updateState(tmgr_trace_event_t event_type, double value, double date);
113 Action *execute(double size);
114 Action *sleep(double duration);
116 double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
117 double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
118 int getNbPstates() {THROW_UNIMPLEMENTED;};
119 void setPstate(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
120 int getPstate() {THROW_UNIMPLEMENTED;};
121 double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
124 class LinkL07 : public Link {
126 LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
128 tmgr_trace_t bw_trace,
130 tmgr_trace_t lat_trace,
131 e_surf_resource_state_t
133 tmgr_trace_t state_trace,
134 e_surf_link_sharing_policy_t policy);
138 void updateState(tmgr_trace_event_t event_type, double value, double date);
139 double getBandwidth();
142 void updateBandwidth(double value, double date=surf_get_clock());
143 void updateLatency(double value, double date=surf_get_clock());
146 tmgr_trace_event_t p_latEvent;
148 tmgr_trace_event_t p_bwEvent;
154 class L07Action : public HostAction {
155 friend Action *CpuL07::execute(double size);
156 friend Action *CpuL07::sleep(double duration);
157 friend Action *HostL07Model::executeParallelTask(int host_nb,
159 double *flops_amount,
160 double *bytes_amount,
163 L07Action(Model *model, double cost, bool failed)
164 : HostAction(model, cost, failed) {};
174 void setMaxDuration(double duration);
175 void setPriority(double priority);
178 vector<RoutingEdge*> * p_edgeList = new vector<RoutingEdge*>();
179 double *p_computationAmount;
180 double *p_communicationAmount;
185 #endif /* HOST_L07_HPP_ */