Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make tracing less tightly coupled to MSG
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 23 Mar 2018 07:56:13 +0000 (08:56 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 23 Mar 2018 07:56:13 +0000 (08:56 +0100)
20 files changed:
ChangeLog
examples/msg/trace-process-migration/trace-process-migration.tesh
include/simgrid/actor.h
include/simgrid/msg.h
src/bindings/java/jmsg_process.cpp
src/instr/instr_config.cpp
src/instr/instr_paje_containers.cpp
src/instr/instr_private.hpp
src/msg/instr_msg_process.cpp
src/msg/instr_msg_task.cpp
src/msg/msg_gos.cpp
src/msg/msg_legacy.cpp
src/msg/msg_private.hpp
src/msg/msg_process.cpp
src/plugins/vm/VmLiveMigration.cpp
src/plugins/vm/s4u_VirtualMachine.cpp
src/s4u/s4u_actor.cpp
src/simix/ActorImpl.cpp
src/smpi/internals/instr_smpi.cpp
src/surf/instr_routing.cpp

index 6bbdebc..c6faf42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 SimGrid (3.20) NOT RELEASED YET (Release target: June 21. 2018 10:07 UTC)
 
+TRACE
+ - Change --cfg=tracing/msg/vm to --cfg=tracing/vm as virtual machine
+   behavior tracing is no longer limited to MSG 
 ----------------------------------------------------------------------------
 
 SimGrid (3.19.1) Released March 22 2018
index 2326be5..c75ba60 100644 (file)
@@ -118,15 +118,15 @@ $ tail -n +3 procmig.trace
 > %EndEventDef
 > 0 1 0 HOST
 > 6 0 1 1 0 "Tremblay"
-> 0 2 1 MSG_PROCESS
-> 2 3 2 MSG_PROCESS_STATE
+> 0 2 1 ACTOR
+> 2 3 2 ACTOR_STATE
 > 5 4 3 suspend "1 0 1"
 > 5 5 3 sleep "1 1 0"
 > 5 6 3 receive "1 0 0"
 > 5 7 3 send "0 0 1"
 > 5 8 3 task_execute "0 1 1"
-> 4 9 0 2 2 MSG_PROCESS_LINK
-> 4 10 0 2 2 MSG_PROCESS_TASK_LINK
+> 4 9 0 2 2 ACTOR_LINK
+> 4 10 0 2 2 ACTOR_TASK_LINK
 > 6 0 2 1 0 "Jupiter"
 > 6 0 3 1 0 "Fafard"
 > 6 0 4 1 0 "Ginette"
@@ -514,15 +514,15 @@ $ tail -n +3 procmig.trace
 > 6 0 1 1 0 "Tremblay"
 > 1 2 1 power "1 1 1"
 > 1 3 1 power_used "0.5 0.5 0.5"
-> 0 4 1 MSG_PROCESS
-> 2 5 4 MSG_PROCESS_STATE
+> 0 4 1 ACTOR
+> 2 5 4 ACTOR_STATE
 > 5 6 5 suspend "1 0 1"
 > 5 7 5 sleep "1 1 0"
 > 5 8 5 receive "1 0 0"
 > 5 9 5 send "0 0 1"
 > 5 10 5 task_execute "0 1 1"
-> 4 11 0 4 4 MSG_PROCESS_LINK
-> 4 12 0 4 4 MSG_PROCESS_TASK_LINK
+> 4 11 0 4 4 ACTOR_LINK
+> 4 12 0 4 4 ACTOR_TASK_LINK
 > 6 0 2 1 0 "Jupiter"
 > 6 0 3 1 0 "Fafard"
 > 6 0 4 1 0 "Ginette"
@@ -1116,15 +1116,15 @@ $ tail -n +3 procmig.trace
 > 6 0 1 1 0 "Tremblay"
 > 1 2 1 power "1 1 1"
 > 1 3 1 power_used "0.5 0.5 0.5"
-> 0 4 1 MSG_PROCESS
-> 2 5 4 MSG_PROCESS_STATE
+> 0 4 1 ACTOR
+> 2 5 4 ACTOR_STATE
 > 5 6 5 suspend "1 0 1"
 > 5 7 5 sleep "1 1 0"
 > 5 8 5 receive "1 0 0"
 > 5 9 5 send "0 0 1"
 > 5 10 5 task_execute "0 1 1"
-> 4 11 0 4 4 MSG_PROCESS_LINK
-> 4 12 0 4 4 MSG_PROCESS_TASK_LINK
+> 4 11 0 4 4 ACTOR_LINK
+> 4 12 0 4 4 ACTOR_TASK_LINK
 > 6 0 2 1 0 "Jupiter"
 > 6 0 3 1 0 "Fafard"
 > 6 0 4 1 0 "Ginette"
@@ -2529,15 +2529,15 @@ $ tail -n +3 simgrid.trace
 > %EndEventDef
 > 0 1 0 HOST
 > 6 0 1 1 0 "Tremblay"
-> 0 2 1 MSG_PROCESS
-> 2 3 2 MSG_PROCESS_STATE
+> 0 2 1 ACTOR
+> 2 3 2 ACTOR_STATE
 > 5 4 3 suspend "1 0 1"
 > 5 5 3 sleep "1 1 0"
 > 5 6 3 receive "1 0 0"
 > 5 7 3 send "0 0 1"
 > 5 8 3 task_execute "0 1 1"
-> 4 9 0 2 2 MSG_PROCESS_LINK
-> 4 10 0 2 2 MSG_PROCESS_TASK_LINK
+> 4 9 0 2 2 ACTOR_LINK
+> 4 10 0 2 2 ACTOR_TASK_LINK
 > 6 0 2 1 0 "Jupiter"
 > 6 0 3 1 0 "Fafard"
 > 6 0 4 1 0 "Ginette"
index 63e3eb8..23816c1 100644 (file)
@@ -34,6 +34,7 @@ XBT_PUBLIC void sg_actor_resume(sg_actor_t actor);
 XBT_PUBLIC int sg_actor_is_suspended(sg_actor_t actor);
 XBT_PUBLIC sg_actor_t sg_actor_restart(sg_actor_t actor);
 XBT_PUBLIC void sg_actor_daemonize(sg_actor_t actor);
+XBT_PUBLIC void sg_actor_migrate(sg_actor_t process, sg_host_t host);
 
 SG_END_DECL()
 
index f71ddc9..31ed124 100644 (file)
@@ -134,6 +134,7 @@ XBT_PUBLIC void MSG_process_resume(msg_process_t process);
 XBT_PUBLIC int MSG_process_is_suspended(msg_process_t process);
 XBT_PUBLIC void MSG_process_restart(msg_process_t process);
 XBT_PUBLIC void MSG_process_daemonize(msg_process_t process);
+XBT_PUBLIC void MSG_process_migrate(msg_process_t process, msg_host_t host);
 
 /* ******************************** File ************************************ */
 typedef sg_file_t msg_file_t;
@@ -233,7 +234,6 @@ XBT_PUBLIC void MSG_process_detach();
 
 XBT_PUBLIC void MSG_process_kill(msg_process_t process);
 XBT_PUBLIC int MSG_process_killall();
-XBT_PUBLIC msg_error_t MSG_process_migrate(msg_process_t process, msg_host_t host);
 XBT_PUBLIC void MSG_process_yield();
 
 XBT_PUBLIC void MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
index 63d5673..feb66c1 100644 (file)
@@ -281,12 +281,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobjec
     return;
   }
 
