Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
a bit of simplification
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 20 Mar 2018 09:16:42 +0000 (10:16 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 20 Mar 2018 09:16:42 +0000 (10:16 +0100)
this should move to the Actor/ActorImpl realm someday.

src/msg/instr_msg_process.cpp
src/msg/msg_private.hpp
src/msg/msg_process.cpp
src/simix/ActorImpl.cpp

index 61bba1d..076996c 100644 (file)
@@ -29,10 +29,10 @@ void TRACE_msg_process_change_host(msg_process_t process, msg_host_t new_host)
     link->startEvent(msg, "M", key);
 
     //destroy existing container of this process
-    TRACE_msg_process_destroy (MSG_process_get_name (process), MSG_process_get_PID (process));
+    TRACE_msg_process_destroy(process);
 
     //create new container on the new_host location
-    TRACE_msg_process_create (MSG_process_get_name (process), MSG_process_get_PID (process), new_host);
+    TRACE_msg_process_create(process, new_host);
 
     //end link
     msg = simgrid::instr::Container::byName(instr_pid(process));
@@ -40,21 +40,21 @@ void TRACE_msg_process_change_host(msg_process_t process, msg_host_t new_host)
   }
 }
 
-void TRACE_msg_process_create(std::string process_name, int process_pid, msg_host_t host)
+void TRACE_msg_process_create(msg_process_t process, msg_host_t host)
 {
   if (TRACE_actor_is_enabled()) {
     container_t host_container = simgrid::instr::Container::byName(host->getName());
-    new simgrid::instr::Container(process_name + "-" + std::to_string(process_pid), "MSG_PROCESS", host_container);
+    new simgrid::instr::Container(instr_pid(process), "MSG_PROCESS", host_container);
   }
 }
 
-void TRACE_msg_process_destroy(std::string process_name, int process_pid)
+void TRACE_msg_process_destroy(msg_process_t process)
 {
   if (TRACE_actor_is_enabled()) {
-    container_t process = simgrid::instr::Container::byNameOrNull(process_name + "-" + std::to_string(process_pid));
-    if (process) {
-      process->removeFromParent();
-      delete process;
+    container_t container = simgrid::instr::Container::byNameOrNull(instr_pid(process));
+    if (container) {
+      container->removeFromParent();
+      delete container;
     }
   }
 }
@@ -63,6 +63,6 @@ void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t proc
 {
   if (TRACE_actor_is_enabled() && status == SMX_EXIT_FAILURE) {
     //kill means that this process no longer exists, let's destroy it
-    TRACE_msg_process_destroy(process->getCname(), process->getPid());
+    TRACE_msg_process_destroy(process);
   }
 }
index 9cbcae0..ef568da 100644 (file)
@@ -84,8 +84,8 @@ struct s_MSG_Global_t {
 };
 typedef s_MSG_Global_t* MSG_Global_t;
 
-XBT_PRIVATE void TRACE_msg_process_create(std::string process_name, int process_pid, msg_host_t host);
-XBT_PRIVATE void TRACE_msg_process_destroy(std::string process_name, int process_pid);
+XBT_PRIVATE void TRACE_msg_process_create(msg_process_t process, msg_host_t host);
+XBT_PRIVATE void TRACE_msg_process_destroy(msg_process_t process);
 
 extern "C" {
 
index a366f62..b283bd6 100644 (file)
@@ -40,7 +40,7 @@ void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_actor)
     simcall_process_set_data(smx_actor, nullptr);
   }
 
-  TRACE_msg_process_destroy(smx_actor->name, smx_actor->pid);
+  TRACE_msg_process_destroy(smx_actor->ciface());
   // free the data if a function was provided
   if (msg_actor && msg_actor->data && msg_global->process_data_cleanup) {
     msg_global->process_data_cleanup(msg_actor->data);
index e7445fb..dec1dff 100644 (file)
@@ -349,7 +349,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, v
   simix_global->process_to_run.push_back(process);
   intrusive_ptr_add_ref(process);
   /* Tracing the process creation */
-  TRACE_msg_process_create(process->getName(), process->pid, process->host);
+  TRACE_msg_process_create(process->ciface(), process->host);
 
   /* 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
@@ -407,7 +407,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
   intrusive_ptr_add_ref(process);
 
   /* Tracing the process creation */
-  TRACE_msg_process_create(process->getName(), process->pid, process->host);
+  TRACE_msg_process_create(process->ciface(), process->host);
 
   auto* context = dynamic_cast<simgrid::kernel::context::AttachContext*>(process->context);
   if (not context)