~ubuntu-branches/ubuntu/quantal/simgrid/quantal

« back to all changes in this revision

Viewing changes to examples/cxx/comm_time/Slave.cxx

  • Committer: Package Import Robot
  • Author(s): Lucas Nussbaum, Martin Quinson, Lucas Nussbaum
  • Date: 2012-06-09 16:24:44 UTC
  • mfrom: (10.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20120609162444-xook34f3d6qy5ixj
Tags: 3.7.1-1
[ Martin Quinson ]
* debian/copyright: update FSF address (thanks lintian for noticing)

[ Lucas Nussbaum ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "Slave.hpp"
2
 
#include "FinalizeTask.hpp"
3
 
#include "CommTimeTask.hpp"
4
 
#include <MsgHost.hpp>
5
 
#include <HostNotFoundException.hpp>
6
 
#include <Msg.hpp>
7
 
 
8
 
#include <Msg.hpp>
9
 
 
10
 
MSG_IMPLEMENT_DYNAMIC(Slave, Process)
11
 
 
12
 
int Slave::main(int argc, char** argv)
13
 
{
14
 
        info("Hello");
15
 
        
16
 
        while(true) 
17
 
        {
18
 
                double time1 = getClock();       
19
 
                Task* t = Task::get(0); 
20
 
                double time2 = getClock();
21
 
        
22
 
                if(t->isInstanceOf("FinalizeTask")) 
23
 
                {
24
 
                        delete t;
25
 
                        break;
26
 
                }
27
 
                
28
 
                CommTimeTask* task = reinterpret_cast<CommTimeTask*>(t);
29
 
        
30
 
                if(time1 < task->getTime())
31
 
                        time1 = task->getTime();
32
 
                        
33
 
                //info(TEXT_("Processing \"") + TEXT_(task->getName()) + TEXT_("\" ") + TEXT_(getHost().getName()) + TEXT_(" (Communication time : ") + TEXT_((time2 - time1)) + TEXT_(")"));
34
 
         
35
 
                task->execute();
36
 
                
37
 
                delete task;
38
 
        }
39
 
        
40
 
        info(TEXT_("Received Finalize. I'm done. See you!"));
41
 
        
42
 
        delete this;
43
 
        return 0;
44
 
        
45
 
}