-  /* try to change the host of the process */
-  msg_error_t rv = MSG_process_migrate(process, host);
-  if (rv != MSG_OK) {
-    jmsg_throw_status(env,rv);
-    return;
-  }
+  /* change the host of the process */
+  process->migrate(host);
+
   /* change the host java side */
   env->SetObjectField(jprocess, jprocess_field_Process_host, jhost);
 }
index be37b07..d449cc7 100644 (file)
@@ -24,8 +24,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_config, instr, "Configuration");
 #define OPT_TRACING_FILENAME             "tracing/filename"
 #define OPT_TRACING_FORMAT_TI_ONEFILE    "tracing/smpi/format/ti-one-file"
 #define OPT_TRACING_FORMAT               "tracing/smpi/format"
-#define OPT_TRACING_MSG_PROCESS          "tracing/msg/process"
-#define OPT_TRACING_MSG_VM               "tracing/msg/vm"
+#define OPT_TRACING_ACTOR "tracing/msg/process"
+#define OPT_TRACING_VM "tracing/vm"
 #define OPT_TRACING_PLATFORM             "tracing/platform"
 #define OPT_TRACING_PRECISION            "tracing/precision"
 #define OPT_TRACING_SMPI_COMPUTING       "tracing/smpi/computing"
@@ -48,7 +48,7 @@ static bool trace_view_internals;
 static bool trace_categorized;
 static bool trace_uncategorized;
 static bool trace_actor_enabled;
