Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
this has been bugging me for a while
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 23 Mar 2018 15:37:33 +0000 (16:37 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 23 Mar 2018 15:37:33 +0000 (16:37 +0100)
src/instr/instr_paje_containers.cpp
src/instr/instr_paje_containers.hpp
src/s4u/s4u_actor.cpp
src/simix/ActorImpl.cpp
src/smpi/internals/instr_smpi.cpp

index 72afa41..1778a48 100644 (file)
@@ -114,6 +114,11 @@ Container::~Container()
   allContainers.erase(name_);
 }
 
+void Container::createChild(std::string name, std::string type_name)
+{
+  new Container(name, type_name, this);
+}
+
 Container* Container::byNameOrNull(std::string name)
 {
   auto cont = allContainers.find(name);
index fe1bd00..828024a 100644 (file)
@@ -40,7 +40,7 @@ public:
   StateType* getState(std::string name);
   LinkType* getLink(std::string name);
   VariableType* getVariable(std::string name);
-
+  void createChild(std::string name, std::string type_name);
   static Container* getRoot();
 };
 
index 905532e..653bf8c 100644 (file)
@@ -119,8 +119,7 @@ void Actor::migrate(Host* new_host)
 
   if (TRACE_actor_is_enabled()) {
     // create new container on the new_host location
-    new simgrid::instr::Container(instr_pid(this), "ACTOR", simgrid::instr::Container::byName(new_host->getName()));
-
+    simgrid::instr::Container::byName(new_host->getName())->createChild(instr_pid(this), "ACTOR");
     // end link
     link->endEvent(simgrid::instr::Container::byName(instr_pid(this)), "M", key);
   }
index 64eb25a..95cec9d 100644 (file)
@@ -350,9 +350,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, v
   intrusive_ptr_add_ref(process);
   /* Tracing the process creation */
   if (TRACE_actor_is_enabled())
-    new simgrid::instr::Container(instr_pid(process->ciface()), "ACTOR",
-                                  simgrid::instr::Container::byName(process->host->getName()));
-
+    simgrid::instr::Container::byName(process->host->getName())->createChild(instr_pid(process->ciface()), "ACTOR");
   /* The onCreation() signal must be delayed until there, where the pid and everything is set */
   simgrid::s4u::ActorPtr tmp = process->iface(); // Passing this directly to onCreation will lead to crashes
   simgrid::s4u::Actor::onCreation(tmp);
@@ -410,8 +408,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
 
   /* Tracing the process creation */
   if (TRACE_actor_is_enabled())
-    new simgrid::instr::Container(instr_pid(process->ciface()), "ACTOR",
-                                  simgrid::instr::Container::byName(process->host->getName()));
+    simgrid::instr::Container::byName(process->host->getName())->createChild(instr_pid(process->ciface()), "ACTOR");
 
   auto* context = dynamic_cast<simgrid::kernel::context::AttachContext*>(process->context);
   if (not context)
index added70..5e44075 100644 (file)
@@ -156,11 +156,9 @@ void TRACE_smpi_init(int rank)
     father = simgrid::instr::Container::getRoot();
   }
   xbt_assert(father != nullptr, "Could not find a parent for mpi rank %s at function %s", str.c_str(), __FUNCTION__);
+  father->createChild(str, "MPI");
 #if HAVE_PAPI
-  container_t container =
-#endif
-      new simgrid::instr::Container(str, "MPI", father);
-#if HAVE_PAPI
+  container_t container   = simgrid::instr::Container::byName(str);
   papi_counter_t counters = smpi_process()->papi_counters();
 
   for (auto const& it : counters) {