Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SIMIX_display_process_status becomes Global::display_all_actor_status
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 10 Dec 2019 09:03:36 +0000 (10:03 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 10 Dec 2019 09:04:27 +0000 (10:04 +0100)
include/simgrid/simix.h
src/simix/smx_global.cpp
src/simix/smx_private.hpp
src/surf/HostImpl.cpp

index 8ffb312..9b6ff41 100644 (file)
@@ -57,7 +57,8 @@ XBT_ATTRIB_DEPRECATED_v329("Please use simgrid::simix::Timer::next()") XBT_PUBLI
 XBT_ATTRIB_DEPRECATED_v329("Please use simgrid::simix::Timer::get_date()") XBT_PUBLIC
     double SIMIX_timer_get_date(smx_timer_t timer);
 
 XBT_ATTRIB_DEPRECATED_v329("Please use simgrid::simix::Timer::get_date()") XBT_PUBLIC
     double SIMIX_timer_get_date(smx_timer_t timer);
 
-XBT_PUBLIC void SIMIX_display_process_status();
+XBT_ATTRIB_DEPRECATED_v329("Please use simix_global->display_all_actor_status()") XBT_PUBLIC
+    void SIMIX_display_process_status();
 SG_END_DECL
 
 /******************************** Deployment **********************************/
 SG_END_DECL
 
 /******************************** Deployment **********************************/
index a3fc1e9..d951bcc 100644 (file)
@@ -43,7 +43,7 @@ XBT_ATTRIB_NORETURN static void inthandler(int)
   if (simgrid::simix::cfg_verbose_exit) {
     XBT_INFO("CTRL-C pressed. The current status will be displayed before exit (disable that behavior with option "
              "'debug/verbose-exit').");
   if (simgrid::simix::cfg_verbose_exit) {
     XBT_INFO("CTRL-C pressed. The current status will be displayed before exit (disable that behavior with option "
              "'debug/verbose-exit').");
-    SIMIX_display_process_status();
+    simix_global->display_all_actor_status();
   }
   else {
     XBT_INFO("CTRL-C pressed, exiting. Hiding the current process status since 'debug/verbose-exit' is set to false.");
   }
   else {
     XBT_INFO("CTRL-C pressed, exiting. Hiding the current process status since 'debug/verbose-exit' is set to false.");
@@ -220,6 +220,45 @@ void Global::wake_all_waiting_actors()
   }
 }
 
   }
 }
 
+void Global::display_all_actor_status()
+{
+  XBT_INFO("%lu actors are still running, waiting for something.", process_list.size());
+  /*  List the actors and their state */
+  XBT_INFO("Legend of the following listing: \"Actor <pid> (<name>@<host>): <status>\"");
+  for (auto const& kv : process_list) {
+    kernel::actor::ActorImpl* actor = kv.second;
+
+    if (actor->waiting_synchro) {
+      const char* synchro_description = "unknown";
+      // we don't care about the Activity type to get its name, use RawImpl
+      const char* name = boost::static_pointer_cast<kernel::activity::ActivityImpl_T<kernel::activity::RawImpl>>(
+                             actor->waiting_synchro)
+                             ->get_cname();
+
+      if (boost::dynamic_pointer_cast<kernel::activity::ExecImpl>(actor->waiting_synchro) != nullptr)
+        synchro_description = "execution";
+
+      if (boost::dynamic_pointer_cast<kernel::activity::CommImpl>(actor->waiting_synchro) != nullptr)
+        synchro_description = "communication";
+
+      if (boost::dynamic_pointer_cast<kernel::activity::SleepImpl>(actor->waiting_synchro) != nullptr)
+        synchro_description = "sleeping";
+
+      if (boost::dynamic_pointer_cast<kernel::activity::RawImpl>(actor->waiting_synchro) != nullptr)
+        synchro_description = "synchronization";
+
+      if (boost::dynamic_pointer_cast<kernel::activity::IoImpl>(actor->waiting_synchro) != nullptr)
+        synchro_description = "I/O";
+
+      XBT_INFO("Actor %ld (%s@%s): waiting for %s activity %p (%s) in state %d to finish", actor->get_pid(),
+               actor->get_cname(), actor->get_host()->get_cname(), synchro_description, actor->waiting_synchro.get(),
+               name, (int)actor->waiting_synchro->state_);
+    } else {
+      XBT_INFO("Actor %ld (%s@%s)", actor->get_pid(), actor->get_cname(), actor->get_host()->get_cname());
+    }
+  }
+}
+
 config::Flag<double> cfg_breakpoint{
     "debug/breakpoint", {"simix/breakpoint"}, "When non-negative, raise a SIGTRAP after given (simulated) time", -1.0};
 } // namespace simix
 config::Flag<double> cfg_breakpoint{
     "debug/breakpoint", {"simix/breakpoint"}, "When non-negative, raise a SIGTRAP after given (simulated) time", -1.0};
 } // namespace simix