-static bool trace_msg_vm_enabled;
+static bool trace_vm_enabled;
 static bool trace_buffer;
 static bool trace_disable_destroy;
 static bool trace_basic;
@@ -73,8 +73,8 @@ static void TRACE_getopts()
   trace_view_internals      = xbt_cfg_get_boolean(OPT_TRACING_SMPI_INTERNALS);
   trace_categorized         = xbt_cfg_get_boolean(OPT_TRACING_CATEGORIZED);
   trace_uncategorized       = xbt_cfg_get_boolean(OPT_TRACING_UNCATEGORIZED);
-  trace_actor_enabled       = trace_enabled && xbt_cfg_get_boolean(OPT_TRACING_MSG_PROCESS);
-  trace_msg_vm_enabled      = xbt_cfg_get_boolean(OPT_TRACING_MSG_VM);
+  trace_actor_enabled       = trace_enabled && xbt_cfg_get_boolean(OPT_TRACING_ACTOR);
+  trace_vm_enabled          = xbt_cfg_get_boolean(OPT_TRACING_VM);
   trace_buffer              = xbt_cfg_get_boolean(OPT_TRACING_BUFFER);
   trace_disable_destroy     = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_DESTROY);
   trace_basic               = xbt_cfg_get_boolean(OPT_TRACING_BASIC);
@@ -156,7 +156,7 @@ int TRACE_end()
 
 bool TRACE_needs_platform ()
 {
-  return TRACE_actor_is_enabled() || TRACE_msg_vm_is_enabled() || TRACE_categorized() || TRACE_uncategorized() ||
+  return TRACE_actor_is_enabled() || TRACE_vm_is_enabled() || TRACE_categorized() || TRACE_uncategorized() ||
          TRACE_platform() || (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped());
 }
 
@@ -220,9 +220,9 @@ bool TRACE_actor_is_enabled()
   return trace_actor_enabled;
 }
 
-bool TRACE_msg_vm_is_enabled()
+bool TRACE_vm_is_enabled()
 {
-  return trace_msg_vm_enabled && TRACE_is_enabled();
+  return trace_vm_enabled && TRACE_is_enabled();
 }
 
 bool TRACE_disable_link()
@@ -295,8 +295,8 @@ void TRACE_global_init()
   xbt_cfg_register_boolean(OPT_TRACING_CATEGORIZED, "no", nullptr, "Tracing categorized resource utilization of hosts and links.");
   xbt_cfg_register_boolean(OPT_TRACING_UNCATEGORIZED, "no", nullptr, "Tracing uncategorized resource utilization of hosts and links.");
 
-  xbt_cfg_register_boolean(OPT_TRACING_MSG_PROCESS, "no", nullptr, "Tracing of MSG process behavior.");
-  xbt_cfg_register_boolean(OPT_TRACING_MSG_VM, "no", nullptr, "Tracing of MSG process behavior.");
+  xbt_cfg_register_boolean(OPT_TRACING_ACTOR, "no", nullptr, "Tracing of actor behavior.");
+  xbt_cfg_register_boolean(OPT_TRACING_VM, "no", nullptr, "Tracing of virtual machine behavior.");
   xbt_cfg_register_boolean(OPT_TRACING_DISABLE_LINK, "no", nullptr, "Do not trace link bandwidth and latency.");
   xbt_cfg_register_boolean(OPT_TRACING_DISABLE_POWER, "no", nullptr, "Do not trace host power.");
   xbt_cfg_register_boolean(OPT_TRACING_BUFFER, "yes", nullptr, "Buffer trace events to put them in temporal order.");
