From ba04268d684751319d8c3130dcebbf3105961db6 Mon Sep 17 00:00:00 2001 From: Samuel Lepetit Date: Fri, 18 May 2012 14:37:54 +0200 Subject: [PATCH 1/1] Bugfix in Comm (GC didn't like it.). Add "debug" logging --- org/simgrid/msg/Comm.java | 2 +- org/simgrid/msg/Msg.java | 6 +++++- src/jmsg.c | 8 +++++++- src/jmsg.h | 4 ++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/org/simgrid/msg/Comm.java b/org/simgrid/msg/Comm.java index 3ef08e34e7..d3d979964c 100644 --- a/org/simgrid/msg/Comm.java +++ b/org/simgrid/msg/Comm.java @@ -46,7 +46,7 @@ public class Comm { /** * Unbind the communication object */ - public native void destroy() throws NativeException; + protected native void destroy() throws NativeException; /** * Returns if the communication is finished or not. * If the communication has finished and there was an error, diff --git a/org/simgrid/msg/Msg.java b/org/simgrid/msg/Msg.java index c9dcc48cdf..a4db8becd3 100644 --- a/org/simgrid/msg/Msg.java +++ b/org/simgrid/msg/Msg.java @@ -50,7 +50,11 @@ public final class Msg { * @return */ public final static native double getClock(); - + /** + * Issue an "debug" logging message. + * @param s message to log. + */ + public final static native void debug(String s); /** Issue an information logging message * @param s */ diff --git a/src/jmsg.c b/src/jmsg.c index ee091f2e9e..7ace464cc2 100644 --- a/src/jmsg.c +++ b/src/jmsg.c @@ -167,7 +167,13 @@ Java_org_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls, (*env)->ReleaseStringUTFChars(env, jplatformFile, platformFile); } - +JNIEXPORT void JNICALL +Java_org_simgrid_msg_Msg_debug(JNIEnv * env, jclass cls, jstring js) +{ + const char *s = (*env)->GetStringUTFChars(env, js, 0); + XBT_DEBUG("%s", s); + (*env)->ReleaseStringUTFChars(env, js, s); +} JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_info(JNIEnv * env, jclass cls, jstring js) { diff --git a/src/jmsg.h b/src/jmsg.h index da58d25eaf..c8a3f15d2d 100644 --- a/src/jmsg.h +++ b/src/jmsg.h @@ -42,6 +42,10 @@ JNIEXPORT void JNICALL JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_init(JNIEnv * env, jclass cls, jobjectArray jargs); +JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_debug(JNIEnv *, jclass, + jstring); + + JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_info(JNIEnv *, jclass, jstring); -- 2.20.1