From: Frederic Suter Date: Thu, 9 Mar 2017 10:37:14 +0000 (+0100) Subject: fix jedule and do the right thing for netzone hosts X-Git-Tag: v3_15~177 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/fb33f893495b18dc7a0e13182b901d4cf662150f?hp=013aee5c38d6c531af7a469a89d6474a19233d3f fix jedule and do the right thing for netzone hosts --- diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index dd1f5e1422..38cfab22c4 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -40,7 +40,7 @@ protected: explicit NetZone(NetZone * father, const char* name); virtual ~NetZone(); - std::vector* hosts_ = nullptr; + std::vector* hosts_ = new std::vector(); public: /** @brief Seal your netzone once you're done adding content, and before routing stuff through it */ diff --git a/src/instr/jedule/jedule_platform.cpp b/src/instr/jedule/jedule_platform.cpp index c945b1c293..1590106b4e 100644 --- a/src/instr/jedule/jedule_platform.cpp +++ b/src/instr/jedule/jedule_platform.cpp @@ -69,17 +69,7 @@ void Container::createHierarchy(sg_netzone_t from_as) if (xbt_dict_is_empty(routing_sons)) { // I am no AS // add hosts to jedule platform - xbt_dynar_t table = from_as->hosts(); - unsigned int dynar_cursor; - sg_host_t host; - - std::vector hosts; - - xbt_dynar_foreach(table, dynar_cursor, host) { - hosts.push_back(host); - } - this->addResources(hosts); - xbt_dynar_free(&table); + this->addResources(*from_as->hosts()); } else { xbt_dict_foreach(routing_sons, cursor, key, elem) { jed_container_t child_container = new simgrid::jedule::Container(std::string(elem->name())); diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index 153be093f9..780baadf35 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -23,11 +23,6 @@ simgrid::xbt::signalname()); - if (host != nullptr) - hosts_->push_back(host); - } } void NetZone::seal() @@ -43,6 +38,7 @@ NetZone::~NetZone() delete static_cast(elem); } + delete hosts_; xbt_dict_free(&children_); xbt_free(name_); } @@ -80,6 +76,11 @@ NetZone* NetZone::father() std::vector* NetZone::hosts() { + for (auto card : vertices_) { + s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->name()); + if (host != nullptr) + hosts_->push_back(host); + } return hosts_; }