@@ -370,10 +370,11 @@ void TRACE_help (int detailed)
       "  to allow further study of simulated or real sleep time", detailed);
   print_line (OPT_TRACING_SMPI_INTERNALS, "Generates tracing events corresponding",
       "  to point-to-point messages sent by collective communications", detailed);
-  print_line (OPT_TRACING_MSG_PROCESS, "Trace processes behavior (MSG)",
-      "  This option only has effect if this simulator is MSG-based. It traces the\n"
-      "  behavior of all categorized MSG processes, grouping them by hosts. This option\n"
-      "  can be used to track process location if this simulator has process migration.", detailed);
+  print_line(OPT_TRACING_ACTOR, "Trace actor behavior",
+             "  This option traces the behavior of all categorized actors, grouping them\n"
+             "  by hosts. This option can be used to track actor location if the simulator\n"
+             "  does actor migration.",
+             detailed);
   print_line (OPT_TRACING_BUFFER, "Buffer events to put them in temporal order",
       "  This option put some events in a time-ordered buffer using the insertion\n"
       "  sort algorithm. The process of acquiring and releasing locks to access this\n"
index ce66709..72afa41 100644 (file)
@@ -135,6 +135,7 @@ void Container::removeFromParent()
     XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", getCname(), father_->getCname());
     father_->children_.erase(name_);
   }
+  delete this;
 }
 
 void Container::logCreation()
index 6e3af55..57413b0 100644 (file)
@@ -203,7 +203,7 @@ XBT_PRIVATE bool TRACE_is_configured();
 XBT_PRIVATE bool TRACE_categorized();
 XBT_PRIVATE bool TRACE_uncategorized();
 XBT_PRIVATE bool TRACE_actor_is_enabled();
-XBT_PRIVATE bool TRACE_msg_vm_is_enabled();
+XBT_PRIVATE bool TRACE_vm_is_enabled();
 XBT_PRIVATE bool TRACE_buffer();
 XBT_PRIVATE bool TRACE_disable_link();
 XBT_PRIVATE bool TRACE_disable_speed();
index b4abc6a..d9eceb3 100644 (file)
@@ -3,7 +3,6 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "simgrid/s4u/Host.hpp"
 #include "src/instr/instr_private.hpp"
 #include "src/msg/msg_private.hpp"
 #include "src/simix/ActorImpl.hpp"
@@ -16,54 +15,10 @@ std::string instr_pid(msg_process_t proc)
   return std::string(proc->getCname()) + "-" + std::to_string(proc->getPid());
 }
 
-void TRACE_msg_process_change_host(msg_process_t process, msg_host_t new_host)
-{
-  if (TRACE_actor_is_enabled()) {
-    static long long int counter = 0;
-
-    std::string key = std::to_string(counter);
-    counter++;
-
-    //start link
-    container_t msg                = simgrid::instr::Container::byName(instr_pid(process));
-    simgrid::instr::LinkType* link = simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_LINK");
-    link->startEvent(msg, "M", key);
-
-    //destroy existing container of this process
-    TRACE_msg_process_destroy(process);
-
-    //create new container on the new_host location
-    TRACE_msg_process_create(process, new_host);
-
-    //end link
-    msg = simgrid::instr::Container::byName(instr_pid(process));
-    link->endEvent(msg, "M", key);
-  }
-}
-
-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(instr_pid(process), "MSG_PROCESS", host_container);
-  }
-}
-
-void TRACE_msg_process_destroy(msg_process_t process)
-{
-  if (TRACE_actor_is_enabled()) {
-    container_t container = simgrid::instr::Container::byNameOrNull(instr_pid(process));
-    if (container) {
-      container->removeFromParent();
-      delete container;
-    }
-  }
-}
-
 void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t process)
 {
   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);
