- 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->cname());
- std::printf("\n </route>\n");
- }
+static void dump_routers()
+{
+ std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+ sg4::Engine::get_instance()->get_all_netpoints();
+ std::sort(netpoints.begin(), netpoints.end(),
+ [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
+ return a->get_name() < b->get_name();
+ });
+
+ for (auto const& src : netpoints)
+ if (src->is_router())
+ std::printf(" <router id=\"%s\"/>\n", src->get_cname());
+}
+
+static void dump_routes()
+{
+ std::vector<sg4::Host*> hosts = sg4::Engine::get_instance()->get_all_hosts();
+ std::sort(hosts.begin(), hosts.end(),
+ [](const sg4::Host* a, const sg4::Host* b) { return a->get_name() < b->get_name(); });
+ std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
+ sg4::Engine::get_instance()->get_all_netpoints();
+ std::sort(netpoints.begin(), netpoints.end(),
+ [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
+ return a->get_name() < b->get_name();
+ });
+
+ for (auto src_host : hosts) { // Routes from host
+ const simgrid::kernel::routing::NetPoint* src = src_host->get_netpoint();
+ for (auto dst_host : hosts) { // Routes to host
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ const simgrid::kernel::routing::NetPoint* dst = dst_host->get_netpoint();
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
+ if (route.empty())
+ continue;
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src_host->get_cname(), dst_host->get_cname());
+ for (auto const& link : route)
+ std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
+ std::printf("\n </route>\n");