Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : new example for liveness properties
[simgrid.git] / examples / cxx / ping_pong / Sender.cxx
index d0518ba..e5d7968 100644 (file)
@@ -1,61 +1,63 @@
-#include "Sender.hpp"\r
-#include "PingPongTask.hpp"\r
-#include <Host.hpp>\r
-#include <HostNotFoundException.hpp>\r
-#include <Msg.hpp>\r
-\r
-#include <iostream>\r
-using namespace std;\r
-\r
-const double commSizeLat = 1;\r
-const double commSizeBw = 100000000;\r
-\r
-MSG_IMPLEMENT_DYNAMIC(Sender, Process);\r
-\r
-int Sender::main(int argc, char** argv)\r
-{\r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hello I'm " << getName() << " on " << getHost().getName() << "!" << endl;\r
-       \r
-       int hostCount = argc;\r
-       \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " <<  "host count : " << hostCount << endl;\r
-       \r
-       Host* hostTable = new Host[hostCount]; \r
-       double time;\r
-       double computeDuration = 0;\r
-       PingPongTask* task;\r
-       \r
-       for(int pos = 0; pos < argc ; pos++) \r
-       {\r
-               try \r
-               {\r
-                       hostTable[pos] = Host::getByName(argv[pos]);\r
-               } \r
-               catch(HostNotFoundException e) \r
-               {\r
-                       cerr << e.toString() <<". Stopping Now!" << endl;\r
-                       exit(1);\r
-               }\r
-       }\r
-       \r
-       for (int pos = 0; pos < hostCount; pos++) \r
-       { \r
-               time = getClock(); \r
-       \r
-               cout <<"[" << getName() << ":" << getHost().getName() << "] " <<  "sender time : " << time << endl;\r
-       \r
-               task = new PingPongTask("no name",computeDuration,commSizeLat);\r
-               task->setTime(time);\r
-       \r
-               hostTable[pos].put(0,task);\r
-       } \r
-       \r
-       cout <<"[" << getName() << ":" << getHost().getName() << "] " <<  "goodbye!" << endl;\r
-       \r
-       delete[] hostTable;\r
-\r
-       delete this;\r
-\r
-       return 0;\r
-    \r
-}
\ No newline at end of file
+#include "Sender.hpp"
+#include "PingPongTask.hpp"
+#include <MsgHost.hpp>
+#include <HostNotFoundException.hpp>
+#include <Msg.hpp>
+
+#include <Msg.hpp>
+using namespace std;
+
+const double commSizeLat = 1;
+const double commSizeBw = 100000000;
+
+MSG_IMPLEMENT_DYNAMIC(Sender, Process)
+
+int Sender::main(int argc, char** argv)
+{
+       info("Hello");
+       
+       int hostCount = argc;
+       
+       info(TEXT_("Host count : ") + TEXT_(hostCount));
+       
+       Host* hostTable = new Host[hostCount]; 
+       double time;
+       double computeDuration = 0;
+       PingPongTask* task;
+       
+       for(int pos = 0; pos < argc ; pos++) 
+       {
+               try 
+               {
+                       hostTable[pos] = Host::getByName(argv[pos]);
+               } 
+               catch(HostNotFoundException e) 
+               {
+                       error(TEXT_(e.toString()) + TEXT_(". Stopping Now!"));
+                       exit(1);
+               }
+       }
+       
+       for (int pos = 0; pos < hostCount; pos++) 
+       { 
+               time = getClock(); 
+               
+               info(TEXT_("Sender time : ") + TEXT_(time));
+       
+               task = new PingPongTask("no name",computeDuration,commSizeLat);
+               task->setTime(time);
+       
+               hostTable[pos].put(0,task);
+       } 
+       
+       info("Goodbye!");
+
+       
+       delete[] hostTable;
+
+       delete this;
+
+       return 0;
+    
+}
+