Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
pingPong -> app/pingpong
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 1 Apr 2016 07:55:01 +0000 (09:55 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 1 Apr 2016 07:55:01 +0000 (09:55 +0200)
.gitignore
examples/java/CMakeLists.txt
examples/java/app/pingpong/Main.java [moved from examples/java/pingPong/PingPongTest.java with 51% similarity]
examples/java/app/pingpong/PingPongTask.java [moved from examples/java/pingPong/PingPongTask.java with 97% similarity]
examples/java/app/pingpong/Receiver.java [moved from examples/java/pingPong/Receiver.java with 82% similarity]
examples/java/app/pingpong/Sender.java [moved from examples/java/pingPong/Sender.java with 87% similarity]
examples/java/app/pingpong/app_pingpong.tesh [new file with mode: 0644]
examples/java/pingPong/CMakeLists.txt [deleted file]
examples/java/pingPong/pingPongDeployment.xml [deleted file]
examples/java/pingPong/pingpong.tesh [deleted file]
tools/cmake/DefinePackages.cmake

index a578a27..b1d21db 100644 (file)
@@ -973,6 +973,7 @@ tools/tesh/tesh
 examples/java/app/bittorrent/java_app_bittorrent_compiled
 examples/java/app/centralizedmutex/java_app_centralizedmutex_compiled
 examples/java/app/masterworker/java_app_masterworker_compiled
+examples/java/app/pingpong/java_app_pingpong_compiled
 examples/java/async/java_async_compiled
 examples/java/dht/chord/java_dht_chord_compiled
 examples/java/dht/kademlia/java_dht_kademlia_compiled
@@ -985,7 +986,6 @@ examples/java/io/storage/java_io_storage_compiled
 examples/java/process/kill/java_process_kill_compiled
 examples/java/process/migration/java_process_migration_compiled
 examples/java/process/suspend/java_process_suspend_compiled
-examples/java/pingPong/java_pingPong_compiled
 examples/java/process/startkilltime/java_process_startkilltime_compiled
 examples/java/task/priority/java_task_priority_compiled
 examples/java/tracing/java_tracing_compiled
index a362d86..3e96ee8 100644 (file)
@@ -10,6 +10,10 @@ set(app_centralizedmutex_sources  ${srcdir}/Main.java  ${srcdir}/Coordinator.jav
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker)
 set(app_masterworker_sources   ${srcdir}/Main.java  ${srcdir}/Master.java ${srcdir}/Worker.java) 
 
+set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/app/pingpong)
+set(app_pingpong_sources       ${srcdir}/Main.java  ${srcdir}/PingPongTask.java ${srcdir}/Receiver.java 
+                               ${srcdir}/Sender.java) 
+
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/cloud/masterworker)
 set(cloud_masterworker_sources ${srcdir}/Main.java  ${srcdir}/Master.java ${srcdir}/Worker.java)
 
@@ -56,7 +60,7 @@ set(process_suspend_sources    ${srcdir}/Main.java  ${srcdir}/DreamMaster.java
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/task/priority)
 set(task_priority_sources      ${srcdir}/Main.java  ${srcdir}/Test.java)
 
-foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker 
+foreach (example app_bittorrent app_centralizedmutex app_masterworker app_pingpong cloud_migration cloud_masterworker 
          dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
          process_startkilltime process_suspend task_priority)
   string (REPLACE "_" "/" example_dir ${example})
@@ -90,7 +94,7 @@ set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bi
                                    ${CMAKE_CURRENT_SOURCE_DIR}/task/priority/priority.xml                  PARENT_SCOPE)
 
 if(enable_java)
