X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2abf25f94d9a3fd19a5d85637d6758932be8b047..f7662638bcbfbf4922d5887273eb6645b1091479:/examples/cxx/ping_pong/Sender.cxx diff --git a/examples/cxx/ping_pong/Sender.cxx b/examples/cxx/ping_pong/Sender.cxx index 417bf73c88..e5d79686ad 100644 --- a/examples/cxx/ping_pong/Sender.cxx +++ b/examples/cxx/ping_pong/Sender.cxx @@ -1,59 +1,63 @@ -#include "Sender.hpp" -#include "PingPongTask.hpp" -#include -#include -#include - -#include -using namespace std; - -const double commSizeLat = 1; -const double commSizeBw = 100000000; - -MSG_IMPLEMENT_DYNAMIC(Sender, Process); - -int Sender::main(int argc, char** argv) -{ - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "Hello I'm " << getName() << " on " << getHost().getName() << "!" << endl; - - int hostCount = argc; - - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "host count : " << hostCount << endl; - - 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) - { - cerr << e.toString() <<". Stopping Now!" << endl; - exit(1); - } - } - - for (int pos = 0; pos < hostCount; pos++) - { - time = getClock(); - - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "sender time : " << time << endl; - - task = new PingPongTask("no name",computeDuration,commSizeLat); - task->setTime(time); - - hostTable[pos].put(0,task); - } - - cout <<"[" << getName() << ":" << getHost().getName() << "] " << "goodbye!" << endl; - - delete[] hostTable; - - return 0; - -} \ No newline at end of file +#include "Sender.hpp" +#include "PingPongTask.hpp" +#include +#include +#include + +#include +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; + +} +