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. */
7 #include "host_interface.hpp"
18 class NetworkL07Model;
33 class HostL07Model : public HostModel {
38 double shareResources(double now);
39 void updateActionsState(double now, double delta);
40 Host *createHost(const char *name);
41 Action *executeParallelTask(int host_nb,
46 xbt_dynar_t getRoute(Host *src, Host *dst);
48 NetworkModel *p_networkModel;
51 class CpuL07Model : public CpuModel {
53 CpuL07Model() : CpuModel() {};
54 ~CpuL07Model() {surf_cpu_model_pm = NULL;};
55 Cpu *createCpu(const char *name, xbt_dynar_t powerPeak,
56 int pstate, double power_scale,
57 tmgr_trace_t power_trace, int core,
58 e_surf_resource_state_t state_initial,
59 tmgr_trace_t state_trace,
60 xbt_dict_t cpu_properties);
61 void addTraces() {DIE_IMPOSSIBLE;};
63 HostL07Model *p_hostModel;
66 class NetworkL07Model : public NetworkModel {
68 NetworkL07Model() : NetworkModel() {};
69 ~NetworkL07Model() {surf_network_model = NULL;};
70 Link* createLink(const char *name,
72 tmgr_trace_t bw_trace,
74 tmgr_trace_t lat_trace,
75 e_surf_resource_state_t
77 tmgr_trace_t state_trace,
78 e_surf_link_sharing_policy_t
79 policy, xbt_dict_t properties);
81 Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
82 void addTraces() {DIE_IMPOSSIBLE;};
83 bool shareResourcesIsIdempotent() {return true;}
85 HostL07Model *p_hostModel;
92 class HostL07 : public Host {
94 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);
99 Action *sleep(double duration);
100 e_surf_resource_state_t getState();
101 double getPowerPeakAt(int pstate_index);
103 void setPstate(int pstate_index);
105 double getConsumedEnergy();
108 class CpuL07 : public Cpu {
109 friend void HostL07Model::addTraces();
110 tmgr_trace_event_t p_stateEvent;
111 tmgr_trace_event_t p_powerEvent;
113 CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties,
114 double power_scale, double power_initial, tmgr_trace_t power_trace,
115 int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
117 //bool isUsed() {DIE_IMPOSSIBLE;};
118 void updateState(tmgr_trace_event_t event_type, double value, double date);
119 CpuAction *execute(double /*size*/) {DIE_IMPOSSIBLE;};
120 CpuAction *sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
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();
148 void updateBandwidth(double value, double date=surf_get_clock());
149 void updateLatency(double value, double date=surf_get_clock());
152 tmgr_trace_event_t p_latEvent;
154 tmgr_trace_event_t p_bwEvent;
160 class L07Action : public HostAction {
161 friend Action *HostL07::execute(double size);
162 friend Action *HostL07::sleep(double duration);
163 friend Action *HostL07Model::executeParallelTask(int host_nb,
165 double *flops_amount,
166 double *bytes_amount,
169 L07Action(Model *model, double cost, bool failed)
170 : HostAction(model, cost, failed) {};
180 void setMaxDuration(double duration);
181 void setPriority(double priority);
184 vector<RoutingEdge*> * p_edgeList = new vector<RoutingEdge*>();
185 double *p_computationAmount;
186 double *p_communicationAmount;
191 #endif /* HOST_L07_HPP_ */