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
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
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)
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})
${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})
/* 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();
}
}
/* 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;
/* 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 {
/* 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 {
--- /dev/null
+#! 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!
+++ /dev/null
-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)
+++ /dev/null
-<?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>
+++ /dev/null
-#! 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!
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