]> AND Private Git Repository - loba.git/blobdiff - communicator.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Deadlock fix, and other changes.
[loba.git] / communicator.cpp
index f3de918962815d0c0822fc6aa9f42f7b1b767390..1570b10148a02dbb2fdfa7a78444d2cae1309b6a 100644 (file)
@@ -1,26 +1,26 @@
-#include "communicator.h"
-
 #include <algorithm>
 #include <tr1/functional>
 #include <sstream>
 #include <msg/msg.h>
 #include <xbt/log.h>
 #include <algorithm>
 #include <tr1/functional>
 #include <sstream>
 #include <msg/msg.h>
 #include <xbt/log.h>
-#include "simgrid_features.h"
+
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(comm);
+
 #include "misc.h"
 #include "options.h"
 
 #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;
 
 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();
 }
 
     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()))
 
 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)
 {
 
 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());
     double msg_size = sizeof *msg;
     if (msg->get_type() == message::LOAD)
         msg_size += opt::comm_cost(msg->get_amount());
@@ -105,6 +106,10 @@ bool communicator::recv(message*& msg, m_host_t& from, bool wait)
         }
     } while (restart);
 
         }
     } while (restart);
 
+    if (msg)
+        DEBUG2("received %s from %s",
+               msg->to_string().c_str(), MSG_host_get_name(from));
+
     return msg != NULL;
 }
 
     return msg != NULL;
 }