From: Frederic Suter Date: Wed, 20 Feb 2019 15:48:31 +0000 (+0100) Subject: modernize a simcall in MSG X-Git-Tag: v3_22~282 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0bc609260a603d6d396101c30ad4dd9c845e6dfd modernize a simcall in MSG --- diff --git a/examples/deprecated/msg/trace-process-migration/trace-process-migration.tesh b/examples/deprecated/msg/trace-process-migration/trace-process-migration.tesh index 37871723c0..de1dec387d 100644 --- a/examples/deprecated/msg/trace-process-migration/trace-process-migration.tesh +++ b/examples/deprecated/msg/trace-process-migration/trace-process-migration.tesh @@ -255,13 +255,13 @@ $ tail -n +3 procmig.trace > 4 14 0 6 6 ACTOR_TASK_LINK > 6 0.000000 33 6 1 "policeman-2" > 12 0.000000 7 32 9 -> 12 0.000000 7 33 11 > 15 0.000000 14 0 SR 33 p0 +> 12 0.000000 7 33 11 > 13 2.000000 7 32 > 12 2.000000 7 32 10 > 13 2.025708 7 33 -> 12 2.025708 7 33 11 > 15 2.025708 14 0 SR 33 p1 +> 12 2.025708 7 33 11 > 13 2.025708 7 32 > 16 2.025708 14 0 SR 32 p0 > 15 2.025708 13 0 M 32 0 @@ -272,8 +272,8 @@ $ tail -n +3 procmig.trace > 13 4.025708 7 34 > 12 4.025708 7 34 10 > 13 4.025903 7 33 -> 12 4.025903 7 33 11 > 15 4.025903 14 0 SR 33 p2 +> 12 4.025903 7 33 11 > 13 4.025903 7 34 > 16 4.025903 14 0 SR 34 p1 > 15 4.025903 13 0 M 34 1 @@ -284,8 +284,8 @@ $ tail -n +3 procmig.trace > 13 6.025903 7 35 > 12 6.025903 7 35 10 > 13 6.044918 7 33 -> 12 6.044918 7 33 11 > 15 6.044918 14 0 SR 33 p3 +> 12 6.044918 7 33 11 > 13 6.044918 7 35 > 16 6.044918 14 0 SR 35 p2 > 15 6.044918 13 0 M 35 2 @@ -296,8 +296,8 @@ $ tail -n +3 procmig.trace > 13 8.044918 7 36 > 12 8.044918 7 36 10 > 13 8.070626 7 33 -> 12 8.070626 7 33 11 > 15 8.070626 14 0 SR 33 p4 +> 12 8.070626 7 33 11 > 13 8.070626 7 36 > 16 8.070626 14 0 SR 36 p3 > 15 8.070626 13 0 M 36 3 @@ -308,8 +308,8 @@ $ tail -n +3 procmig.trace > 13 10.070626 7 37 > 12 10.070626 7 37 10 > 13 10.087178 7 33 -> 12 10.087178 7 33 11 > 15 10.087178 14 0 SR 33 p5 +> 12 10.087178 7 33 11 > 13 10.087178 7 37 > 16 10.087178 14 0 SR 37 p4 > 15 10.087178 13 0 M 37 4 @@ -320,8 +320,8 @@ $ tail -n +3 procmig.trace > 13 12.087178 7 38 > 12 12.087178 7 38 10 > 13 12.112617 7 33 -> 12 12.112617 7 33 11 > 15 12.112617 14 0 SR 33 p6 +> 12 12.112617 7 33 11 > 13 12.112617 7 38 > 16 12.112617 14 0 SR 38 p5 > 15 12.112617 13 0 M 38 5 @@ -332,8 +332,8 @@ $ tail -n +3 procmig.trace > 13 14.112617 7 39 > 12 14.112617 7 39 10 > 13 14.138325 7 33 -> 12 14.138325 7 33 11 > 15 14.138325 14 0 SR 33 p7 +> 12 14.138325 7 33 11 > 13 14.138325 7 39 > 16 14.138325 14 0 SR 39 p6 > 15 14.138325 13 0 M 39 6 @@ -344,8 +344,8 @@ $ tail -n +3 procmig.trace > 13 16.138325 7 40 > 12 16.138325 7 40 10 > 13 16.138521 7 33 -> 12 16.138521 7 33 11 > 15 16.138521 14 0 SR 33 p8 +> 12 16.138521 7 33 11 > 13 16.138521 7 40 > 16 16.138521 14 0 SR 40 p7 > 15 16.138521 13 0 M 40 7 diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index fd90d4f4be..6fa750c748 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -6,6 +6,7 @@ #include "simgrid/Exception.hpp" #include +#include "simgrid/s4u/Comm.hpp" #include "simgrid/s4u/Mailbox.hpp" #include "src/instr/instr_private.hpp" #include "src/kernel/activity/ExecImpl.hpp" @@ -716,7 +717,11 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl msg_process_t process = MSG_process_self(); simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::by_name(alias); - TRACE_msg_task_put_start(task); + if (TRACE_actor_is_enabled()) { + container_t process_container = simgrid::instr::Container::by_name(instr_pid(MSG_process_self())); + std::string key = std::string("p") + std::to_string(task->counter); + simgrid::instr::Container::get_root()->get_link("ACTOR_TASK_LINK")->start_event(process_container, "SR", key); + } /* Prepare the task to send */ t_simdata = task->simdata; @@ -730,13 +735,12 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl /* Try to send it by calling SIMIX network layer */ try { - smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simix call */ - comm = simcall_comm_isend(SIMIX_process_self(), mailbox->get_impl(), t_simdata->bytes_amount, t_simdata->rate, task, - sizeof(void*), nullptr, nullptr, nullptr, nullptr, 0); + simgrid::s4u::CommPtr comm = mailbox->put_init(task, t_simdata->bytes_amount)->set_rate(t_simdata->rate); + t_simdata->comm = boost::static_pointer_cast(comm->get_impl()); + comm->start(); if (TRACE_is_enabled() && task->category != nullptr) - simgrid::simix::simcall([comm, task] { comm->set_category(task->category); }); - t_simdata->comm = boost::static_pointer_cast(comm); - simcall_comm_wait(comm, timeout); + simgrid::simix::simcall([comm, task] { comm->get_impl()->set_category(task->category); }); + comm->wait_for(timeout); } catch (simgrid::TimeoutError& e) { ret = MSG_TIMEOUT; } catch (simgrid::CancelException& e) { @@ -751,7 +755,6 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl t_simdata->setNotUsed(); } - TRACE_msg_task_put_end(); return ret; }