+++ /dev/null
-/* Copyright (c) 2010-2019. The SimGrid Team.
- * All rights reserved. */
-
-/* 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 "mc/mc.h"
-#include "src/instr/instr_private.hpp"
-#include "src/msg/msg_private.hpp"
-
-#include <atomic>
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_msg, instr, "MSG instrumentation");
-
-/* MSG_task_put related functions */
-void TRACE_msg_task_put_start(msg_task_t task)
-{
- XBT_DEBUG("PUT,in %p, %lld, %s", task, task->get_id(), task->get_tracing_category().c_str());
-
- 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->get_id());
- simgrid::instr::Container::get_root()->get_link("ACTOR_TASK_LINK")->start_event(process_container, "SR", key);
- }
-}
msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, double timeout)
{
msg_error_t ret = MSG_OK;
-
- TRACE_msg_task_put_start(task);
-
- /* Prepare the task to send */
- task->set_used();
-
- msg_global->sent_msg++;
-
/* Try to send it */
try {
- simgrid::s4u::CommPtr comm =
- simgrid::s4u::Mailbox::by_name(alias)->put_init(task, task->bytes_amount)->set_rate(task->get_rate());
+ simgrid::s4u::CommPtr comm = task->send_async(alias, nullptr, false);
task->comm = comm;
- comm->start();
- if (TRACE_is_enabled() && task->has_tracing_category())
- simgrid::simix::simcall(
- [comm, task] { comm->get_impl()->set_category(std::move(task->get_tracing_category())); });
comm->wait_for(timeout);
} catch (simgrid::TimeoutError& e) {
ret = MSG_TIMEOUT;
static Task* create_parallel(std::string name, int host_nb, const msg_host_t* host_list, double* flops_amount,
double* bytes_amount, void* data);
msg_error_t execute();
- Comm* send_async(std::string alias, void_f_pvoid_t cleanup, bool detached);
+ s4u::CommPtr send_async(std::string alias, void_f_pvoid_t cleanup, bool detached);
void cancel();
Task(const Task&) = delete;
/*************************************************************/
XBT_PRIVATE void MSG_comm_copy_data_from_SIMIX(simgrid::kernel::activity::CommImpl* comm, void* buff, size_t buff_size);
-/********** Tracing **********/
-/* declaration of instrumentation functions from msg_task_instr.c */
-XBT_PRIVATE void TRACE_msg_task_put_start(msg_task_t task);
-
-
#endif
return status;
}
-Comm* Task::send_async(std::string alias, void_f_pvoid_t cleanup, bool detached)
+s4u::CommPtr Task::send_async(std::string alias, void_f_pvoid_t cleanup, bool detached)
{
- TRACE_msg_task_put_start(this);
+ 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(get_id());
+ simgrid::instr::Container::get_root()->get_link("ACTOR_TASK_LINK")->start_event(process_container, "SR", key);
+ }
/* Prepare the task to send */
set_used();
if (TRACE_is_enabled() && has_tracing_category())
simgrid::simix::simcall([comm, this] { comm->get_impl()->set_category(std::move(tracing_category_)); });
- if (not detached)
- return new Comm(this, nullptr, comm);
- else
- return nullptr;
+ return comm;
}
void Task::cancel()
*/
msg_comm_t MSG_task_isend(msg_task_t task, const char* alias)
{
- return task->send_async(alias, nullptr, false);
+ return new simgrid::msg::Comm(task, nullptr, task->send_async(alias, nullptr, false));
}
/**
msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char* alias, double maxrate)
{
task->set_rate(maxrate);
- return task->send_async(alias, nullptr, false);
+ return new simgrid::msg::Comm(task, nullptr, task->send_async(alias, nullptr, false));
}
/**
*/
void MSG_task_dsend(msg_task_t task, const char* alias, void_f_pvoid_t cleanup)
{
- msg_comm_t XBT_ATTRIB_UNUSED comm = task->send_async(alias, cleanup, true);
- xbt_assert(comm == nullptr);
+ task->send_async(alias, cleanup, true);
}
/**
void MSG_task_dsend_bounded(msg_task_t task, const char* alias, void_f_pvoid_t cleanup, double maxrate)
{
task->set_rate(maxrate);
- MSG_task_dsend(task, alias, cleanup);
+ task->send_async(alias, cleanup, true);
}
/** @brief Destroys the given task.
)
set(MSG_SRC
- src/msg/instr_msg_task.cpp
src/msg/msg_global.cpp
src/msg/msg_gos.cpp
src/msg/msg_legacy.cpp