1 #include "Receiver.hpp"
\r
2 #include "PingPongTask.hpp"
\r
4 #include <HostNotFoundException.hpp>
\r
10 MSG_IMPLEMENT_DYNAMIC(Receiver, Process);
\r
12 const double commSizeLat = 1;
\r
13 const double commSizeBw = 100000000;
\r
15 int Receiver::main(int argc, char** argv)
\r
17 cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hello I'm " << getName() << " on " << getHost().getName() << "!" << endl;
\r
18 double communicationTime=0;
\r
19 double time = getClock();
\r
21 cout <<"[" << getName() << ":" << getHost().getName() << "try to get a task" << endl;
\r
23 PingPongTask* task = reinterpret_cast<PingPongTask*>(Task::get(0));
\r
25 double timeGot = getClock();
\r
26 double timeSent = task->getTime();
\r
30 cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Got at time " << timeGot << endl;
\r
31 cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Was sent at time " << timeSent << endl;
\r
35 communicationTime = timeGot - time;
\r
37 cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Communication time : " << communicationTime << endl;
\r
39 cout <<"[" << getName() << ":" << getHost().getName() << "] " << " --- bw " << commSizeBw/communicationTime << " ----" << endl;
\r
41 cout <<"[" << getName() << ":" << getHost().getName() << "] " << "goodbye!" << endl;
\r