- XBT_DEBUG("Irecv on %s", MSG_process_get_name(MSG_process_self()));
-
- snprintf(mailbox,249, "%s_%s", action[2], MSG_process_get_name(MSG_process_self()));
- msg_task_t t = NULL;
- xbt_dynar_push(globals->tasks, &t);
- msg_comm_t c = MSG_task_irecv((msg_task**)xbt_dynar_get_ptr(globals->tasks, xbt_dynar_length(globals->tasks) - 1), mailbox);
- xbt_dynar_push(globals->irecvs, &c);
-
- log_action(action, MSG_get_clock() - clock);
- asynchronous_cleanup();
-}
-
-static void action_wait(const char *const *action)
-{
- msg_task_t task = NULL;
- msg_comm_t comm;
- double clock = MSG_get_clock();
- process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self());
-
- xbt_assert(xbt_dynar_length(globals->irecvs), "action wait not preceded by any irecv: %s",
- xbt_str_join_array(action, " "));
-
- ACT_DEBUG("Entering %s", NAME);
- comm = xbt_dynar_pop_as(globals->irecvs, msg_comm_t);
- MSG_comm_wait(comm, -1);
- task = xbt_dynar_pop_as(globals->tasks, msg_task_t);
- MSG_comm_destroy(comm);
- MSG_task_destroy(task);
-
- log_action(action, MSG_get_clock() - clock);
-}
-
-/* FIXME: that's a poor man's implementation: we should take the message exchanges into account */
-static void action_barrier(const char *const *action)
-{
- // static smx_mutex_t mutex = NULL;
- // static smx_cond_t cond = NULL;
- static simgrid::s4u::Mutex *mutex = NULL;
- static simgrid::s4u::ConditionVariable *cond = NULL;
- static int processes_arrived_sofar = 0;
- if (mutex == NULL) { // first arriving on the barrier
- mutex = new simgrid::s4u::Mutex();
- cond = new simgrid::s4u::ConditionVariable();
- processes_arrived_sofar = 0;
- }
- ACT_DEBUG("Entering barrier: %s (%d already there)", NAME, processes_arrived_sofar);
- mutex->lock();
- if (++processes_arrived_sofar == communicator_size) {
- cond->notify_all();
- mutex->unlock();
- } else {
- cond->wait(mutex);
- mutex->unlock();
+ static void send(const char* const* action)
+ {
+ double size = std::stod(action[3]);
+ char* payload = xbt_strdup(action[3]);
+ double clock = simgrid::s4u::Engine::getClock();
+ simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::name() + "_" + action[2]);
+ ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME, size,
+ simgrid::s4u::this_actor::name().c_str(), to->name());
+ to->send(payload, size);
+ xbt_free(payload);
+
+ log_action(action, simgrid::s4u::Engine::getClock() - clock);