Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a7767aaf604525f4c419d5ba497f191216b768fa
[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 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
14                                 "Logging specific to the SURF network module");
15
16 NetworkModelPtr surf_network_model = NULL;
17
18 xbt_dynar_t NetworkModel::getRoute(RoutingEdgePtr src, RoutingEdgePtr dst)
19 {
20   xbt_dynar_t route = NULL;
21   routing_platf->getRouteAndLatency(src, dst, &route, NULL);
22   return route;
23 }
24
25 double NetworkModel::latencyFactor(double /*size*/) {
26   return sg_latency_factor;
27 }
28
29 double NetworkModel::bandwidthFactor(double /*size*/) {
30   return sg_bandwidth_factor;
31 }
32
33 double NetworkModel::bandwidthConstraint(double rate, double /*bound*/, double /*size*/) {
34   return rate;
35 }
36
37 bool NetworkLinkLmm::isUsed()
38 {
39   return lmm_constraint_used(p_model->p_maxminSystem, p_constraint);
40 }
41
42 double NetworkLink::getLatency()
43 {
44   return m_latCurrent;
45 }
46
47 double NetworkLinkLmm::getBandwidth()
48 {
49   return p_power.peak * p_power.scale;
50 }
51
52 bool NetworkLinkLmm::isShared()
53 {
54   return lmm_constraint_is_shared(p_constraint);
55 }
56
57 #endif /* NETWORK_INTERFACE_CPP_ */