From 1142f033583856ab639da863de9e4d0ac6db188b Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 12 Feb 2014 16:35:19 +0100 Subject: [PATCH] Use XBT_INFO only after MSG_init, so that log parameters given on the command line are taken into account. --- examples/java/async/async.tesh | 2 +- examples/java/masterslave/masterslave.tesh | 2 +- examples/java/migration/migration.tesh | 3 +-- examples/java/priority/priority.tesh | 2 +- examples/java/suspend/suspend.tesh | 3 +-- examples/scala/masterslave/masterslave.tesh | 2 +- src/bindings/java/jmsg.c | 19 +++++++++++-------- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/examples/java/async/async.tesh b/examples/java/async/async.tesh index 72c3ab7a84..1a1321d5fd 100644 --- a/examples/java/async/async.tesh +++ b/examples/java/async/async.tesh @@ -3,6 +3,7 @@ ! output sort ! timeout 30 $ java -classpath ${classpath:=.} async/AsyncTest ${srcdir:=.}/platform.xml ${srcdir:=.}/async/asyncDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:@) Using regular java threads. Coroutines could speed your simulation up. > [ 0.000000] (10:async.Slave@Robert) Receiving on 'slave_8' > [ 0.000000] (11:async.Slave@Sirois) Receiving on 'slave_9' > [ 0.000000] (12:async.Slave@Monique) Receiving on 'slave_10' @@ -53,4 +54,3 @@ $ java -classpath ${classpath:=.} async/AsyncTest ${srcdir:=.}/platform.xml ${sr > [ 25.851463] (2:async.Forwarder@Jackson) I'm done. See you! > [ 26.357007] (3:async.Forwarder@Casavant) I'm done. See you! > [ 29.000728] (0:@) MSG_main finished; Cleaning up the simulation... -> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up. diff --git a/examples/java/masterslave/masterslave.tesh b/examples/java/masterslave/masterslave.tesh index ee1d2074b8..81be5cfed6 100644 --- a/examples/java/masterslave/masterslave.tesh +++ b/examples/java/masterslave/masterslave.tesh @@ -3,6 +3,7 @@ ! output sort $ java -classpath ${classpath:=.} masterslave/Masterslave ${srcdir:=.}/platform.xml ${srcdir:=.}/masterslave/masterslaveDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:@) Using regular java threads. Coroutines could speed your simulation up. > [ 0.000000] (1:masterslave.Master@Jacquelin) Hello! Got 7 slaves and 5 tasks to process > [ 0.000000] (2:masterslave.Forwarder@Jackson) Receiving on 'slave_0' > [ 0.000000] (3:masterslave.Forwarder@Casavant) Receiving on 'slave_1' @@ -29,4 +30,3 @@ $ java -classpath ${classpath:=.} masterslave/Masterslave ${srcdir:=.}/platform. > [ 17.251680] (0:@) MSG_main finished; Cleaning up the simulation... > [ 17.251680] (1:masterslave.Master@Jacquelin) Goodbye now! > [ 17.251680] (8:masterslave.Slave@Browne) Received Finalize. I'm done. See you! -> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up. diff --git a/examples/java/migration/migration.tesh b/examples/java/migration/migration.tesh index 131e9a3493..a954e427a6 100644 --- a/examples/java/migration/migration.tesh +++ b/examples/java/migration/migration.tesh @@ -3,6 +3,7 @@ ! output sort $ java -classpath ${classpath:=.} migration/Migration ${srcdir:=.}/platform.xml ${srcdir:=.}/migration/migrationDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:@) Using regular java threads. Coroutines could speed your simulation up. > [ 0.000000] (1:migration.Emigrant@Jacquelin) I'll look for a new job on another machine where the grass is greener. > [ 0.000000] (1:migration.Emigrant@Boivin) Yeah, found something to do > [ 1.000000] (2:migration.Policeman@Boivin) Wait a bit before migrating the emigrant. @@ -11,5 +12,3 @@ $ java -classpath ${classpath:=.} migration/Migration ${srcdir:=.}/platform.xml > [ 7.000000] (1:migration.Emigrant@Jacquelin) I've been moved on this new host:Jacquelin > [ 7.000000] (1:migration.Emigrant@Jacquelin) Uh, nothing to do here. Stopping now > [ 7.000000] (2:migration.Policeman@Boivin) I moved the emigrant -> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up. - diff --git a/examples/java/priority/priority.tesh b/examples/java/priority/priority.tesh index 1a0b8adc45..35646abd95 100644 --- a/examples/java/priority/priority.tesh +++ b/examples/java/priority/priority.tesh @@ -3,9 +3,9 @@ ! output sort $ java -classpath ${classpath:=.} priority/Priority ${srcdir:=.}/platform.xml ${srcdir:=.}/priority/priorityDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:@) Using regular java threads. Coroutines could speed your simulation up. > [ 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:@) MSG_main finished; Cleaning up the simulation... > [ 1.111109] (1:priority.Test@Fafard) Goodbye now! -> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up. diff --git a/examples/java/suspend/suspend.tesh b/examples/java/suspend/suspend.tesh index 897db64832..8230392315 100644 --- a/examples/java/suspend/suspend.tesh +++ b/examples/java/suspend/suspend.tesh @@ -2,6 +2,7 @@ ! output sort $ java -classpath ${classpath:=.} suspend/Suspend ${srcdir:=.}/platform.xml ${srcdir:=.}/suspend/suspendDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:@) Using regular java threads. Coroutines could speed your simulation up. > [ 0.000000] (1:suspend.DreamMaster@Jacquelin) Let's create a lazy guy. > [ 0.000000] (1:suspend.DreamMaster@Jacquelin) Let's wait a little bit... > [ 0.000000] (2:Lazy@Jacquelin) Nobody's watching me ? Let's go to sleep. @@ -10,5 +11,3 @@ $ java -classpath ${classpath:=.} suspend/Suspend ${srcdir:=.}/platform.xml ${sr > [ 10.000000] (1:suspend.DreamMaster@Jacquelin) OK, goodbye now. > [ 10.000000] (2:Lazy@Jacquelin) Uuuh ? Did somebody call me ? > [ 10.000000] (2:Lazy@Jacquelin) Mmmh, goodbye now. -> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up. - diff --git a/examples/scala/masterslave/masterslave.tesh b/examples/scala/masterslave/masterslave.tesh index ee1d2074b8..81be5cfed6 100644 --- a/examples/scala/masterslave/masterslave.tesh +++ b/examples/scala/masterslave/masterslave.tesh @@ -3,6 +3,7 @@ ! output sort $ java -classpath ${classpath:=.} masterslave/Masterslave ${srcdir:=.}/platform.xml ${srcdir:=.}/masterslave/masterslaveDeployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:@) Using regular java threads. Coroutines could speed your simulation up. > [ 0.000000] (1:masterslave.Master@Jacquelin) Hello! Got 7 slaves and 5 tasks to process > [ 0.000000] (2:masterslave.Forwarder@Jackson) Receiving on 'slave_0' > [ 0.000000] (3:masterslave.Forwarder@Casavant) Receiving on 'slave_1' @@ -29,4 +30,3 @@ $ java -classpath ${classpath:=.} masterslave/Masterslave ${srcdir:=.}/platform. > [ 17.251680] (0:@) MSG_main finished; Cleaning up the simulation... > [ 17.251680] (1:masterslave.Master@Jacquelin) Goodbye now! > [ 17.251680] (8:masterslave.Slave@Browne) Received Finalize. I'm done. See you! -> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up. diff --git a/src/bindings/java/jmsg.c b/src/bindings/java/jmsg.c index 4f87f63c06..b3ec27cd41 100644 --- a/src/bindings/java/jmsg.c +++ b/src/bindings/java/jmsg.c @@ -95,14 +95,10 @@ Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs) (*env)->GetJavaVM(env, &__java_vm); - if ((*env)->FindClass(env, "java/dyn/Coroutine")) { - XBT_INFO("Using Coroutines. Your simulation is on steroid."); - smx_factory_initializer_to_use = SIMIX_ctx_cojava_factory_init; - } - else { - XBT_INFO("Using regular java threads. Coroutines could speed your simulation up."); - smx_factory_initializer_to_use = SIMIX_ctx_java_factory_init; - } + if ((*env)->FindClass(env, "java/dyn/Coroutine")) + smx_factory_initializer_to_use = SIMIX_ctx_cojava_factory_init; + else + smx_factory_initializer_to_use = SIMIX_ctx_java_factory_init; jthrowable exc = (*env)->ExceptionOccurred(env); if (exc) { (*env)->ExceptionClear(env); @@ -131,6 +127,13 @@ Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs) free(argv[index]); free(argv); + + if (smx_factory_initializer_to_use == SIMIX_ctx_cojava_factory_init) + XBT_INFO("Using Coroutines. Your simulation is on steroid."); + else if (smx_factory_initializer_to_use == SIMIX_ctx_java_factory_init) + XBT_INFO("Using regular java threads. Coroutines could speed your simulation up."); + else + xbt_die("Unknown context factory. Please report bug."); } JNIEXPORT void JNICALL -- 2.20.1