1 /* Copyright (c) 2006-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 import org.simgrid.msg.Msg;
9 import org.simgrid.msg.Host;
10 import org.simgrid.msg.Task;
11 import org.simgrid.msg.Process;
12 import org.simgrid.msg.MsgException;
13 import org.simgrid.msg.NativeException;
14 import org.simgrid.msg.HostNotFoundException;
16 public class Receiver extends Process {
17 final double commSizeLat = 1;
18 final double commSizeBw = 100000000;
19 public Receiver(String hostname, String name, String[]args) throws HostNotFoundException, NativeException{
20 super(hostname,name,args);
23 public void main(String[] args) throws MsgException {
25 double communicationTime=0;
27 double time = Msg.getClock();
29 Msg.info("try to get a task");
31 PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
32 double timeGot = Msg.getClock();
33 double timeSent = task.getTime();
35 Msg.info("Got at time "+ timeGot);
36 Msg.info("Was sent at time "+timeSent);
39 communicationTime=timeGot - time;
40 Msg.info("Communication time : " + communicationTime);
41 Msg.info(" --- bw "+ commSizeBw/communicationTime + " ----");