Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
redesign this test to match the C version
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 30 Mar 2016 10:20:00 +0000 (12:20 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 30 Mar 2016 10:20:59 +0000 (12:20 +0200)
move it into the process package

.gitignore
examples/java/CMakeLists.txt
examples/java/process/startkilltime/Main.java [moved from examples/java/startKillTime/StartKillTime.java with 94% similarity]
examples/java/process/startkilltime/Sleeper.java [moved from examples/java/startKillTime/Slave.java with 70% similarity]
examples/java/process/startkilltime/process_startkilltime.tesh [new file with mode: 0644]
examples/java/process/startkilltime/startkilltime.xml [new file with mode: 0644]
examples/java/startKillTime/CMakeLists.txt [deleted file]
examples/java/startKillTime/Master.java [deleted file]
examples/java/startKillTime/deployment_start_kill.xml [deleted file]
examples/java/startKillTime/startKillTime.tesh [deleted file]
tools/cmake/DefinePackages.cmake

index 5e095ed..e901bbe 100644 (file)
@@ -987,7 +987,7 @@ examples/java/process/suspend/java_process_suspend_compiled
 examples/java/mutualExclusion/java_mutualExclusion_compiled
 examples/java/pingPong/java_pingPong_compiled
 examples/java/priority/java_priority_compiled
 examples/java/mutualExclusion/java_mutualExclusion_compiled
 examples/java/pingPong/java_pingPong_compiled
 examples/java/priority/java_priority_compiled
-examples/java/startKillTime/java_startKillTime_compiled
+examples/java/process/startkilltime/java_process_startkilltime_compiled
 examples/java/tracing/java_tracing_compiled
 /CMakeCache.txt
 examples/smpi/mc/smpi_bugged1
 examples/java/tracing/java_tracing_compiled
 /CMakeCache.txt
 examples/smpi/mc/smpi_bugged1
index 6df55e9..31ebb6d 100644 (file)
@@ -33,11 +33,14 @@ set(process_kill_sources       ${srcdir}/Main.java  ${srcdir}/Killer.java  ${src
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/migration)
 set(process_migration_sources  ${srcdir}/Main.java  ${srcdir}/Emigrant.java  ${srcdir}/Policeman.java)
 
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/migration)
 set(process_migration_sources  ${srcdir}/Main.java  ${srcdir}/Emigrant.java  ${srcdir}/Policeman.java)
 
+set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime)
+set(process_startkilltime_sources ${srcdir}/Main.java ${srcdir}/Sleeper.java)
+
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend)
 set(process_suspend_sources    ${srcdir}/Main.java  ${srcdir}/DreamMaster.java  ${srcdir}/LazyGuy.java)
 
 foreach (example app_bittorrent app_masterworker dht_chord dht_kademlia energy_consumption io_file io_storage 
 set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/process/suspend)
 set(process_suspend_sources    ${srcdir}/Main.java  ${srcdir}/DreamMaster.java  ${srcdir}/LazyGuy.java)
 
 foreach (example app_bittorrent app_masterworker dht_chord dht_kademlia energy_consumption io_file io_storage 
-         process_kill process_migration process_suspend)
+         process_kill process_migration process_startkilltime process_suspend)
   string (REPLACE "_" "/" example_dir ${example})
   if(enable_java)
     add_custom_command(
   string (REPLACE "_" "/" example_dir ${example})
   if(enable_java)
     add_custom_command(
@@ -61,11 +64,12 @@ set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/
 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
 set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app/bittorrent/bittorrent.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/app/masterworker/masterworker.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/dht/chord/chord.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml   PARENT_SCOPE)
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht/kademlia/kademlia.xml
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/process/startkilltime/startkilltime.xml   PARENT_SCOPE)
 
 if(enable_java)
   foreach (example app_bittorrent app_masterworker dht_chord dht_kademlia energy_consumption io_file io_storage 
 
 if(enable_java)
   foreach (example app_bittorrent app_masterworker dht_chord dht_kademlia energy_consumption io_file io_storage 
-           process_kill process_migration process_suspend)
+           process_kill process_migration process_startkilltime process_suspend)
     string (REPLACE "_" "/" example_dir ${example})
     ADD_TESH(java-${example}  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh)
   endforeach()
     string (REPLACE "_" "/" example_dir ${example})
     ADD_TESH(java-${example}  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh)
   endforeach()
