COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/master_slave_kill/*.java
COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/mutualExclusion/centralized/*.java
COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/pingPong/*.java
+ COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/priority/*.java
COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/startKillTime/*.java
COMMAND ${JAVA_COMPILE} -d ${CMAKE_HOME_DIRECTORY}/examples -cp ${CMAKE_HOME_DIRECTORY}/simgrid.jar ${CMAKE_HOME_DIRECTORY}/examples/suspend/*.java
ADD_TEST(kill ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/master_slave_kill/kill.tesh)
ADD_TEST(mutualExclusion ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/mutualExclusion/mutualexclusion.tesh)
ADD_TEST(pingPong ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/pingPong/pingpong.tesh)
+ADD_TEST(priority ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/priority/priority.tesh)
ADD_TEST(startKillTime ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/startKillTime/startKillTime.tesh)
ADD_TEST(suspend ${TESH_BIN_PATH} ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/examples/suspend/suspend.tesh)
#Don't forget to put new test in this list!!!
-set(test_list async basic bittorrent bypass chord commTime kill mutualExclusion pingPong startKillTime)
+set(test_list async basic bittorrent bypass chord commTime kill mutualExclusion pingPong priority startKillTime)
##########################################
# Set the DYLD_LIBRARY_PATH for mac #
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright 2006,2007 Martin Quinson, Malek Cherier
+ * 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 priority;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.NativeException;
+/**
+ * Demonstrates the use of Task.setPriority to change
+ * the computation priority of a task
+ */
+public class Priority {
+
+ /* This only contains the launcher. If you do nothing more than than you can run
+ * java simgrid.msg.Msg
+ * which also contains such a launcher
+ */
+
+ public static void main(String[] args) throws NativeException {
+ /* initialize the MSG simulation. Must be done before anything else (even logging). */
+ Msg.init(args);
+ if(args.length < 2) {
+ Msg.info("Usage : Priority platform_file deployment_file");
+ Msg.info("example : Priority ping_pong_platform.xml ping_pong_deployment.xml");
+ System.exit(1);
+ }
+
+ /* construct the platform and deploy the application */
+ Msg.createEnvironment(args[0]);
+ Msg.deployApplication(args[1]);
+
+ /* execute the simulation. */
+ Msg.run();
+ }
+}
--- /dev/null
+/*
+ * 2012. 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 priority;
+import org.simgrid.msg.Host;
+import org.simgrid.msg.Msg;
+import org.simgrid.msg.MsgException;
+import org.simgrid.msg.Task;
+import org.simgrid.msg.Process;
+
+public class Test extends Process {
+ public Test(Host host, String name, String[]args) {
+ super(host,name,args);
+ }
+ public void main(String[] args) throws MsgException {
+ double computationAmount = 1.0;
+ double priority = 1.0;
+
+ computationAmount = Double.valueOf(args[0]);
+ priority = Double.valueOf(args[1]);
+
+ Msg.info("Hello! Running a task of size " + computationAmount + " with priority " + priority);
+
+ Task task = new Task("Task", computationAmount, 0);
+ task.setPriority(priority);
+
+ task.execute();
+
+ Msg.info("Goodbye now!");
+ }
+}
--- /dev/null
+#! ./tesh
+
+! output sort
+
+$ java -cp .:${srcdir:=.}/examples:${srcdir:=.}/simgrid.jar priority/Priority ${srcdir:=.}/examples/platform.xml ${srcdir:=.}/examples/priority/priorityDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (0:@) Ready to run MSG_MAIN
+> [ 0.000000] (1:priority.Test@Fafard) Hello! Running a task of size 7.6296E7 with priority 1.0
+> [ 0.000000] (2:priority.Test@Fafard) Hello! Running a task of size 7.6296E7 with priority 2.0
+> [ 0.833332] (2:priority.Test@Fafard) Goodbye now!
+> [ 1.111109] (0:@) Done running MSG_MAIN
+> [ 1.111109] (0:@) MSG_main finished
+> [ 1.111109] (0:@) Clean java world
+> [ 1.111109] (0:@) Clean native world
+> [ 1.111109] (1:priority.Test@Fafard) Goodbye now!
+
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+ <process host="Fafard" function="priority.Test">
+ <argument value="76296000"/>
+ <argument value="1.0"/>
+ </process>
+ <process host="Fafard" function="priority.Test">
+ <argument value="76296000"/>
+ <argument value="2.0"/>
+ </process>
+</platform>