- std::printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"", sg_link_name(links[i]),
- sg_link_bandwidth(links[i]), sg_link_latency(links[i]));
- if (sg_link_is_shared(links[i])) {
- std::printf("/>\n");
- } else {
- std::printf(" sharing_policy=\"FATPIPE\"/>\n");
+static void dump_routes()
+{
+ unsigned int totalHosts = sg_host_count();
+ sg_host_t* hosts = sg_host_list();
+ std::sort(hosts, hosts + totalHosts,
+ [](sg_host_t a, sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
+ std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
+ simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
+ std::sort(netcardList.begin(), netcardList.end(),
+ [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
+ return a->getName() < b->getName();
+ });
+
+ for (unsigned int it_src = 0; it_src < totalHosts; it_src++) { // Routes from host
+ simgrid::s4u::Host* host1 = hosts[it_src];
+ simgrid::kernel::routing::NetPoint* netcardSrc = host1->pimpl_netpoint;
+ for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
+ simgrid::s4u::Host* host2 = hosts[it_dst];
+ std::vector<simgrid::surf::LinkImpl*> route;
+ simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
+ simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
+ if (not route.empty()) {
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->getCname(), host2->getCname());
+ for (auto const& link : route)
+ std::printf("<link_ctn id=\"%s\"/>", link->getCname());
+ std::printf("\n </route>\n");