2 * network_interface.hpp
4 * Created on: Nov 29, 2013
8 #include "surf_routing.hpp"
10 #ifndef SURF_NETWORK_INTERFACE_HPP_
11 #define SURF_NETWORK_INTERFACE_HPP_
17 typedef NetworkModel *NetworkModelPtr;
20 typedef NetworkLink *NetworkLinkPtr;
23 typedef NetworkLinkLmm *NetworkLinkLmmPtr;
26 typedef NetworkAction *NetworkActionPtr;
28 class NetworkActionLmm;
29 typedef NetworkActionLmm *NetworkActionLmmPtr;
35 void net_define_callbacks(void);
40 class NetworkModel : public Model {
42 NetworkModel() : Model("network") {
44 NetworkModel(string name) : Model(name) {
45 f_networkSolve = lmm_solve;
50 lmm_system_free(p_maxminSystem);
52 xbt_heap_free(p_actionHeap);
54 xbt_swag_free(p_modifiedSet);
57 virtual NetworkLinkPtr createResource(const char *name,
59 tmgr_trace_t bw_trace,
61 tmgr_trace_t lat_trace,
62 e_surf_resource_state_t state_initial,
63 tmgr_trace_t state_trace,
64 e_surf_link_sharing_policy_t policy,
65 xbt_dict_t properties)=0;
67 //FIXME:void updateActionsStateLazy(double now, double delta);
68 virtual void gapAppend(double /*size*/, const NetworkLinkLmmPtr /*link*/, NetworkActionLmmPtr /*action*/) {};
69 virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
70 double size, double rate)=0;
71 virtual xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst); //FIXME: kill field? That is done by the routing nowadays
72 void (*f_networkSolve)(lmm_system_t);
73 virtual double latencyFactor(double size);
74 virtual double bandwidthFactor(double size);
75 virtual double bandwidthConstraint(double rate, double bound, double size);
83 class NetworkLink : virtual public Resource {
85 NetworkLink() : p_latEvent(NULL) {};
86 virtual double getBandwidth()=0;
87 virtual double getLatency();
88 virtual bool isShared()=0;
90 /* Using this object with the public part of
91 model does not make sense */
93 tmgr_trace_event_t p_latEvent;
96 class NetworkLinkLmm : public ResourceLmm, public NetworkLink {
99 NetworkLinkLmm(lmm_system_t system,
100 double constraint_value,
101 tmgr_history_t history,
102 e_surf_resource_state_t state_init,
103 tmgr_trace_t state_trace,
105 tmgr_trace_t metric_trace)
106 : ResourceLmm(system, constraint_value, history, state_init, state_trace, metric_peak, metric_trace)
111 double getBandwidth();
117 class NetworkAction : virtual public Action {
124 const char* p_senderLinkName;
127 xbt_fifo_item_t p_senderFifoItem;
128 #ifdef HAVE_LATENCY_BOUND_TRACKING
129 int m_latencyLimited;
134 class NetworkActionLmm : public ActionLmm, public NetworkAction {
136 NetworkActionLmm() {};
139 #endif /* SURF_NETWORK_INTERFACE_HPP_ */