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.Host;
9 import org.simgrid.msg.Msg;
10 import org.simgrid.msg.MsgException;
11 import org.simgrid.msg.Task;
12 import org.simgrid.msg.Process;
14 public class Receiver extends Process {
15 public Receiver(Host host, String name, String[]args) {
16 super(host,name,args);
18 final double commSizeLat = 1;
19 final double commSizeBw = 100000000;
21 public void main(String[] args) throws MsgException {
24 double communicationTime=0;
26 double time = Msg.getClock();
28 Msg.info("try to get a task");
30 PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
31 double timeGot = Msg.getClock();
32 double timeSent = task.getTime();
34 Msg.info("Got at time "+ timeGot);
35 Msg.info("Was sent at time "+timeSent);
38 communicationTime=timeGot - time;
39 Msg.info("Communication time : " + communicationTime);
41 Msg.info(" --- bw "+ commSizeBw/communicationTime + " ----");