X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a13d43daf0284cec291d65f0585fd2a44e9d87fd..55633c554b60455d85885816b1b73e9698b73a14:/src/surf/network_ns3.cpp diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 3e0e899633..c20f3c9b5b 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -5,8 +5,9 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/surf/network_ns3.hpp" + +#include "src/surf/HostImpl.hpp" #include "src/surf/surf_private.h" -#include "src/surf/host_interface.hpp" #include "simgrid/sg_config.h" #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals @@ -272,13 +273,6 @@ Link* NetworkNS3Model::createLink(const char *name, return link; } -xbt_dynar_t NetworkNS3Model::getRoute(NetCard *src, NetCard *dst) -{ - xbt_dynar_t route = NULL; - routing_platf->getRouteAndLatency(src, dst, &route, NULL); - return route; -} - Action *NetworkNS3Model::communicate(NetCard *src, NetCard *dst, double size, double rate) { @@ -344,18 +338,13 @@ void NetworkNS3Model::updateActionsState(double now, double delta) double data_sent = ns3_get_socket_sent(data); double data_delta_sent = data_sent - action->m_lastSent; - xbt_dynar_t route = NULL; - - routing_platf->getRouteAndLatency (action->p_srcElm, action->p_dstElm, &route, NULL); - unsigned int i; - for (i = 0; i < xbt_dynar_length (route); i++){ - NetworkNS3Link* link = ((NetworkNS3Link*)xbt_dynar_get_ptr(route, i)); - TRACE_surf_link_set_utilization (link->getName(), - action->getCategory(), - (data_delta_sent)/delta, - now-delta, - delta); - } + std::vector *route = new std::vector(); + + routing_platf->getRouteAndLatency (action->p_srcElm, action->p_dstElm, route, NULL); + for (auto link : *route) + TRACE_surf_link_set_utilization (link->getName(), action->getCategory(), (data_delta_sent)/delta, now-delta, delta); + delete route; + action->m_lastSent = data_sent; }