Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
All of the examples use now the StringHelp class to simplify the string manipulation.
[simgrid.git] / examples / cxx / ping_pong / Receiver.cxx
index fec2c36..41ad220 100644 (file)
@@ -4,8 +4,7 @@
 #include <HostNotFoundException.hpp>\r
 #include <Msg.hpp>\r
 \r
-#include <iostream>\r
-using namespace std;\r
+#include <Msg.hpp>\r
 \r
 MSG_IMPLEMENT_DYNAMIC(Receiver, Process);\r
 \r
@@ -14,11 +13,12 @@ const double commSizeBw = 100000000;
 \r
 int Receiver::main(int argc, char** argv)\r
 {\r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hello I'm " << getName() << " on " << getHost().getName() << "!" << endl;\r
+       info("Hello");\r
        double communicationTime=0;\r
        double time = getClock();\r
+       StringHelper bw;\r
        \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "try to get a task" << endl;\r
+       info("Try to get a task");\r
        \r
        PingPongTask* task = reinterpret_cast<PingPongTask*>(Task::get(0));\r
        \r
@@ -27,18 +27,18 @@ int Receiver::main(int argc, char** argv)
        \r
        delete task;\r
        \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Got at time " << timeGot << endl;\r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Was sent at time " << timeSent << endl;\r
+       info(TEXT_("Got at time ") + TEXT_(timeGot));\r
+       info(TEXT_("Was sent at time ") + TEXT_(timeSent));\r
        \r
        time = timeSent;\r
        \r
        communicationTime = timeGot - time;\r
        \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Communication time : " << communicationTime << endl;\r
+       info(TEXT_( "Communication time : ") + TEXT_(communicationTime));\r
        \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " << " --- bw " << commSizeBw/communicationTime << " ----" << endl;\r
+       info(TEXT_(" --- BW ") + bw.append(commSizeBw/communicationTime,"%07lf") + TEXT_(" ----"));\r
        \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " << "goodbye!" << endl;\r
+       info("Goodbye!");\r
        \r
        delete this;\r
 \r