Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
getting sg_instr_AS_end through a signal structure
authorTakishipp <toufik.boubehziz@gmail.com>
Thu, 8 Jun 2017 14:41:29 +0000 (16:41 +0200)
committerTakishipp <toufik.boubehziz@gmail.com>
Thu, 8 Jun 2017 14:41:29 +0000 (16:41 +0200)
include/simgrid/s4u/NetZone.hpp
src/s4u/s4u_netzone.cpp
src/surf/instr_routing.cpp
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp

index 4dc88c3..fe9d878 100644 (file)
@@ -68,6 +68,7 @@ public:
                                    std::vector<surf::LinkImpl*>* link_list)>
       onRouteCreation;
   static simgrid::xbt::signal<void(NetZone&)> onCreation;
+  static simgrid::xbt::signal<void(NetZone&)> onSeal;
 
 protected:
   std::vector<kernel::routing::NetPoint*>
index 3886322..1eec476 100644 (file)
@@ -21,6 +21,7 @@ simgrid::xbt::signal<void(bool symmetrical, kernel::routing::NetPoint* src, kern
                           std::vector<surf::LinkImpl*>* link_list)>
     NetZone::onRouteCreation;
 simgrid::xbt::signal<void(NetZone&)> NetZone::onCreation;
+simgrid::xbt::signal<void(NetZone&)> NetZone::onSeal;
 
 NetZone::NetZone(NetZone* father, const char* name) : father_(father), name_(xbt_strdup(name))
 {
index 4f4902a..ed350fe 100644 (file)
@@ -195,7 +195,7 @@ static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone)
   }
 }
 
-void sg_instr_AS_end()
+static void sg_instr_AS_end(simgrid::s4u::NetZone& /*netzone*/)
 {
   if (TRACE_needs_platform()){
     currentContainer.pop_back();
@@ -326,6 +326,7 @@ void instr_routing_define_callbacks ()
     simgrid::s4u::Host::onCreation.connect(sg_instr_new_host);
   }
   simgrid::s4u::NetZone::onCreation.connect(sg_instr_AS_begin);
+  simgrid::s4u::NetZone::onSeal.connect(sg_instr_AS_end);
 }
 
 /*
index 7eb25fc..d75966f 100644 (file)
@@ -677,10 +677,8 @@ void sg_platf_new_AS_seal()
 {
   xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
   current_routing->seal();
-  current_routing = static_cast<simgrid::kernel::routing::NetZoneImpl*>(current_routing->father());
-
-  if (TRACE_is_enabled())
-    sg_instr_AS_end();
+  simgrid::s4u::NetZone::onSeal(*current_routing);
+  current_routing = static_cast<simgrid::kernel::routing::NetZoneImpl*>(current_routing->father()); 
 }
 
 /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
index 9b353f6..6939107 100644 (file)
@@ -246,7 +246,6 @@ XBT_PUBLIC_DATA(int) surfxml_bufferstack_size;
 XBT_PUBLIC(void) routing_route_free(sg_platf_route_cbarg_t route);
 /********** Instr. **********/
 XBT_PRIVATE void sg_instr_new_router(const char* name);
-XBT_PRIVATE void sg_instr_AS_end();
 
 SG_END_DECL()