Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cb7878be19443a6cb0723289536ed74a34eb648b
[simgrid.git] / examples / java / comm_time / Slave.java
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier         
5  * All rights reserved. 
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. 
9  */
10
11 import simgrid.msg.*;
12
13 public class Slave extends simgrid.msg.Process {
14    
15    public void main(String[] args) throws JniException, NativeException {
16       
17       Msg.info("Hello i'm a slave");
18       
19       while(true) {
20          double time1 = Msg.getClock();       
21          Task t = Task.get(0);  
22          double time2 = Msg.getClock();
23  
24          if (t instanceof FinalizeTask) {
25             break;
26          }
27          CommTimeTask task = (CommTimeTask)t;
28              
29          if(time1 < task.getTime())
30            time1 = task.getTime();
31          
32 /*       Msg.info("Processing \"" + task.getName() + "\" " + getHost().getName() + 
33                   " (Communication time : " +  (time2 - time1) + ")");
34 */           
35          task.execute();
36       }
37        
38       Msg.info("Received Finalize. I'm done. See you!");
39    }
40 }