Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 25 Apr 2018 19:11:36 +0000 (21:11 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 25 Apr 2018 19:11:36 +0000 (21:11 +0200)
1  2 
include/simgrid/s4u/Engine.hpp
src/instr/instr_platform.cpp
src/s4u/s4u_Engine.cpp
src/simdag/sd_global.cpp
src/surf/sg_platf.cpp
src/surf/xml/surfxml_sax_cb.cpp

@@@ -33,14 -33,6 +33,14 @@@ public
    /** Finalize the default engine and all its dependencies */
    static void shutdown();
  
 +  /** @brief Run the simulation */
 +  void run();
 +
 +  /** @brief Retrieve the simulation time */
 +  static double get_clock();
 +  /** @brief Retrieve the engine singleton */
 +  static s4u::Engine* get_instance();
 +
    /** @brief Load a platform file describing the environment
     *
     * The environment is either a XML file following the simgrid.dtd formalism, or a lua file.
@@@ -106,38 -98,39 +106,38 @@@ public
    simgrid::s4u::Storage* storage_by_name(std::string name);
    simgrid::s4u::Storage* storage_by_name_or_null(std::string name);
  
 -  /** @brief Run the simulation */
 -  void run();
 -
 -  /** @brief Retrieve the simulation time */
 -  static double get_clock();
 -
 -  /** @brief Retrieve the engine singleton */
 -  static s4u::Engine* getInstance();
 +  std::vector<simgrid::kernel::routing::NetPoint*> get_all_netpoints();
  
    /** @brief Retrieve the root netzone, containing all others */
    simgrid::s4u::NetZone* getNetRoot();
  
 -  /** @brief Retrieve the netzone of the given name (or nullptr if not found) */
    simgrid::s4u::NetZone* getNetzoneByNameOrNull(const char* name);
  
    /** @brief Retrieves all netzones of the same type than the subtype of the whereto vector */
    template <class T> void getNetzoneByType(std::vector<T*> * whereto) { netzoneByTypeRecursive(getNetRoot(), whereto); }
 +
    /** @brief Retrieve the netcard of the given name (or nullptr if not found) */
    simgrid::kernel::routing::NetPoint* getNetpointByNameOrNull(std::string name);
 -  void getNetpointList(std::vector<simgrid::kernel::routing::NetPoint*> * list);
  
    /** Returns whether SimGrid was initialized yet -- mostly for internal use */
 -  static bool isInitialized();
 -
 +  static bool is_initialized();
    /** @brief set a configuration variable
     *
 -   * Do --help on any simgrid binary to see the list of currently existing configuration variables (see @ref options).
 +   * Do --help on any simgrid binary to see the list of currently existing configuration variables (see also @ref
 +   * options).
     *
     * Example:
 -   * e->setConfig("host/model","ptask_L07");
 +   * e->set_config("host/model:ptask_L07");
     */
 -  void setConfig(std::string str);
 +  void set_config(std::string str);
  
 +  simgrid::kernel::EngineImpl* pimpl;
 +
 +private:
 +  static s4u::Engine* instance_;
 +
 +  //////////////// Deprecated functions
 +public:
    XBT_ATTRIB_DEPRECATED_v323("Please use Engine::load_platform()") void loadPlatform(const char* platf)
    {
      load_platform(platf);
      return get_all_storages();
    }
    XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_clock()") static double getClock() { return get_clock(); }
 -
 -  simgrid::kernel::EngineImpl* pimpl;
 -
 -private:
 -  static s4u::Engine* instance_;
 +  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_all_netpoints()") void getNetpointList(
 +      std::vector<simgrid::kernel::routing::NetPoint*>* list);
 +  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_instance()") static s4u::Engine* getInstance()
 +  {
 +    return get_instance();
 +  }
 +  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::is_initialized()") static bool isInitialized()
 +  {
 +    return is_initialized();
 +  }
 +  XBT_ATTRIB_DEPRECATED_v323("Please use Engine::set_config()") void setConfig(std::string str) { set_config(str); }
  };
  
  /** Callback fired when the platform is created (ie, the xml file parsed),
   * right before the actual simulation starts. */
