Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix jedule and do the right thing for netzone hosts
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 9 Mar 2017 10:37:14 +0000 (11:37 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 9 Mar 2017 10:37:14 +0000 (11:37 +0100)
include/simgrid/s4u/NetZone.hpp
src/instr/jedule/jedule_platform.cpp
src/s4u/s4u_netzone.cpp

index dd1f5e1..38cfab2 100644 (file)
@@ -40,7 +40,7 @@ protected:
 
   explicit NetZone(NetZone * father, const char* name);
   virtual ~NetZone();
 
   explicit NetZone(NetZone * father, const char* name);
   virtual ~NetZone();
-  std::vector<Host*>* hosts_ = nullptr;
+  std::vector<Host*>* hosts_ = new std::vector<Host*>();
 
 public:
   /** @brief Seal your netzone once you're done adding content, and before routing stuff through it */
 
 public:
   /** @brief Seal your netzone once you're done adding content, and before routing stuff through it */
index c945b1c..1590106 100644 (file)
@@ -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
   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<sg_host_t> 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()));
   } else {
     xbt_dict_foreach(routing_sons, cursor, key, elem) {
       jed_container_t child_container = new simgrid::jedule::Container(std::string(elem->name()));
index 153be09..780baad 100644 (file)
@@ -23,11 +23,6 @@ simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kern
 
 NetZone::NetZone(NetZone* father, const char* name) : father_(father), name_(xbt_strdup(name))
 {
 
 NetZone::NetZone(NetZone* father, const char* name) : father_(father), name_(xbt_strdup(name))
 {
-  for (auto card : vertices_) {
-    s4u::Host* host = simgrid::s4u::Host::by_name_or_null(card->name());
-    if (host != nullptr)
-      hosts_->push_back(host);
-  }
 }
 
 void NetZone::seal()
 }
 
 void NetZone::seal()
@@ -43,6 +38,7 @@ NetZone::~NetZone()
     delete static_cast<NetZone*>(elem);
   }
 
     delete static_cast<NetZone*>(elem);
   }
 
+  delete hosts_;
   xbt_dict_free(&children_);
   xbt_free(name_);
 }
   xbt_dict_free(&children_);
   xbt_free(name_);
 }
@@ -80,6 +76,11 @@ NetZone* NetZone::father()
 
 std::vector<s4u::Host*>* NetZone::hosts()
 {
 
 std::vector<s4u::Host*>* 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_;
 }
 
   return hosts_;
 }