Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Further cleanups of the Java bindings:
[simgrid.git] / examples / java / ping_pong / Receiver.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 Receiver extends simgrid.msg.Process {
14         
15    final double commSizeLat = 1;
16    final double commSizeBw = 100000000;
17     
18    public void main(String[] args) throws JniException, NativeException {
19         
20       Msg.info("hello!");
21       double communicationTime=0;
22
23       double time = Msg.getClock();
24     
25       Msg.info("try to get a task");
26         
27       PingPongTask task = (PingPongTask)Task.get(0);
28       double timeGot = Msg.getClock();
29       double timeSent = task.getTime();
30             
31       Msg.info("Got at time "+ timeGot);
32       Msg.info("Was sent at time "+timeSent);
33       time=timeSent;
34             
35       communicationTime=timeGot - time;
36       Msg.info("Communication time : " + communicationTime);
37             
38       Msg.info(" --- bw "+ commSizeBw/communicationTime + " ----");
39             
40       Msg.info("goodbye!");
41     }
42 }