+/**
+ * @brief Executes the actors in actors_to_run.
+ *
+ * The actors in actors_to_run are run (in parallel if possible). On exit, actors_to_run is empty, and actors_that_ran
+ * contains the list of actors that just ran. The two lists are swapped so, be careful when using them before and after
+ * a call to this function.
+ */
+void Global::run_all_actors()
+{
+ simix_global->context_factory->run_all();
+
+ actors_to_run.swap(actors_that_ran);
+ actors_to_run.clear();
+}
+
+/** Wake up all actors waiting for a Surf action to finish */
+void Global::wake_all_waiting_actors()
+{
+ for (auto const& model : all_existing_models) {
+ kernel::resource::Action* action;
+
+ XBT_DEBUG("Handling the failed actions (if any)");
+ while ((action = model->extract_failed_action())) {
+ XBT_DEBUG(" Handling Action %p", action);
+ if (action->get_activity() != nullptr)
+ kernel::activity::ActivityImplPtr(action->get_activity())->post();
+ }
+ XBT_DEBUG("Handling the terminated actions (if any)");
+ while ((action = model->extract_done_action())) {
+ XBT_DEBUG(" Handling Action %p", action);
+ if (action->get_activity() == nullptr)
+ XBT_DEBUG("probably vcpu's action %p, skip", action);
+ else
+ kernel::activity::ActivityImplPtr(action->get_activity())->post();
+ }
+ }
+}
+
+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());
+ }
+ }