+    simgrid::instr::Container::byName(instr_pid(process))->removeFromParent();
   }
 }
index 6c0d673..4a3cd09 100644 (file)
@@ -50,7 +50,7 @@ void TRACE_msg_task_execute_start(msg_task_t task)
 
   if (TRACE_actor_is_enabled())
     simgrid::instr::Container::byName(instr_pid(MSG_process_self()))
-        ->getState("MSG_PROCESS_STATE")
+        ->getState("ACTOR_STATE")
         ->pushEvent("task_execute");
 }
 
@@ -59,7 +59,7 @@ void TRACE_msg_task_execute_end(msg_task_t task)
   XBT_DEBUG("EXEC,out %p, %lld, %s", task, task->counter, task->category);
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("MSG_PROCESS_STATE")->popEvent();
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->popEvent();
 }
 
 /* MSG_task_destroy related functions */
@@ -78,9 +78,7 @@ void TRACE_msg_task_get_start()
   XBT_DEBUG("GET,in");
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))
-        ->getState("MSG_PROCESS_STATE")
-        ->pushEvent("receive");
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->pushEvent("receive");
 }
 
 void TRACE_msg_task_get_end(msg_task_t task)
@@ -89,10 +87,10 @@ void TRACE_msg_task_get_end(msg_task_t task)
 
   if (TRACE_actor_is_enabled()) {
     container_t process_container = simgrid::instr::Container::byName(instr_pid(MSG_process_self()));
-    process_container->getState("MSG_PROCESS_STATE")->popEvent();
+    process_container->getState("ACTOR_STATE")->popEvent();
 
     std::string key = std::string("p") + std::to_string(task->counter);
-    simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_TASK_LINK")->endEvent(process_container, "SR", key);
+    simgrid::instr::Container::getRoot()->getLink("ACTOR_TASK_LINK")->endEvent(process_container, "SR", key);
   }
 }
 
@@ -103,10 +101,10 @@ int TRACE_msg_task_put_start(msg_task_t task)
 
   if (TRACE_actor_is_enabled()) {
     container_t process_container = simgrid::instr::Container::byName(instr_pid(MSG_process_self()));
-    process_container->getState("MSG_PROCESS_STATE")->pushEvent("send");
+    process_container->getState("ACTOR_STATE")->pushEvent("send");
 
     std::string key = std::string("p") + std::to_string(task->counter);
-    simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_TASK_LINK")->startEvent(process_container, "SR", key);
+    simgrid::instr::Container::getRoot()->getLink("ACTOR_TASK_LINK")->startEvent(process_container, "SR", key);
   }
 
   return 1;
@@ -117,5 +115,5 @@ void TRACE_msg_task_put_end()
   XBT_DEBUG("PUT,out");
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("MSG_PROCESS_STATE")->popEvent();
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->popEvent();
 }
index 95ac049..68de1d9 100644 (file)
@@ -114,7 +114,7 @@ msg_error_t MSG_process_sleep(double nb_sec)
   msg_error_t status = MSG_OK;
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("MSG_PROCESS_STATE")->pushEvent("sleep");
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->pushEvent("sleep");
 
   try {
     simcall_process_sleep(nb_sec);
@@ -134,7 +134,7 @@ msg_error_t MSG_process_sleep(double nb_sec)
   }
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("MSG_PROCESS_STATE")->popEvent();
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->popEvent();
 
   return status;
 }
index 7e776ca..0f4e828 100644 (file)
@@ -54,6 +54,10 @@ void MSG_process_daemonize(sg_actor_t actor)
 {
   sg_actor_daemonize(actor);
 }
+void MSG_process_migrate(sg_actor_t actor, sg_host_t host)
+{
+  sg_actor_migrate(actor, host);
+}
 
 /* ************************** NetZones *************************** */
 sg_netzone_t MSG_zone_get_root()
index ef568da..89346d1 100644 (file)
@@ -84,9 +84,6 @@ struct s_MSG_Global_t {
 };
 typedef s_MSG_Global_t* MSG_Global_t;
 
