private Main() {
throw new IllegalAccessError("Utility class");
}
+ protected static final int TASK_COUNT = 3;
public static void main(String[] args) throws HostNotFoundException {
Msg.init(args);
-/* Copyright (c) 2006-2014. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
import org.simgrid.msg.Task;
public class Receiver extends Process {
- private static final double COMM_SIZE_BW = 100000000;
- public Receiver(String hostname, String name, String[]args) throws HostNotFoundException {
- super(hostname, name, args);
- }
+ private static final double COMM_SIZE_BW = 100000000;
+ public Receiver(String hostname, String name, String[]args) throws HostNotFoundException {
+ super(hostname, name, args);
+ }
- public void main(String[] args) throws MsgException {
- Msg.info("Wait for a task");
+ public void main(String[] args) throws MsgException {
+ for (int i = 0 ; i<Main.TASK_COUNT; i++) {
+ Msg.info("Wait for a task");
- PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
- double timeGot = Msg.getClock();
- double timeSent = task.getTime();
+ PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
+ double timeGot = Msg.getClock();
+ double timeSent = task.getTime();
- Msg.info("Got one that was sent at time "+ timeSent);
+ Msg.info("Got one that was sent at time "+ timeSent);
- double communicationTime = timeGot - timeSent;
- Msg.info("Communication time : " + communicationTime);
- Msg.info(" --- bw "+ COMM_SIZE_BW/communicationTime + " ----");
- Msg.info("Done.");
- }
+ double communicationTime = timeGot - timeSent;
+ Msg.info("Communication time : " + communicationTime);
+ Msg.info(" --- bw "+ COMM_SIZE_BW/communicationTime + " ----");
+ }
+ Msg.info("Done.");
+ }
}
\ No newline at end of file
public void main(String[] args) throws MsgException {
Msg.info("Host count: " + args.length);
- for(int pos = 0; pos < args.length ; pos++) {
- String hostname = Host.getByName(args[pos]).getName(); // Make sure that this host exists
-
- double time = Msg.getClock();
- Msg.info("sender time: " + time);
-
- PingPongTask task = new PingPongTask("no name", /* Duration: 0 flops */ 0, COMM_SIZE_LAT, time);
- task.send(hostname);
- }
+ for (int i = 0 ; i<Main.TASK_COUNT; i++) {
+
+ for(int pos = 0; pos < args.length ; pos++) {
+ String hostname = Host.getByName(args[pos]).getName(); // Make sure that this host exists
+ double time = Msg.getClock();
+ Msg.info("sender time: " + time);
+
+ PingPongTask task = new PingPongTask("no name", /* Duration: 0 flops */ 0, COMM_SIZE_LAT, time);
+ task.send(hostname);
+ }
+ }
Msg.info("Done.");
}
}
\ No newline at end of file
> [Boivin:Receiver:(2) 1.048882] [java/INFO] Got one that was sent at time 0.0
> [Boivin:Receiver:(2) 1.048882] [java/INFO] Communication time : 1.0488818628325232
> [Boivin:Receiver:(2) 1.048882] [java/INFO] --- bw 9.533962169004269E7 ----
-> [Boivin:Receiver:(2) 1.048882] [java/INFO] Done.
-> [Jacquelin:Sender:(1) 1.048882] [java/INFO] Done.
-> [1.048882] [java/INFO] MSG_main finished; Cleaning up the simulation...
+> [Boivin:Receiver:(2) 1.048882] [java/INFO] Wait for a task
+> [Jacquelin:Sender:(1) 1.048882] [java/INFO] sender time: 1.0488818628325232
+> [Boivin:Receiver:(2) 2.097764] [java/INFO] Got one that was sent at time 1.0488818628325232
+> [Boivin:Receiver:(2) 2.097764] [java/INFO] Communication time : 1.0488818628325232
+> [Boivin:Receiver:(2) 2.097764] [java/INFO] --- bw 9.533962169004269E7 ----
+> [Boivin:Receiver:(2) 2.097764] [java/INFO] Wait for a task
+> [Jacquelin:Sender:(1) 2.097764] [java/INFO] sender time: 2.0977637256650463
+> [Boivin:Receiver:(2) 3.146646] [java/INFO] Got one that was sent at time 2.0977637256650463
+> [Boivin:Receiver:(2) 3.146646] [java/INFO] Communication time : 1.0488818628325234
+> [Boivin:Receiver:(2) 3.146646] [java/INFO] --- bw 9.533962169004266E7 ----
+> [Boivin:Receiver:(2) 3.146646] [java/INFO] Done.
+> [Jacquelin:Sender:(1) 3.146646] [java/INFO] Done.
+> [3.146646] [java/INFO] MSG_main finished; Cleaning up the simulation...