X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/45fc9b393d412fb043fadf8e660fa6a137125f45..04c44fbe77163cca75366d10e35ba400b804eaef:/examples/cxx/comm_time/Slave.cxx diff --git a/examples/cxx/comm_time/Slave.cxx b/examples/cxx/comm_time/Slave.cxx index 4a3a78bfe0..c604f41c96 100644 --- a/examples/cxx/comm_time/Slave.cxx +++ b/examples/cxx/comm_time/Slave.cxx @@ -1,46 +1,45 @@ -#include "Slave.hpp" -#include "FinalizeTask.hpp" -#include "CommTimeTask.hpp" -#include -#include -#include - -#include -using namespace std; - -MSG_IMPLEMENT_DYNAMIC(Slave, Process); - -int Slave::main(int argc, char** argv) -{ - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hello I'm " << getName() << " on " << getHost().getName() << "!" << endl; - - while(true) - { - double time1 = getClock(); - Task* t = Task::get(0); - double time2 = getClock(); - - if(t->isInstanceOf("FinalizeTask")) - { - delete t; - break; - } - - CommTimeTask* task = reinterpret_cast(t); - - if(time1 < task->getTime()) - time1 = task->getTime(); - - // cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Processing \"" << task->getName() << "\" " << getHost().getName() << " (Communication time : " << (time2 - time1) << ")" << endl; - - task->execute(); - - delete task; - } - - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Received Finalize. I'm done. See you!" << endl; - - delete this; - return 0; - -} \ No newline at end of file +#include "Slave.hpp" +#include "FinalizeTask.hpp" +#include "CommTimeTask.hpp" +#include +#include +#include + +#include + +MSG_IMPLEMENT_DYNAMIC(Slave, Process) + +int Slave::main(int argc, char** argv) +{ + info("Hello"); + + while(true) + { + double time1 = getClock(); + Task* t = Task::get(0); + double time2 = getClock(); + + if(t->isInstanceOf("FinalizeTask")) + { + delete t; + break; + } + + CommTimeTask* task = reinterpret_cast(t); + + if(time1 < task->getTime()) + time1 = task->getTime(); + + //info(TEXT_("Processing \"") + TEXT_(task->getName()) + TEXT_("\" ") + TEXT_(getHost().getName()) + TEXT_(" (Communication time : ") + TEXT_((time2 - time1)) + TEXT_(")")); + + task->execute(); + + delete task; + } + + info(TEXT_("Received Finalize. I'm done. See you!")); + + delete this; + return 0; + +}