- extern XBT_PUBLIC xbt::signal<void()> onPlatformCreated;
+ extern XBT_PUBLIC xbt::signal<void()> on_platform_created;
+ /** Callback fired when the platform is about to be created (ie, just before the xml file is parsed) */
+ extern XBT_PUBLIC xbt::signal<void()> on_platform_creation;
  
  /** Callback fired when the main simulation loop ends, just before the end of Engine::run() */
  extern XBT_PUBLIC xbt::signal<void()> onSimulationEnd;
  #include "surf/surf.hpp"
  #include "xbt/graph.h"
  
- XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
+ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_routing, instr, "Tracing platform hierarchy");
  
  static std::vector<simgrid::instr::NetZoneContainer*> currentContainer; /* push and pop, used only in creation */
  
- static const char *instr_node_name (xbt_node_t node)
+ static const char* instr_node_name(xbt_node_t node)
  {
-   void *data = xbt_graph_node_get_data(node);
-   return static_cast<char*>(data);
+   return static_cast<char*>(xbt_graph_node_get_data(node));
  }
  
- static container_t lowestCommonAncestor (container_t a1, container_t a2)
+ static container_t lowestCommonAncestor(container_t a1, container_t a2)
  {
-   //this is only an optimization (since most of a1 and a2 share the same parent)
+   // this is only an optimization (since most of a1 and a2 share the same parent)
    if (a1->father_ == a2->father_)
      return a1->father_;
  
-   //create an array with all ancestors of a1
+   // create an array with all ancestors of a1
    std::vector<container_t> ancestors_a1;
    container_t p = a1->father_;
-   while (p){
+   while (p) {
      ancestors_a1.push_back(p);
      p = p->father_;
    }
  
-   //create an array with all ancestors of a2
+   // create an array with all ancestors of a2
    std::vector<container_t> ancestors_a2;
    p = a2->father_;
-   while (p){
+   while (p) {
      ancestors_a2.push_back(p);
      p = p->father_;
    }
  
-   //find the lowest ancestor
-   p = nullptr;
+   // find the lowest ancestor
+   p     = nullptr;
    int i = ancestors_a1.size() - 1;
    int j = ancestors_a2.size() - 1;
-   while (i >= 0 && j >= 0){
+   while (i >= 0 && j >= 0) {
      container_t a1p = ancestors_a1.at(i);
      container_t a2p = ancestors_a2.at(j);
-     if (a1p == a2p){
+     if (a1p == a2p) {
        p = a1p;
-     }else{
+     } else {
        break;
      }
      i--;
  
  static void linkContainers(container_t src, container_t dst, std::set<std::string>* filter)
  {
-   //ignore loopback
+   // ignore loopback
    if (src->get_name() == "__loopback__" || dst->get_name() == "__loopback__") {
-     XBT_DEBUG ("  linkContainers: ignoring loopback link");
+     XBT_DEBUG("  linkContainers: ignoring loopback link");
      return;
    }
  
-   //find common father
-   container_t father = lowestCommonAncestor (src, dst);
+   // find common father
+   container_t father = lowestCommonAncestor(src, dst);
    if (not father) {
-     xbt_die ("common father unknown, this is a tracing problem");
+     xbt_die("common father unknown, this is a tracing problem");
    }
  
    // check if we already register this pair (we only need one direction)
    filter->insert(aux1);
    filter->insert(aux2);
  
-   //declare type
+   // declare type
    std::string link_typename = father->type_->get_name() + "-" + src->type_->get_name() +
                                std::to_string(src->type_->get_id()) + "-" + dst->type_->get_name() +
                                std::to_string(dst->type_->get_id());
    simgrid::instr::LinkType* link = father->type_->getOrCreateLinkType(link_typename, src->type_, dst->type_);
    link->setCallingContainer(father);
  
-   //register EDGE types for triva configuration
+   // register EDGE types for triva configuration
    trivaEdgeTypes.insert(link->get_name());
  
-   //create the link
+   // create the link
    static long long counter = 0;
  
    std::string key = std::to_string(counter);
@@@ -125,14 -124,14 +124,14 @@@ static void recursiveGraphExtraction(si
    }
    XBT_DEBUG("Graph extraction for NetZone = %s", netzone->get_cname());
    if (not netzone->getChildren()->empty()) {
-     //bottom-up recursion
+     // bottom-up recursion
      for (auto const& nz_son : *netzone->getChildren()) {
        container_t child_container = container->children_.at(nz_son->get_cname());
        recursiveGraphExtraction(nz_son, child_container, filter);
      }
    }
  
-   xbt_graph_t graph = xbt_graph_new_graph (0, nullptr);
 -  xbt_graph_t graph = xbt_graph_new_graph(0, nullptr);
++  xbt_graph_t graph                        = xbt_graph_new_graph(0, nullptr);
    std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
    std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
  
  static void instr_netzone_on_creation(simgrid::s4u::NetZone& netzone)
  {
    std::string id = netzone.get_name();
    if (simgrid::instr::Container::getRoot() == nullptr) {
      simgrid::instr::NetZoneContainer* root = new simgrid::instr::NetZoneContainer(id, 0, nullptr);
  
        mpi->getOrCreateStateType("MIGRATE_STATE");
      }
  
-     if (TRACE_needs_platform()){
+     if (TRACE_needs_platform()) {
        currentContainer.push_back(root);
      }
      return;
    }
  
-   if (TRACE_needs_platform()){
+   if (TRACE_needs_platform()) {
      simgrid::instr::NetZoneContainer* container =
          new simgrid::instr::NetZoneContainer(id, currentContainer.size(), currentContainer.back());
      currentContainer.push_back(container);
  
  static void instr_netzone_on_seal(simgrid::s4u::NetZone& /*netzone*/)
  {
-   if (TRACE_needs_platform()){
+   if (TRACE_needs_platform()) {
      currentContainer.pop_back();
    }
  }
@@@ -257,7 -255,7 +255,7 @@@ static void instr_host_on_creation(simg
  
  static void instr_netpoint_on_creation(simgrid::kernel::routing::NetPoint* netpoint)
  {
-   if (netpoint->is_router() && TRACE_is_enabled() && TRACE_needs_platform())
+   if (netpoint->is_router() && TRACE_needs_platform() && TRACE_is_enabled())
      new simgrid::instr::RouterContainer(netpoint->get_cname(), currentContainer.back());
  }
  
@@@ -265,22 -263,22 +263,22 @@@ static void instr_on_platform_created(
  {
    currentContainer.clear();
    std::set<std::string>* filter = new std::set<std::string>;
-   XBT_DEBUG ("Starting graph extraction.");
+   XBT_DEBUG("Starting graph extraction.");
 -  recursiveGraphExtraction(simgrid::s4u::Engine::getInstance()->getNetRoot(), simgrid::instr::Container::getRoot(),
 +  recursiveGraphExtraction(simgrid::s4u::Engine::get_instance()->getNetRoot(), simgrid::instr::Container::getRoot(),
                             filter);
-   XBT_DEBUG ("Graph extraction finished.");
+   XBT_DEBUG("Graph extraction finished.");
    delete filter;
    TRACE_paje_dump_buffer(true);
  }
  
- void instr_routing_define_callbacks()
+ void instr_define_callbacks()
  {
    // always need the callbacks to zones (we need only the root zone), to create the rootContainer and the rootType
    // properly
    if (TRACE_needs_platform()) {
+     simgrid::s4u::on_platform_created.connect(instr_on_platform_created);
      simgrid::s4u::Host::onCreation.connect(instr_host_on_creation);
      simgrid::s4u::Link::onCreation.connect(instr_link_on_creation);
-     simgrid::s4u::onPlatformCreated.connect(instr_on_platform_created);
    }
    simgrid::s4u::NetZone::onCreation.connect(instr_netzone_on_creation);
    simgrid::s4u::NetZone::onSeal.connect(instr_netzone_on_seal);
@@@ -358,7 -356,7 +356,7 @@@ static void recursiveXBTGraphExtraction
                                          container_t container)
  {
    if (not netzone->getChildren()->empty()) {
-     //bottom-up recursion
+     // bottom-up recursion
      for (auto const& netzone_child : *netzone->getChildren()) {
        container_t child_container = container->children_.at(netzone_child->get_cname());
        recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
    static_cast<simgrid::kernel::routing::NetZoneImpl*>(netzone)->get_graph(graph, nodes, edges);
  }
  
- xbt_graph_t instr_routing_platform_graph ()
+ xbt_graph_t instr_routing_platform_graph()
  {
-   xbt_graph_t ret = xbt_graph_new_graph (0, nullptr);
 -  xbt_graph_t ret = xbt_graph_new_graph(0, nullptr);
++  xbt_graph_t ret                          = xbt_graph_new_graph(0, nullptr);
    std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
    std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
 -  recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::getInstance()->getNetRoot(),
 +  recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::get_instance()->getNetRoot(),
                                simgrid::instr::Container::getRoot());
    delete nodes;
    delete edges;
    return ret;
  }
  
- void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename)
+ void instr_routing_platform_graph_export_graphviz(xbt_graph_t g, const char* filename)
  {
    unsigned int cursor = 0;
-   xbt_node_t node = nullptr;
-   xbt_edge_t edge = nullptr;
+   xbt_node_t node     = nullptr;
+   xbt_edge_t edge     = nullptr;
  
-   FILE *file = fopen(filename, "w");
+   FILEfile = fopen(filename, "w");
    xbt_assert(file, "Failed to open %s \n", filename);
  
    if (g->directed)
    fprintf(file, "  node [shape=box, style=filled]\n");
    fprintf(file, "  node [width=.3, height=.3, style=filled, color=skyblue]\n\n");
  
-   xbt_dynar_foreach(g->nodes, cursor, node) {
+   xbt_dynar_foreach (g->nodes, cursor, node) {
      fprintf(file, "  \"%s\";\n", instr_node_name(node));
    }
-   xbt_dynar_foreach(g->edges, cursor, edge) {
-     const char *src_s = instr_node_name (edge->src);
-     const char *dst_s = instr_node_name (edge->dst);
+   xbt_dynar_foreach (g->edges, cursor, edge) {
+     const char* src_s = instr_node_name(edge->src);
+     const char* dst_s = instr_node_name(edge->dst);
      if (g->directed)
        fprintf(file, "  \"%s\" -> \"%s\";\n", src_s, dst_s);
      else
diff --combined src/s4u/s4u_Engine.cpp
@@@ -5,7 -5,6 +5,6 @@@
  /* This program is free software; you can redistribute it and/or modify it
   * under the terms of the license (GNU LGPL) which comes with this package. */
  
- #include "instr/instr_interface.hpp"
  #include "mc/mc.h"
  #include "simgrid/kernel/routing/NetPoint.hpp"
  #include "simgrid/kernel/routing/NetZoneImpl.hpp"
@@@ -15,6 -14,7 +14,7 @@@
  #include "simgrid/s4u/NetZone.hpp"
  #include "simgrid/s4u/Storage.hpp"
  #include "simgrid/simix.h"
+ #include "src/instr/instr_private.hpp"
  #include "src/kernel/EngineImpl.hpp"
  #include "src/surf/network_interface.hpp"
  #include "surf/surf.hpp" // routing_platf. FIXME:KILLME. SOON
@@@ -23,7 -23,8 +23,8 @@@ XBT_LOG_NEW_CATEGORY(s4u, "Log channel
  
  namespace simgrid {
  namespace s4u {
- xbt::signal<void()> onPlatformCreated;
+ xbt::signal<void()> on_platform_creation;
+ xbt::signal<void()> on_platform_created;
  xbt::signal<void()> onSimulationEnd;
  xbt::signal<void(double)> onTimeAdvance;
  xbt::signal<void(void)> onDeadlock;
@@@ -47,8 -48,7 +48,8 @@@ Engine::~Engine(
    s4u::Engine::instance_ = nullptr;
  }
  
 -Engine* Engine::getInstance()
 +/** @brief Retrieve the engine singleton */
 +Engine* Engine::get_instance()
  {
    if (s4u::Engine::instance_ == nullptr)
      return new Engine(0, nullptr);
@@@ -189,16 -189,16 +190,16 @@@ void Engine::run(
  
  s4u::NetZone* Engine::getNetRoot()
  {
 -  return pimpl->netRoot_;
 +  return pimpl->netzone_root_;
  }
  
 -static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* name)
 +static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const char* name)
  {
    if (not strcmp(current->get_cname(), name))
      return current;
  
    for (auto const& elem : *(current->getChildren())) {
 -    simgrid::s4u::NetZone* tmp = netzoneByNameRecursive(elem, name);
 +    simgrid::s4u::NetZone* tmp = netzone_by_name_recursive(elem, name);
      if (tmp != nullptr) {
        return tmp;
      }
  /** @brief Retrieve the NetZone of the given name (or nullptr if not found) */
  NetZone* Engine::getNetzoneByNameOrNull(const char* name)
  {
 -  return netzoneByNameRecursive(getNetRoot(), name);
 +  return netzone_by_name_recursive(getNetRoot(), name);
  }
  
  /** @brief Retrieve the netpoint of the given name (or nullptr if not found) */
@@@ -225,14 -225,6 +226,14 @@@ void Engine::getNetpointList(std::vecto
    for (auto const& kv : pimpl->netpoints_)
      list->push_back(kv.second);
  }
 +std::vector<simgrid::kernel::routing::NetPoint*> Engine::get_all_netpoints()
 +{
 +  std::vector<simgrid::kernel::routing::NetPoint*> res;
 +  for (auto const& kv : pimpl->netpoints_)
 +    res.push_back(kv.second);
 +  return res;
 +}
 +
  /** @brief Register a new netpoint to the system */
  void Engine::netpoint_register(simgrid::kernel::routing::NetPoint* point)
  {
@@@ -249,11 -241,11 +250,11 @@@ void Engine::netpoint_unregister(simgri
    });
  }
  
 -bool Engine::isInitialized()
 +bool Engine::is_initialized()
  {
    return Engine::instance_ != nullptr;
  }
 -void Engine::setConfig(std::string str)
 +void Engine::set_config(std::string str)
  {
    simgrid::config::set_parse(std::move(str));
  }
diff --combined src/simdag/sd_global.cpp
@@@ -7,7 -7,7 +7,7 @@@
  #include "simgrid/kernel/resource/Action.hpp"
  #include "simgrid/s4u/Engine.hpp"
  #include "simgrid/sg_config.hpp"
- #include "src/include/instr/instr_interface.hpp"
+ #include "src/instr/instr_private.hpp"
  #include "src/surf/surf_interface.hpp"
  
  XBT_LOG_NEW_CATEGORY(sd, "Logging specific to SimDag");
@@@ -200,7 -200,7 +200,7 @@@ void SD_config(const char *key, const c
   */
  void SD_create_environment(const char *platform_file)
  {
 -  simgrid::s4u::Engine::getInstance()->load_platform(platform_file);
 +  simgrid::s4u::Engine::get_instance()->load_platform(platform_file);
  
    XBT_DEBUG("Host number: %zu, link number: %d", sg_host_count(), sg_link_count());
  #if SIMGRID_HAVE_JEDULE
diff --combined src/surf/sg_platf.cpp
@@@ -16,6 -16,7 +16,7 @@@
  #include "simgrid/kernel/routing/VivaldiZone.hpp"
  #include "simgrid/s4u/Engine.hpp"
  #include "src/include/simgrid/sg_config.hpp"
+ #include "src/instr/instr_private.hpp"
  #include "src/kernel/EngineImpl.hpp"
  #include "src/simix/smx_host_private.hpp"
  #include "src/simix/smx_private.hpp"
@@@ -49,13 -50,14 +50,14 @@@ static simgrid::kernel::routing::NetZon
  /** Module management function: creates all internal data structures */
  void sg_platf_init()
  {
-   simgrid::s4u::onPlatformCreated.connect(check_disk_attachment);
+   simgrid::s4u::on_platform_creation.connect(TRACE_start);
+   simgrid::s4u::on_platform_created.connect(check_disk_attachment);
  }
  
  /** Module management function: frees all internal data structures */
  void sg_platf_exit() {
    simgrid::surf::on_cluster.disconnectSlots();
-   simgrid::s4u::onPlatformCreated.disconnectSlots();
+   simgrid::s4u::on_platform_created.disconnectSlots();
  
    /* make sure that we will reinit the models while loading the platf once reinited */
    surf_parse_models_setup_already_called = 0;
@@@ -96,7 -98,7 +98,7 @@@ simgrid::kernel::routing::NetPoint* sg_
  
    if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
      current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
 -  xbt_assert(nullptr == simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name),
 +  xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name),
               "Refusing to create a router named '%s': this name already describes a node.", name.c_str());
  
    simgrid::kernel::routing::NetPoint* netpoint =
@@@ -392,7 -394,7 +394,7 @@@ void sg_platf_new_mount(simgrid::kernel
  
    if (mount_list.empty())
      XBT_DEBUG("Create a Mount list for %s", A_surfxml_host_id);
 -  mount_list.insert({mount->name, simgrid::s4u::Engine::getInstance()->storage_by_name(mount->storageId)->getImpl()});
 +  mount_list.insert({mount->name, simgrid::s4u::Engine::get_instance()->storage_by_name(mount->storageId)->getImpl()});
  }
  
  void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
@@@ -415,7 -417,7 +417,7 @@@ void sg_platf_new_actor(simgrid::kernel
      std::string msg = std::string("Cannot create actor '") + actor->function + "': host '" + actor->host +
                        "' does not exist\nExisting hosts: '";
  
 -    std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->get_all_hosts();
 +    std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
  
      for (auto const& host : list) {
        msg += host->get_name();
@@@ -492,12 -494,6 +494,6 @@@ void sg_platf_new_peer(simgrid::kernel:
      host->pimpl_cpu->set_speed_trace(peer->speed_trace);
  }
  
- void sg_platf_begin() { /* Do nothing: just for symmetry of user code */ }
- void sg_platf_end() {
-   simgrid::s4u::onPlatformCreated();
- }
  /* Pick the right models for CPU, net and host, and call their model_init_preparse */
  static void surf_config_models_setup()
  {
@@@ -603,9 -599,9 +599,9 @@@ simgrid::s4u::NetZone* sg_platf_new_Zon
    }
  
    if (current_routing == nullptr) { /* it is the first one */
 -    xbt_assert(simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ == nullptr,
 +    xbt_assert(simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ == nullptr,
                 "All defined components must belong to a networking zone.");
 -    simgrid::s4u::Engine::getInstance()->pimpl->netRoot_ = new_zone;
 +    simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ = new_zone;
  
    } else {
      /* set the father behavior */
  
    /* set the new current component of the tree */
    current_routing = new_zone;
    simgrid::s4u::NetZone::onCreation(*new_zone); // notify the signal
  
    return new_zone;
@@@ -6,6 -6,7 +6,7 @@@
  #include "simgrid/kernel/routing/NetPoint.hpp"
  #include "simgrid/s4u/Engine.hpp"
  #include "simgrid/sg_config.hpp"
+ #include "src/instr/instr_private.hpp"
  #include "src/surf/network_interface.hpp"
  #include "src/surf/surf_interface.hpp"
  #include "src/surf/xml/platf_private.hpp"
@@@ -58,14 -59,13 +59,14 @@@ void surf_parse_assert_netpoint(std::st
  
    std::string msg = pre + hostname + post + " Existing netpoints: \n";
  
 -  std::vector<simgrid::kernel::routing::NetPoint*> list;
 -  simgrid::s4u::Engine::getInstance()->getNetpointList(&list);
 -  std::sort(list.begin(), list.end(), [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
 -    return a->get_name() < b->get_name();
 -  });
 +  std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
 +      simgrid::s4u::Engine::get_instance()->get_all_netpoints();
 +  std::sort(netpoints.begin(), netpoints.end(),
 +            [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
 +              return a->get_name() < b->get_name();
 +            });
    bool first = true;
 -  for (auto const& np : list) {
 +  for (auto const& np : netpoints) {
      if (np->is_netzone())
        continue;
  
@@@ -391,10 -391,10 +392,10 @@@ void STag_surfxml_platform() 
                               "Please update your code, or use another, more adapted, file.",
               surf_parsed_filename, version);
  
-   sg_platf_begin();
+   simgrid::s4u::on_platform_creation();
  }
  void ETag_surfxml_platform(){
-   sg_platf_end();
+   simgrid::s4u::on_platform_created();
  }
  
  void STag_surfxml_host(){
@@@ -406,7 -406,7 +407,7 @@@ void STag_surfxml_prop(
  {
    if (ZONE_TAG) { // We need to retrieve the most recently opened zone
      XBT_DEBUG("Set zone property %s -> %s", A_surfxml_prop_id, A_surfxml_prop_value);
 -    simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
 +    simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::get_instance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
  
      netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value);
    } else {
@@@ -531,12 -531,10 +532,10 @@@ void ETag_surfxml_cluster()
  
  void STag_surfxml_cluster(){
    ZONE_TAG = 0;
-   parse_after_config();
    xbt_assert(current_property_set == nullptr, "Someone forgot to reset the property set to nullptr in its closing tag (or XML malformed)");
  }
  
  void STag_surfxml_cabinet(){
-   parse_after_config();
    simgrid::kernel::routing::CabinetCreationArgs cabinet;
    cabinet.id      = A_surfxml_cabinet_id;
    cabinet.prefix  = A_surfxml_cabinet_prefix;
  }
  
  void STag_surfxml_peer(){
-   parse_after_config();
    simgrid::kernel::routing::PeerCreationArgs peer;
  
    peer.id          = std::string(A_surfxml_peer_id);
@@@ -793,7 -790,6 +791,6 @@@ void ETag_surfxml_trace()
  
  void STag_surfxml_trace___connect()
  {
-   parse_after_config();
    simgrid::kernel::routing::TraceConnectCreationArgs trace_connect;
  
    trace_connect.element = A_surfxml_trace___connect_element;
@@@ -837,7 -833,6 +834,6 @@@ void ETag_surfxml_AS(
  
  void STag_surfxml_zone()
  {
-   parse_after_config();
    ZONE_TAG                 = 1;
    simgrid::kernel::routing::ZoneCreationArgs zone;
    zone.id      = A_surfxml_zone_id;
@@@ -873,6 -868,8 +869,8 @@@ void ETag_surfxml_config(
        XBT_INFO("The custom configuration '%s' is already defined by user!", elm.first.c_str());
    }
    XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
+   if (TRACE_is_enabled())
+     TRACE_start();
  
    delete current_property_set;
    current_property_set = nullptr;
@@@ -947,7 -944,7 +945,9 @@@ void ETag_surfxml_prop(){/* Nothing to 
  void STag_surfxml_random(){/* Nothing to do */}
  void ETag_surfxml_random(){/* Nothing to do */}
  void ETag_surfxml_trace___connect(){/* Nothing to do */}
- void STag_surfxml_trace(){parse_after_config();}
 -void STag_surfxml_trace(){/* Nothing to do */}
++void STag_surfxml_trace()
++{ /* Nothing to do */
++}
  void ETag_surfxml_router(){/*Nothing to do*/}
  void ETag_surfxml_host___link(){/* Nothing to do */}
  void ETag_surfxml_cabinet(){/* Nothing to do */}