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