1 /* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
7 import org.simgrid.msg.HostNotFoundException;
8 import org.simgrid.msg.Msg;
9 import org.simgrid.msg.MsgException;
10 import org.simgrid.msg.Process;
11 import org.simgrid.msg.Task;
13 public class Receiver extends Process {
14 private static final double COMM_SIZE_BW = 100000000;
15 public Receiver(String hostname, String name, String[]args) throws HostNotFoundException {
16 super(hostname, name, args);
19 public void main(String[] args) throws MsgException {
20 for (int i = 0 ; i < Main.TASK_COUNT; i++) {
21 Msg.info("Wait for a task");
23 PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
24 double timeGot = Msg.getClock();
25 double timeSent = task.getTime();
27 Msg.info("Got one that was sent at time "+ timeSent);
29 double communicationTime = timeGot - timeSent;
30 Msg.info("Communication time : " + communicationTime);
31 Msg.info(" --- bw "+ COMM_SIZE_BW/communicationTime + " ----");