Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of github.com:simgrid/simgrid
[simgrid.git] / src / surf / instr_routing.cpp
index d73ddac..ed350fe 100644 (file)
@@ -162,9 +162,9 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t
 /*
  * Callbacks
  */
-void sg_instr_AS_begin(sg_platf_AS_cbarg_t AS)
+static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone)
 {
-  const char*id = AS->id;
+  const char* id = netzone.name();
 
   if (PJ_container_get_root() == nullptr){
     PJ_container_alloc ();
@@ -195,7 +195,7 @@ void sg_instr_AS_begin(sg_platf_AS_cbarg_t AS)
   }
 }
 
-void sg_instr_AS_end()
+static void sg_instr_AS_end(simgrid::s4u::NetZone& /*netzone*/)
 {
   if (TRACE_needs_platform()){
     currentContainer.pop_back();
@@ -213,7 +213,7 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link)
 
   container_t container = PJ_container_new(link.name(), INSTR_LINK, father);
 
-  if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_link())) {
+  if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_link())) {
     type_t bandwidth = PJ_type_get_or_null("bandwidth", container->type);
     if (bandwidth == nullptr) {
       bandwidth = PJ_type_variable_new("bandwidth", nullptr, container->type);
@@ -233,12 +233,12 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link)
   }
 }
 
-void sg_instr_new_host(simgrid::s4u::Host& host)
+static void sg_instr_new_host(simgrid::s4u::Host& host)
 {
   container_t father = currentContainer.back();
   container_t container = PJ_container_new(host.cname(), INSTR_HOST, father);
 
-  if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_speed())) {
+  if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_speed())) {
     type_t speed = PJ_type_get_or_null ("power", container->type);
     if (speed == nullptr){
       speed = PJ_type_variable_new ("power", nullptr, container->type);
@@ -318,10 +318,15 @@ void instr_routing_define_callbacks ()
 {
   //always need the call backs to ASes (we need only the root AS),
   //to create the rootContainer and the rootType properly
-  if (not TRACE_is_enabled() || not TRACE_needs_platform())
+  if (not TRACE_is_enabled())
     return;
-  simgrid::s4u::Link::onCreation.connect(instr_routing_parse_start_link);
-  simgrid::s4u::onPlatformCreated.connect(instr_routing_parse_end_platform);
+  if (TRACE_needs_platform()) {
+    simgrid::s4u::Link::onCreation.connect(instr_routing_parse_start_link);
+    simgrid::s4u::onPlatformCreated.connect(instr_routing_parse_end_platform);
+    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);
 }
 
 /*