Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
java example simplification and cosmetics
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 21 Mar 2017 10:32:54 +0000 (11:32 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 21 Mar 2017 10:32:54 +0000 (11:32 +0100)
examples/java/app/pingpong/Receiver.java
examples/java/app/pingpong/Sender.java
examples/java/app/pingpong/app_pingpong.tesh

index 85c5acb..f9f8f9c 100644 (file)
@@ -18,21 +18,17 @@ public class Receiver extends Process {
   }
 
   public void main(String[] args) throws MsgException {
-    Msg.info("hello!");
-
-    Msg.info("try to get a task");
+    Msg.info("Wait for a task");
 
     PingPongTask task = (PingPongTask)Task.receive(getHost().getName());
     double timeGot = Msg.getClock();
     double timeSent = task.getTime();
 
-    Msg.info("Got at time "+ timeGot);
-    Msg.info("Was sent at time "+timeSent);
-    double time = timeSent;
+    Msg.info("Got one that was sent at time "+ timeSent);
 
-    double communicationTime = timeGot - time;
+    double communicationTime = timeGot - timeSent;
     Msg.info("Communication time : " + communicationTime);
     Msg.info(" --- bw "+ COMM_SIZE_BW/communicationTime + " ----");
-    Msg.info("goodbye!");
+    Msg.info("Done.");
   }
 }
\ No newline at end of file
index d6ec213..e207e25 100644 (file)
@@ -18,22 +18,18 @@ public class Sender extends Process {
        }
 
        public void main(String[] args) throws MsgException {
-               Msg.info("hello!");
-
-               Msg.info("host count: " + args.length);
+               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);
                }
 
-               Msg.info("goodbye!");
+               Msg.info("Done.");
        }
 }
\ No newline at end of file
index b7f02aa..08b1a15 100644 (file)
@@ -1,18 +1,13 @@
 #! tesh
 
-! output sort 19
-
 $ java -classpath ${classpath:=.} app/pingpong/Main ${srcdir:=.}/../platforms/small_platform.xml
 > [0.000000] [java/INFO] Using regular java threads.
-> [1.048882] [java/INFO] MSG_main finished; Cleaning up the simulation...
-> [Boivin:Receiver:(2) 0.000000] [java/INFO] hello!
-> [Boivin:Receiver:(2) 0.000000] [java/INFO] try to get a task
-> [Boivin:Receiver:(2) 1.048882] [java/INFO] Got at time 1.0488818628325232
-> [Boivin:Receiver:(2) 1.048882] [java/INFO] Was sent at time 0.0
+> [Jacquelin:Sender:(1) 0.000000] [java/INFO] Host count: 1
+> [Jacquelin:Sender:(1) 0.000000] [java/INFO] sender time: 0.0
+> [Boivin:Receiver:(2) 0.000000] [java/INFO] Wait for a task
+> [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] goodbye!
-> [Jacquelin:Sender:(1) 0.000000] [java/INFO] hello!
-> [Jacquelin:Sender:(1) 0.000000] [java/INFO] host count: 1
-> [Jacquelin:Sender:(1) 0.000000] [java/INFO] sender time: 0.0
-> [Jacquelin:Sender:(1) 1.048882] [java/INFO] goodbye!
+> [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...