Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
3e7130da4f61066b215dd1148c326221cb14e471
[simgrid.git] / src / surf / network_interface.cpp
1 /*
2  * network_interface.cpp
3  *
4  *  Created on: Nov 29, 2013
5  *      Author: bedaride
6  */
7 #include "network_interface.hpp"
8 #include "simgrid/sg_config.h"
9
10 #ifndef NETWORK_INTERFACE_CPP_
11 #define NETWORK_INTERFACE_CPP_
12
13 extern "C" {
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
15                                 "Logging specific to the SURF network module");
16 }
17
18 NetworkModelPtr surf_network_model = NULL;
19
20 xbt_dynar_t NetworkModel::getRoute(RoutingEdgePtr src, RoutingEdgePtr dst)
21 {
22   xbt_dynar_t route = NULL;
23   routing_platf->getRouteAndLatency(src, dst, &route, NULL);
24   return route;
25 }
26
27 double NetworkModel::latencyFactor(double /*size*/) {
28   return sg_latency_factor;
29 }
30
31 double NetworkModel::bandwidthFactor(double /*size*/) {
32   return sg_bandwidth_factor;
33 }
34
35 double NetworkModel::bandwidthConstraint(double rate, double /*bound*/, double /*size*/) {
36   return rate;
37 }
38
39 bool NetworkLinkLmm::isUsed()
40 {
41   return lmm_constraint_used(p_model->p_maxminSystem, p_constraint);
42 }
43
44 double NetworkLink::getLatency()
45 {
46   return m_latCurrent;
47 }
48
49 double NetworkLinkLmm::getBandwidth()
50 {
51   return p_power.peak * p_power.scale;
52 }
53
54 bool NetworkLinkLmm::isShared()
55 {
56   return lmm_constraint_is_shared(p_constraint);
57 }
58
59 #endif /* NETWORK_INTERFACE_CPP_ */