1 /* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "simgrid/s4u/Engine.hpp"
7 #include "simgrid/s4u/Host.hpp"
8 #include "simgrid/simdag.h"
9 #include "src/kernel/routing/NetPoint.hpp"
13 int main(int argc, char **argv)
16 SD_create_environment(argv[1]);
18 xbt_dynar_t hosts = sg_hosts_as_dynar();
19 std::printf("Host count: %zu, link number: %d\n", sg_host_count(), sg_link_count());
21 std::vector<simgrid::kernel::routing::NetPoint*> netcardList;
22 simgrid::s4u::Engine::getInstance()->getNetpointList(&netcardList);
23 std::sort(netcardList.begin(), netcardList.end(),
24 [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
25 return a->name() < b->name();
30 xbt_dynar_foreach(hosts, it, host) {
31 simgrid::kernel::routing::NetPoint* nc = host->pimpl_netpoint;
32 const char *type = "buggy";
39 std::printf(" - Seen: \"%s\". Type: %s\n", host->getCname(), type);
41 xbt_dynar_free(&hosts);
43 std::printf("NetCards count: %zu\n", netcardList.size());
44 for (auto const& nc : netcardList)
45 std::printf(" - Seen: \"%s\". Type: %s\n", nc->cname(),
46 nc->isRouter() ? "router" : (nc->isNetZone() ? "netzone" : (nc->isHost() ? "host" : "buggy")));