-  foreach (example app_bittorrent app_centralizedmutex app_masterworker cloud_migration cloud_masterworker 
+  foreach (example app_bittorrent app_centralizedmutex app_masterworker app_pingpong cloud_migration cloud_masterworker 
            dht_chord dht_kademlia energy_consumption energy_vm io_file io_storage process_kill process_migration
            process_startkilltime process_suspend task_priority)
     string (REPLACE "_" "/" example_dir ${example})
similarity index 51%
rename from examples/java/pingPong/PingPongTest.java
rename to examples/java/app/pingpong/Main.java
index cb7ef02..cce0555 100644 (file)
@@ -4,24 +4,24 @@
 /* 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. */
 
-package pingPong;
+package app.pingpong;
 import org.simgrid.msg.Msg;
+import org.simgrid.msg.MsgException;
 import org.simgrid.msg.NativeException;
  
-public class PingPongTest {
-  public static void main(String[] args) throws NativeException {
+public class Main {
+  public static void main(String[] args) throws MsgException, NativeException{
     Msg.init(args);
-    if(args.length < 2) {
-      Msg.info("Usage   : PingPongTest platform_file deployment_file");
-      Msg.info("example : PingPongTest ../platforms/platform.xml pingPongDeployment.xml");
+    if(args.length < 1) {
+      Msg.info("Usage   : Main platform_file");
+      Msg.info("example : Main ../platforms/platform.xml");
       System.exit(1);
     }
 
-    /* construct the platform and deploy the application */
     Msg.createEnvironment(args[0]);
-    Msg.deployApplication(args[1]);
-    
-    /*  execute the simulation. */
+    new Sender("Jacquelin", "Sender", new String[] {"Boivin"}).start();
+    new Receiver ("Boivin", "Receiver", null).start();
+
     Msg.run();
   }
 }
similarity index 97%
rename from examples/java/pingPong/PingPongTask.java
rename to examples/java/app/pingpong/PingPongTask.java
index 17f2bed..f4a556f 100644 (file)
@@ -4,7 +4,7 @@
 /* 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. */
 
-package pingPong;
+package app.pingpong;
 import org.simgrid.msg.Task;
 import org.simgrid.msg.NativeException;
 
similarity index 82%
rename from examples/java/pingPong/Receiver.java
rename to examples/java/app/pingpong/Receiver.java
index 0d6f1ce..7bb0d29 100644 (file)
@@ -4,18 +4,20 @@
 /* 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. */
 
-package pingPong;
+package app.pingpong;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.Task;
 import org.simgrid.msg.Process;
 import org.simgrid.msg.MsgException;
+import org.simgrid.msg.NativeException;
+import org.simgrid.msg.HostNotFoundException;
 
 public class Receiver extends Process {
   final double commSizeLat = 1;
   final double commSizeBw = 100000000;
-  public Receiver(Host host, String name, String[]args) {
-    super(host,name,args);
+  public Receiver(String hostname, String name, String[]args) throws HostNotFoundException, NativeException{
+    super(hostname,name,args);
   }
 
   public void main(String[] args) throws MsgException {
similarity index 87%
rename from examples/java/pingPong/Sender.java
rename to examples/java/app/pingpong/Sender.java
index 530b67a..9644b4d 100644 (file)
@@ -4,19 +4,20 @@
 /* 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. */
 
-package pingPong;
+package app.pingpong;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.Process;
 import org.simgrid.msg.MsgException;
+import org.simgrid.msg.NativeException;
 import org.simgrid.msg.HostNotFoundException;
 
 public class Sender extends Process {
   private final double commSizeLat = 1;
   final double commSizeBw = 100000000;
 
-  public Sender(Host host, String name, String[] args) {
-    super(host,name,args);
+  public Sender(String hostname, String name, String[] args) throws HostNotFoundException, NativeException {
+    super(hostname,name,args);
   }
 
   public void main(String[] args) throws MsgException {
diff --git a/examples/java/app/pingpong/app_pingpong.tesh b/examples/java/app/pingpong/app_pingpong.tesh
new file mode 100644 (file)
index 0000000..0c704bf
--- /dev/null
@@ -0,0 +1,18 @@
+#! tesh
+
+! output sort 19
+
+$ java -classpath ${classpath:=.} app/pingpong/Main ${srcdir:=.}/../platforms/platform.xml
+> [0.000000] [jmsg/INFO] Using regular java threads.
+> [1.048882] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
+> [Boivin:Receiver:(2) 0.000000] [jmsg/INFO] hello!
+> [Boivin:Receiver:(2) 0.000000] [jmsg/INFO] try to get a task
+> [Boivin:Receiver:(2) 1.048882] [jmsg/INFO] Got at time 1.0488818628325232
+> [Boivin:Receiver:(2) 1.048882] [jmsg/INFO] Was sent at time 0.0
+> [Boivin:Receiver:(2) 1.048882] [jmsg/INFO] Communication time : 1.0488818628325232
+> [Boivin:Receiver:(2) 1.048882] [jmsg/INFO]  --- bw 9.533962169004269E7 ----
+> [Boivin:Receiver:(2) 1.048882] [jmsg/INFO] goodbye!
+> [Jacquelin:Sender:(1) 0.000000] [jmsg/INFO] hello!
+> [Jacquelin:Sender:(1) 0.000000] [jmsg/INFO] host count: 1
+> [Jacquelin:Sender:(1) 0.000000] [jmsg/INFO] sender time: 0.0
+> [Jacquelin:Sender:(1) 1.048882] [jmsg/INFO] goodbye!
diff --git a/examples/java/pingPong/CMakeLists.txt b/examples/java/pingPong/CMakeLists.txt
deleted file mode 100644 (file)
index 910bedb..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-set(example java_pingPong)
-set(sources ${CMAKE_CURRENT_SOURCE_DIR}/PingPongTest.java ${CMAKE_CURRENT_SOURCE_DIR}/PingPongTask.java
-            ${CMAKE_CURRENT_SOURCE_DIR}/Receiver.java     ${CMAKE_CURRENT_SOURCE_DIR}/Sender.java)
-
-if(enable_java)
-  add_custom_command(
-    COMMENT "Building ${example}..."
-    OUTPUT ${example}_compiled
-    DEPENDS ${sources} simgrid-java_jar ${SIMGRID_JAR}
-    COMMAND ${JAVA_COMPILE} -classpath ${SIMGRID_JAR} -d ${CMAKE_CURRENT_BINARY_DIR}/.. ${sources}
-    COMMAND ${CMAKE_COMMAND} -E remove ${example}_compiled
-    COMMAND ${CMAKE_COMMAND} -E touch ${example}_compiled
-  )
-  add_custom_target(${example} ALL DEPENDS ${example}_compiled)
-  ADD_TESH(java-pingPong --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/pingPong/pingpong.tesh)
-endif()
-
-set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/pingpong.tesh           PARENT_SCOPE)
-set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/pingPongDeployment.xml  PARENT_SCOPE)
-set(examples_src  ${examples_src}  ${sources}                                          PARENT_SCOPE)
diff --git a/examples/java/pingPong/pingPongDeployment.xml b/examples/java/pingPong/pingPongDeployment.xml
deleted file mode 100644 (file)
index c7eec34..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4">
-  <process host="Jacquelin" function="pingPong.Sender">
-    <argument value="Boivin"/>
-  </process>
-  <process host="Boivin" function="pingPong.Receiver"/>
-</platform>
diff --git a/examples/java/pingPong/pingpong.tesh b/examples/java/pingPong/pingpong.tesh
deleted file mode 100644 (file)
index 93643a7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#! tesh
-
-! output sort 19
-
-$ java -classpath ${classpath:=.} pingPong/PingPongTest ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/pingPong/pingPongDeployment.xml
-> [0.000000] [jmsg/INFO] Using regular java threads.
-> [1.048882] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
-> [Boivin:pingPong.Receiver:(2) 0.000000] [jmsg/INFO] hello!
-> [Boivin:pingPong.Receiver:(2) 0.000000] [jmsg/INFO] try to get a task
-> [Boivin:pingPong.Receiver:(2) 1.048882] [jmsg/INFO] Got at time 1.0488818628325232
-> [Boivin:pingPong.Receiver:(2) 1.048882] [jmsg/INFO] Was sent at time 0.0
-> [Boivin:pingPong.Receiver:(2) 1.048882] [jmsg/INFO] Communication time : 1.0488818628325232
-> [Boivin:pingPong.Receiver:(2) 1.048882] [jmsg/INFO]  --- bw 9.533962169004269E7 ----
-> [Boivin:pingPong.Receiver:(2) 1.048882] [jmsg/INFO] goodbye!
-> [Jacquelin:pingPong.Sender:(1) 0.000000] [jmsg/INFO] hello!
-> [Jacquelin:pingPong.Sender:(1) 0.000000] [jmsg/INFO] host count: 1
-> [Jacquelin:pingPong.Sender:(1) 0.000000] [jmsg/INFO] sender time: 0.0
-> [Jacquelin:pingPong.Sender:(1) 1.048882] [jmsg/INFO] goodbye!
index d6ec1ed..33debbe 100644 (file)
@@ -925,7 +925,6 @@ set(txt_files
 set(CMAKEFILES_TXT
   examples/java/CMakeLists.txt
     examples/java/async/CMakeLists.txt
-    examples/java/pingPong/CMakeLists.txt
     examples/java/tracing/CMakeLists.txt
   examples/msg/CMakeLists.txt
     examples/msg/cloud/CMakeLists.txt