Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill TRACE_smpi_finalize() and have the container unregistered as soon as the actor...
[simgrid.git] / src / smpi / internals / instr_smpi.cpp
index 50112e0..30b9bf1 100644 (file)
@@ -151,7 +151,10 @@ void TRACE_smpi_init(int rank)
   if (not TRACE_smpi_is_enabled())
     return;
 
+  auto self = simgrid::s4u::Actor::self();
+
   TRACE_smpi_setup_container(rank, sg_host_self());
+  simgrid::s4u::this_actor::on_exit([self](bool) { smpi_container(self->get_pid())->remove_from_parent(); });
 #if HAVE_PAPI
   container_t container   = smpi_container(rank);
   papi_counter_t counters = smpi_process()->papi_counters();
@@ -166,14 +169,6 @@ void TRACE_smpi_init(int rank)
 #endif
 }
 
-void TRACE_smpi_finalize(int rank)
-{
-  if (not TRACE_smpi_is_enabled())
-    return;
-
-  smpi_container(rank)->remove_from_parent();
-}
-
 void TRACE_smpi_computing_init(int rank)
 {
  //first use, initialize the color in the trace