X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/325b135f0ee33c6c0242a14e2f58a54fb571b032..ef1ef576d25c492dc585240b8a4b36954fc00140:/communicator.cpp?ds=inline diff --git a/communicator.cpp b/communicator.cpp index f3de918..f3e6bf9 100644 --- a/communicator.cpp +++ b/communicator.cpp @@ -1,26 +1,26 @@ -#include "communicator.h" - #include #include #include #include #include -#include "simgrid_features.h" + +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(comm); + #include "misc.h" #include "options.h" -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(comm); +#include "communicator.h" std::string message::to_string() { static const char* str[] = { "INFO", "CREDIT", "LOAD", "CTRL_CLOSE", "DATA_CLOSE" }; std::ostringstream oss; - oss << str[type] << " (" << amount << ")"; + oss << str[type] << ": " << amount; return oss.str(); } -const int communicator::send_count_before_flush = 128; +const int communicator::send_count_before_flush = 4; communicator::communicator() : host((hostdata* )MSG_host_get_data(MSG_host_self())) @@ -53,6 +53,7 @@ void communicator::listen() void communicator::send(const char* dest, message* msg) { + DEBUG2("send %s to %s", msg->to_string().c_str(), dest); double msg_size = sizeof *msg; if (msg->get_type() == message::LOAD) msg_size += opt::comm_cost(msg->get_amount()); @@ -105,13 +106,17 @@ bool communicator::recv(message*& msg, m_host_t& from, bool wait) } } while (restart); + if (msg) + DEBUG2("received %s from %s", + msg->to_string().c_str(), MSG_host_get_name(from)); + return msg != NULL; } void communicator::flush(bool wait) { - using namespace std::tr1; - using namespace std::tr1::placeholders; + using std::tr1::bind; + using std::tr1::placeholders::_1; sent_comm.remove_if(comm_test_n_destroy); if (wait && !sent_comm.empty()) {