@@ -4,11 +4,11 @@
 /* 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. */
 
 /* 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 startKillTime;
+package process.startkilltime;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.NativeException;
 
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.NativeException;
 
-public class StartKillTime {
+public class Main {
   public static void main(String[] args) throws NativeException {
     Msg.init(args);
     if(args.length < 2) {
   public static void main(String[] args) throws NativeException {
     Msg.init(args);
     if(args.length < 2) {
similarity index 70%
rename from examples/java/startKillTime/Slave.java
rename to examples/java/process/startkilltime/Sleeper.java
index d8feef4..fe1310e 100644 (file)
@@ -4,23 +4,22 @@
 /* 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. */
 
 /* 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 startKillTime;
+package process.startkilltime;
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.Process;
 import org.simgrid.msg.MsgException;
 
 import org.simgrid.msg.Msg;
 import org.simgrid.msg.Host;
 import org.simgrid.msg.Process;
 import org.simgrid.msg.MsgException;
 
-/* Lazy Guy Slave, suspends itself ASAP */
-public class Slave extends Process {
-  public Slave(Host host, String name, String[]args) {
+public class Sleeper extends Process {
+  public Sleeper(Host host, String name, String[]args) {
     super(host,name,args);
   }
 
   public void main(String[] args) throws MsgException {
     super(host,name,args);
   }
 
   public void main(String[] args) throws MsgException {
-    Msg.info("Hello!");
+    Msg.info("Hello! I go to sleep.");
     try {
     try {
-      waitFor(10.0);
-      Msg.info("OK, goodbye now.");
+      waitFor(Integer.valueOf(args[0]).intValue());
+      Msg.info("Done sleeping");
     } catch (MsgException e) {
       Msg.debug("Wait cancelled.");
     }
     } catch (MsgException e) {
       Msg.debug("Wait cancelled.");
     }
diff --git a/examples/java/process/startkilltime/process_startkilltime.tesh b/examples/java/process/startkilltime/process_startkilltime.tesh
new file mode 100644 (file)
index 0000000..fd2c1d5
--- /dev/null
@@ -0,0 +1,12 @@
+#! tesh
+$ java -classpath ${classpath:=.} process/startkilltime/Main ${srcdir:=.}/../platforms/cluster.xml ${srcdir:=.}/process/startkilltime/startkilltime.xml
+> [0.000000] [jmsg/INFO] Using regular java threads.
+> [node-0.acme.org:process.startkilltime.Sleeper:(1) 0.000000] [jmsg/INFO] Hello! I go to sleep.
+> [node-1.acme.org:process.startkilltime.Sleeper:(2) 1.000000] [jmsg/INFO] Hello! I go to sleep.
+> [node-2.acme.org:process.startkilltime.Sleeper:(3) 2.000000] [jmsg/INFO] Hello! I go to sleep.
+> [node-3.acme.org:process.startkilltime.Sleeper:(4) 3.000000] [jmsg/INFO] Hello! I go to sleep.
+> [node-4.acme.org:process.startkilltime.Sleeper:(5) 4.000000] [jmsg/INFO] Hello! I go to sleep.
+> [node-5.acme.org:process.startkilltime.Sleeper:(6) 5.000000] [jmsg/INFO] Hello! I go to sleep.
+> [node-2.acme.org:process.startkilltime.Sleeper:(3) 6.000000] [jmsg/INFO] Done sleeping
+> [node-3.acme.org:process.startkilltime.Sleeper:(4) 7.000000] [jmsg/INFO] Done sleeping
+> [10.000000] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
diff --git a/examples/java/process/startkilltime/startkilltime.xml b/examples/java/process/startkilltime/startkilltime.xml
new file mode 100644 (file)
index 0000000..dd3e3c7
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+<platform version="4">
+    <process host="node-0.acme.org" function="process.startkilltime.Sleeper" start_time="0" kill_time="5">  <argument value="10"/></process>
+    <process host="node-1.acme.org" function="process.startkilltime.Sleeper" start_time="1" kill_time="6">  <argument value="10"/></process>
+    <process host="node-2.acme.org" function="process.startkilltime.Sleeper" start_time="2" kill_time="7">  <argument value="4" /></process>
+    <process host="node-3.acme.org" function="process.startkilltime.Sleeper" start_time="3" kill_time="8">  <argument value="4" /></process>
+    <process host="node-4.acme.org" function="process.startkilltime.Sleeper" start_time="4" kill_time="9">  <argument value="5" /></process>
+    <process host="node-5.acme.org" function="process.startkilltime.Sleeper" start_time="5" kill_time="10"> <argument value="5"/></process>
+</platform>
diff --git a/examples/java/startKillTime/CMakeLists.txt b/examples/java/startKillTime/CMakeLists.txt
deleted file mode 100644 (file)
index 1191d06..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-set(example java_startKillTime)
-set(sources ${CMAKE_CURRENT_SOURCE_DIR}/Master.java ${CMAKE_CURRENT_SOURCE_DIR}/Slave.java ${CMAKE_CURRENT_SOURCE_DIR}/StartKillTime.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-startKillTime --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/startKillTime/startKillTime.tesh)
-endif()
-
-set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/startKillTime.tesh         PARENT_SCOPE)
-set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/deployment_start_kill.xml  PARENT_SCOPE)
-set(examples_src  ${examples_src}  ${sources}                                             PARENT_SCOPE)
diff --git a/examples/java/startKillTime/Master.java b/examples/java/startKillTime/Master.java
deleted file mode 100644 (file)
index b162c5f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) 2006-2014, 2016. 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. */
-
-package startKillTime;
-import org.simgrid.msg.Host;
-import org.simgrid.msg.HostFailureException;
-import org.simgrid.msg.Msg;
-import org.simgrid.msg.Process;
-import org.simgrid.msg.TimeoutException;
-import org.simgrid.msg.TransferFailureException;
-
-public class Master extends Process {
-  public Master(Host host, String name, String[]args) {
-    super(host,name,args);
-  }
-
-  public void main(String[] args) throws TransferFailureException, HostFailureException, TimeoutException {
-    Msg.info("Hello!");
-    waitFor(10.0);
-    Msg.info("OK, goodbye now.");
-  }
-}
diff --git a/examples/java/startKillTime/deployment_start_kill.xml b/examples/java/startKillTime/deployment_start_kill.xml
deleted file mode 100644 (file)
index d449286..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4">
-  <process host="Jacquelin" function="startKillTime.Master"/>
-  <process host="Boivin" function="startKillTime.Slave" start_time="1" kill_time="5"/>
-  <process host="Jean_Yves" function="startKillTime.Slave" start_time="2" kill_time="6"/>
-  <process host="TeX" function="startKillTime.Slave" start_time="3" kill_time="7"/>
-  <process host="Geoff" function="startKillTime.Slave" start_time="4" kill_time="8"/>
-  <process host="Disney" function="startKillTime.Slave" start_time="5" kill_time="9"/>
-</platform>
diff --git a/examples/java/startKillTime/startKillTime.tesh b/examples/java/startKillTime/startKillTime.tesh
deleted file mode 100644 (file)
index eadb5f6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#! tesh
-$ java -classpath ${classpath:=.} startKillTime/StartKillTime ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/startKillTime/deployment_start_kill.xml
-> [0.000000] [jmsg/INFO] Using regular java threads.
-> [Jacquelin:startKillTime.Master:(1) 0.000000] [jmsg/INFO] Hello!
-> [Boivin:startKillTime.Slave:(2) 1.000000] [jmsg/INFO] Hello!
-> [Jean_Yves:startKillTime.Slave:(3) 2.000000] [jmsg/INFO] Hello!
-> [TeX:startKillTime.Slave:(4) 3.000000] [jmsg/INFO] Hello!
-> [Geoff:startKillTime.Slave:(5) 4.000000] [jmsg/INFO] Hello!
-> [Disney:startKillTime.Slave:(6) 5.000000] [jmsg/INFO] Hello!
-> [Jacquelin:startKillTime.Master:(1) 10.000000] [jmsg/INFO] OK, goodbye now.
-> [10.000000] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
index 904e0f8..b11a9df 100644 (file)
@@ -931,7 +931,6 @@ set(CMAKEFILES_TXT
     examples/java/mutualExclusion/CMakeLists.txt
     examples/java/pingPong/CMakeLists.txt
     examples/java/priority/CMakeLists.txt
     examples/java/mutualExclusion/CMakeLists.txt
     examples/java/pingPong/CMakeLists.txt
     examples/java/priority/CMakeLists.txt
-    examples/java/startKillTime/CMakeLists.txt
     examples/java/tracing/CMakeLists.txt
   examples/msg/CMakeLists.txt
     examples/msg/cloud/CMakeLists.txt
     examples/java/tracing/CMakeLists.txt
   examples/msg/CMakeLists.txt
     examples/msg/cloud/CMakeLists.txt