Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #193 from Takishipp/signals
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 30 Jun 2017 20:38:10 +0000 (22:38 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Jun 2017 20:38:10 +0000 (22:38 +0200)
get sg_instr_new_router through a signal

src/instr/instr_paje_types.cpp
src/surf/instr_routing.cpp
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp

index 9fd1dfe..50df528 100644 (file)
@@ -19,6 +19,7 @@ void PJ_type_release ()
   rootType = nullptr;
 }
 
+
 type_t PJ_type_get_root ()
 {
   return rootType;
index ed350fe..b14c04d 100644 (file)
@@ -8,6 +8,7 @@
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/kernel/routing/NetZoneImpl.hpp"
+#include "src/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/xml/platf_private.hpp"
 #include "surf/surf.h"
@@ -294,11 +295,13 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
 
 }
 
-void sg_instr_new_router(const char* name)
+static void sg_instr_new_router(simgrid::kernel::routing::NetPoint * netpoint)
 {
+  if (not netpoint->isRouter())
+    return; 
   if (TRACE_is_enabled() && TRACE_needs_platform()) {
     container_t father = currentContainer.back();
-    PJ_container_new(name, INSTR_ROUTER, father);
+    PJ_container_new(netpoint->cname(), INSTR_ROUTER, father);
   }
 }
 
@@ -327,8 +330,8 @@ void instr_routing_define_callbacks ()
   }
   simgrid::s4u::NetZone::onCreation.connect(sg_instr_AS_begin);
   simgrid::s4u::NetZone::onSeal.connect(sg_instr_AS_end);
+  simgrid::kernel::routing::NetPoint::onCreation.connect(&sg_instr_new_router);
 }
-
 /*
  * user categories support
  */
index 75db20e..79883f4 100644 (file)
@@ -120,7 +120,6 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(const char* name, const
   if (coords && strcmp(coords, ""))
     new simgrid::kernel::routing::vivaldi::Coords(netpoint, coords);
 
-  sg_instr_new_router(name);
 
   return netpoint;
 }
index 931f78a..d6b4dd8 100644 (file)
@@ -239,8 +239,6 @@ XBT_PUBLIC(void) surf_parse_set_debug(int bdebug);
 XBT_PUBLIC(int) surf_parse_lex_destroy();
 
 XBT_PUBLIC(void) routing_route_free(sg_platf_route_cbarg_t route);
-/********** Instr. **********/
-XBT_PRIVATE void sg_instr_new_router(const char* name);
 
 SG_END_DECL()