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.Task;
10 import org.simgrid.msg.Process;
11 import org.simgrid.msg.MsgException;
12 import org.simgrid.msg.NativeException;
13 import org.simgrid.msg.HostNotFoundException;
15 public class Receiver extends Process {
16 static final double commSizeLat = 1;
17 static final double commSizeBw = 100000000;
18 public Receiver(String hostname, String name, String[]args) throws HostNotFoundException, NativeException{
19 super(hostname,name,args);
22 public void main(String[] args) throws MsgException {
25 double time = Msg.getClock();
27 Msg.info("try to get a task");
29 PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
30 double timeGot = Msg.getClock();
31 double timeSent = task.getTime();
33 Msg.info("Got at time "+ timeGot);
34 Msg.info("Was sent at time "+timeSent);
37 double communicationTime = timeGot - time;
38 Msg.info("Communication time : " + communicationTime);
39 Msg.info(" --- bw "+ commSizeBw/communicationTime + " ----");