X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b32027d2deacc1dec0a2cf36bace8e716d2be7c1..1d5dde64a8201a55007ccc0bcc4f267facff8d30:/src/s4u/s4u_host.cpp diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 523aee6482..3d8550f137 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -20,6 +20,8 @@ #include "simgrid/s4u/host.hpp" #include "simgrid/s4u/storage.hpp" +XBT_LOG_EXTERNAL_CATEGORY(surf_route); + std::unordered_map host_list; // FIXME: move it to Engine int MSG_HOST_LEVEL = -1; @@ -117,6 +119,29 @@ int Host::pstatesCount() const { return this->pimpl_cpu->getNbPStates(); } +/** + * \brief Find a route toward another host + * + * \param dest [IN] where to + * \param route [OUT] where to store the list of links (must exist, cannot be nullptr). + * \param latency [OUT] where to store the latency experienced on the path (or nullptr if not interested) + * It is the caller responsibility to initialize latency to 0 (we add to provided route) + * \pre route!=nullptr + * + * walk through the routing components tree and find a route between hosts + * by calling each "get_route" function in each routing component. + */ +void Host::routeTo(Host* dest, std::vector* links, double* latency) +{ + simgrid::kernel::routing::AsImpl::getGlobalRoute(pimpl_netcard, dest->pimpl_netcard, links, latency); + if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) { + XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", cname(), dest->cname(), + (latency == nullptr ? -1 : *latency)); + for (auto link : *links) + XBT_CDEBUG(surf_route, "Link %s", link->getName()); + } +} + boost::unordered_map const& Host::mountedStorages() { if (mounts == nullptr) { mounts = new boost::unordered_map ();