-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" {
 
 XBT_PUBLIC_DATA MSG_Global_t msg_global;
@@ -111,7 +108,6 @@ XBT_PRIVATE int TRACE_msg_task_put_start(msg_task_t task); // returns TRUE if th
 XBT_PRIVATE void TRACE_msg_task_put_end();
 
 /* declaration of instrumentation functions from msg_process_instr.c */
-XBT_PRIVATE void TRACE_msg_process_change_host(msg_process_t process, msg_host_t new_host);
 XBT_PRIVATE void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t process);
 }
 
index d352e3e..18cb6bc 100644 (file)
@@ -40,7 +40,9 @@ void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_actor)
     simcall_process_set_data(smx_actor, nullptr);
   }
 
-  TRACE_msg_process_destroy(smx_actor->ciface());
+  if (TRACE_actor_is_enabled())
+    simgrid::instr::Container::byName(instr_pid(smx_actor->ciface()))->removeFromParent();
+
   // 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);
@@ -218,19 +220,6 @@ msg_error_t MSG_process_join(msg_process_t process, double timeout){
   return MSG_OK;
 }
 
-/** \ingroup m_process_management
- * \brief Migrates a process to another location.
- *
- * This function checks whether \a process and \a host are valid pointers and change the value of the #msg_host_t on
- * which \a process is running.
- */
-msg_error_t MSG_process_migrate(msg_process_t process, msg_host_t host)
-{
-  TRACE_msg_process_change_host(process, host);
-  process->migrate(host);
-  return MSG_OK;
-}
-
 /** Yield the current actor; let the other actors execute first */
 void MSG_process_yield()
 {
index baae906..e3a21aa 100644 (file)
@@ -57,7 +57,7 @@ void MigrationRx::operator()()
   vm_->getImpl()->isMigrating = false;
   XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", vm_->getCname(), src_pm_->getCname(), dst_pm_->getCname());
 
-  if (TRACE_msg_vm_is_enabled()) {
+  if (TRACE_vm_is_enabled()) {
     static long long int counter = 0;
     std::string key              = std::to_string(counter);
     counter++;
@@ -67,9 +67,7 @@ void MigrationRx::operator()()
     simgrid::instr::Container::getRoot()->getLink("MSG_VM_LINK")->startEvent(msg, "M", key);
 
     // destroy existing container of this vm
-    container_t existing_container = simgrid::instr::Container::byName(vm_->getName());
-    existing_container->removeFromParent();
-    delete existing_container;
+    simgrid::instr::Container::byName(vm_->getName())->removeFromParent();
 
     // create new container on the new_host location
     new simgrid::instr::Container(vm_->getCname(), "MSG_VM", simgrid::instr::Container::byName(dst_pm_->getName()));
index be893e8..e5b209e 100644 (file)
@@ -41,7 +41,7 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm, int coreAmount,
   /* Make a process container */
   extension_set<simgrid::simix::Host>(new simgrid::simix::Host());
 
-  if (TRACE_msg_vm_is_enabled()) {
+  if (TRACE_vm_is_enabled()) {
     container_t host_container = instr::Container::byName(pm->getName());
     new instr::Container(name, "MSG_VM", host_container);
     instr::Container::byName(getName())->getState("MSG_VM_STATE")->addEntityValue("start", "0 0 1");   // start is blue
@@ -66,16 +66,13 @@ VirtualMachine::~VirtualMachine()
   /* Don't free these things twice: they are the ones of my physical host */
   pimpl_netpoint = nullptr;
 
-  if (TRACE_msg_vm_is_enabled()) {
-    container_t container = simgrid::instr::Container::byName(getName());
-    container->removeFromParent();
-    delete container;
-  }
+  if (TRACE_vm_is_enabled())
+    simgrid::instr::Container::byName(getName())->removeFromParent();
 }
 
 void VirtualMachine::start()
 {
-  if (TRACE_msg_vm_is_enabled())
+  if (TRACE_vm_is_enabled())
     simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->pushEvent("start");
 
   simgrid::simix::kernelImmediate([this]() {
@@ -107,7 +104,7 @@ void VirtualMachine::start()
     this->pimpl_vm_->setState(SURF_VM_STATE_RUNNING);
   });
 
-  if (TRACE_msg_vm_is_enabled())
+  if (TRACE_vm_is_enabled())
     simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->popEvent();
 }
 
@@ -115,7 +112,7 @@ void VirtualMachine::suspend()
 {
   smx_actor_t issuer = SIMIX_process_self();
   simgrid::simix::kernelImmediate([this, issuer]() { pimpl_vm_->suspend(issuer); });
-  if (TRACE_msg_vm_is_enabled())
+  if (TRACE_vm_is_enabled())
     simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->pushEvent("suspend");
   XBT_DEBUG("vm_suspend done");
 }
@@ -123,7 +120,7 @@ void VirtualMachine::suspend()
 void VirtualMachine::resume()
 {
   pimpl_vm_->resume();
-  if (TRACE_msg_vm_is_enabled())
+  if (TRACE_vm_is_enabled())
     simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->popEvent();
 }
 
index 7cb47fd..e8b3fdf 100644 (file)
@@ -88,6 +88,23 @@ void Actor::onExit(int_f_pvoid_pvoid_t fun, void* data)
  */
 void Actor::migrate(Host* new_host)
 {
+  std::string key;
+  simgrid::instr::LinkType* link = nullptr;
+  if (TRACE_actor_is_enabled()) {
+    static long long int counter = 0;
+
+    key = std::to_string(counter);
+    counter++;
+
+    // start link
+    container_t actor_container = simgrid::instr::Container::byName(instr_pid(this));
+    link                        = simgrid::instr::Container::getRoot()->getLink("ACTOR_LINK");
+    link->startEvent(actor_container, "M", key);
+
+    // destroy existing container of this process
+    actor_container->removeFromParent();
+  }
+
   simgrid::simix::kernelImmediate([this, new_host]() {
     if (pimpl_->waiting_synchro != nullptr) {
       // The actor is blocked on an activity. If it's an exec, migrate it too.
@@ -99,6 +116,14 @@ void Actor::migrate(Host* new_host)
     }
     SIMIX_process_change_host(this->pimpl_, 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()));
+
+    // end link
+    link->endEvent(simgrid::instr::Container::byName(instr_pid(this)), "M", key);
+  }
 }
 
 s4u::Host* Actor::getHost()
@@ -139,7 +164,7 @@ aid_t Actor::getPpid()
 void Actor::suspend()
 {
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(this))->getState("MSG_PROCESS_STATE")->pushEvent("suspend");
+    simgrid::instr::Container::byName(instr_pid(this))->getState("ACTOR_STATE")->pushEvent("suspend");
 
   simcall_process_suspend(pimpl_);
 }
@@ -148,7 +173,7 @@ void Actor::resume()
 {
   simgrid::simix::kernelImmediate([this] { pimpl_->resume(); });
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(this))->getState("MSG_PROCESS_STATE")->popEvent();
+    simgrid::instr::Container::byName(instr_pid(this))->getState("ACTOR_STATE")->popEvent();
 }
 
 int Actor::isSuspended()
@@ -333,9 +358,7 @@ Host* getHost()
 void suspend()
 {
   if (TRACE_actor_is_enabled())
-    instr::Container::byName(getName() + "-" + std::to_string(getPid()))
-        ->getState("MSG_PROCESS_STATE")
-        ->pushEvent("suspend");
+    instr::Container::byName(getName() + "-" + std::to_string(getPid()))->getState("ACTOR_STATE")->pushEvent("suspend");
   simcall_process_suspend(SIMIX_process_self());
 }
 
@@ -345,7 +368,7 @@ void resume()
   simgrid::simix::kernelImmediate([process] { process->resume(); });
 
   if (TRACE_actor_is_enabled())
-    instr::Container::byName(getName() + "-" + std::to_string(getPid()))->getState("MSG_PROCESS_STATE")->popEvent();
+    instr::Container::byName(getName() + "-" + std::to_string(getPid()))->getState("ACTOR_STATE")->popEvent();
 }
 
 bool isSuspended()
@@ -496,4 +519,14 @@ void sg_actor_daemonize(sg_actor_t actor)
   actor->daemonize();
 }
 
