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 private static final double COMM_SIZE_BW = 100000000;
17 public Receiver(String hostname, String name, String[]args) throws HostNotFoundException, NativeException{
18 super(hostname,name,args);
21 public void main(String[] args) throws MsgException {
24 Msg.info("try to get a task");
26 PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
27 double timeGot = Msg.getClock();
28 double timeSent = task.getTime();
30 Msg.info("Got at time "+ timeGot);
31 Msg.info("Was sent at time "+timeSent);
32 double time = timeSent;
34 double communicationTime = timeGot - time;
35 Msg.info("Communication time : " + communicationTime);
36 Msg.info(" --- bw "+ COMM_SIZE_BW/communicationTime + " ----");