@@ -523,7 +562,7 @@ void SIMIX_run()
     } else {
       XBT_CRITICAL("Oops! Deadlock or code not perfectly clean.");
     }
     } else {
       XBT_CRITICAL("Oops! Deadlock or code not perfectly clean.");
     }
-    SIMIX_display_process_status();
+    simix_global->display_all_actor_status();
     simgrid::s4u::Engine::on_deadlock();
     xbt_abort();
   }
     simgrid::s4u::Engine::on_deadlock();
     xbt_abort();
   }
@@ -552,47 +591,9 @@ double SIMIX_timer_get_date(smx_timer_t timer) // XBT_ATTRIB_DEPRECATED_v329
   return timer ? timer->get_date() : 0;
 }
 
   return timer ? timer->get_date() : 0;
 }
 
-void SIMIX_display_process_status()
+void SIMIX_display_process_status() // XBT_ATTRIB_DEPRECATED_v329
 {
 {
-  int nbprocess = simix_global->process_list.size();
-
-  XBT_INFO("%d processes are still running, waiting for something.", nbprocess);
-  /*  List the process and their state */
-  XBT_INFO("Legend of the following listing: \"Process <pid> (<name>@<host>): <status>\"");
-  for (auto const& kv : simix_global->process_list) {
-    simgrid::kernel::actor::ActorImpl* actor = kv.second;
-
-    if (actor->waiting_synchro) {
-      const char* synchro_description = "unknown";
-      // we don't care about the Activity type to get its name, use RawImpl
-      const char* name =
-          boost::static_pointer_cast<simgrid::kernel::activity::ActivityImpl_T<simgrid::kernel::activity::RawImpl>>(
-              actor->waiting_synchro)
-              ->get_cname();
-
-      if (boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(actor->waiting_synchro) != nullptr)
-        synchro_description = "execution";
-
-      if (boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(actor->waiting_synchro) != nullptr)
-        synchro_description = "communication";
-
-      if (boost::dynamic_pointer_cast<simgrid::kernel::activity::SleepImpl>(actor->waiting_synchro) != nullptr)
-        synchro_description = "sleeping";
-
-      if (boost::dynamic_pointer_cast<simgrid::kernel::activity::RawImpl>(actor->waiting_synchro) != nullptr)
-        synchro_description = "synchronization";
-
-      if (boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(actor->waiting_synchro) != nullptr)
-        synchro_description = "I/O";
-
-      XBT_INFO("Actor %ld (%s@%s): waiting for %s activity %p (%s) in state %d to finish", actor->get_pid(),
-               actor->get_cname(), actor->get_host()->get_cname(), synchro_description, actor->waiting_synchro.get(),
-               name, (int)actor->waiting_synchro->state_);
-    }
-    else {
-      XBT_INFO("Actor %ld (%s@%s)", actor->get_pid(), actor->get_cname(), actor->get_host()->get_cname());
-    }
-  }
+  simix_global->display_all_actor_status();
 }
 
 int SIMIX_is_maestro()
 }
 
 int SIMIX_is_maestro()
index 147a1f6..8ffc2ed 100644 (file)
@@ -31,6 +31,7 @@ public:
   void empty_trash();
   void run_all_actors();
   void wake_all_waiting_actors();
   void empty_trash();
   void run_all_actors();
   void wake_all_waiting_actors();
+  void display_all_actor_status();
 
   smx_context_factory_t context_factory = nullptr;
   std::vector<kernel::actor::ActorImpl*> actors_to_run;
 
   smx_context_factory_t context_factory = nullptr;
   std::vector<kernel::actor::ActorImpl*> actors_to_run;
index e9c5984..d8d97be 100644 (file)
@@ -40,7 +40,7 @@ HostImpl::~HostImpl()
     for (auto const& actor : actor_list_)
       msg += "\n\t" + std::string(actor.get_name());
 
     for (auto const& actor : actor_list_)
       msg += "\n\t" + std::string(actor.get_name());
 
-    SIMIX_display_process_status();
+    simix_global->display_all_actor_status();
     xbt_die("%s", msg.c_str());
   }
   for (auto const& arg : actors_at_boot_)
     xbt_die("%s", msg.c_str());
   }
   for (auto const& arg : actors_at_boot_)