+/** \ingroup m_process_management
+ * \brief Migrates an actor to another location.
+ *
+ * This function changes the value of the #sg_host_t on  which \a actor is running.
+ */
+void sg_actor_migrate(sg_actor_t process, sg_host_t host)
+{
+  process->migrate(host);
+}
+
 SG_END_DECL()
index dec1dff..64eb25a 100644 (file)
@@ -349,7 +349,9 @@ 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->ciface(), process->host);
+  if (TRACE_actor_is_enabled())
+    new simgrid::instr::Container(instr_pid(process->ciface()), "ACTOR",
+                                  simgrid::instr::Container::byName(process->host->getName()));
 
   /* 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 +409,9 @@ 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->ciface(), process->host);
+  if (TRACE_actor_is_enabled())
+    new simgrid::instr::Container(instr_pid(process->ciface()), "ACTOR",
+                                  simgrid::instr::Container::byName(process->host->getName()));
 
   auto* context = dynamic_cast<simgrid::kernel::context::AttachContext*>(process->context);
   if (not context)
index fd3309b..added70 100644 (file)
@@ -180,9 +180,7 @@ void TRACE_smpi_finalize(int rank)
   if (not TRACE_smpi_is_enabled())
     return;
 
-  container_t container = smpi_container(rank);
-  container->removeFromParent();
-  delete container;
+  smpi_container(rank)->removeFromParent();
 }
 
 void TRACE_smpi_computing_init(int rank)
index 524628b..fcb53ce 100644 (file)
@@ -223,18 +223,18 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
     container->type_->getOrCreateContainerType("MPI")->getOrCreateStateType("MPI_STATE");
 
   if (TRACE_actor_is_enabled()) {
-    simgrid::instr::ContainerType* msg_process = container->type_->getOrCreateContainerType("MSG_PROCESS");
-    simgrid::instr::StateType* state           = msg_process->getOrCreateStateType("MSG_PROCESS_STATE");
+    simgrid::instr::ContainerType* actor = container->type_->getOrCreateContainerType("ACTOR");
+    simgrid::instr::StateType* state     = actor->getOrCreateStateType("ACTOR_STATE");
     state->addEntityValue("suspend", "1 0 1");
     state->addEntityValue("sleep", "1 1 0");
     state->addEntityValue("receive", "1 0 0");
     state->addEntityValue("send", "0 0 1");
     state->addEntityValue("task_execute", "0 1 1");
-    root->type_->getOrCreateLinkType("MSG_PROCESS_LINK", msg_process, msg_process);
-    root->type_->getOrCreateLinkType("MSG_PROCESS_TASK_LINK", msg_process, msg_process);
+    root->type_->getOrCreateLinkType("ACTOR_LINK", actor, actor);
+    root->type_->getOrCreateLinkType("ACTOR_TASK_LINK", actor, actor);
   }
 
-  if (TRACE_msg_vm_is_enabled()) {
+  if (TRACE_vm_is_enabled()) {
     simgrid::instr::ContainerType* msg_vm = container->type_->getOrCreateContainerType("MSG_VM");
     simgrid::instr::StateType* state      = msg_vm->getOrCreateStateType("MSG_VM_STATE");
     state->addEntityValue("suspend", "1 0 1");
@@ -243,7 +243,7 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
     state->addEntityValue("send", "0 0 1");
     state->addEntityValue("task_execute", "0 1 1");
     root->type_->getOrCreateLinkType("MSG_VM_LINK", msg_vm, msg_vm);
-    root->type_->getOrCreateLinkType("MSG_VM_PROCESS_LINK", msg_vm, msg_vm);
+    root->type_->getOrCreateLinkType("MSG_VM_ACTOR_LINK", msg_vm, msg_vm);
   }
 }