Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add TRACE_host_variable_set and TRACE_host_variable_declare to te binding
authorJonathan Rouzaud-Cornabas <jonathan.rouzaud-cornabas@ens-lyon.fr>
Mon, 30 Jul 2012 11:03:44 +0000 (13:03 +0200)
committerJonathan Rouzaud-Cornabas <jonathan.rouzaud-cornabas@ens-lyon.fr>
Mon, 30 Jul 2012 11:03:44 +0000 (13:03 +0200)
org/simgrid/trace/Trace.java
src/jtrace.c

index daeed7d..f43a9a2 100644 (file)
@@ -26,13 +26,7 @@ public final class Trace {
 
        // TODO complete the binding of the tracing API 
        
-       /**
-        * Declare a new user variable associated to hosts. 
-        * 
-        * @param variable
-        */
-       public final static native      void hostVariableDeclare (String variable);
+
        /**
         * Declare a new user variable associated to hosts with a color. 
         *  
@@ -41,15 +35,7 @@ public final class Trace {
         */
        public final static native      void hostVariableDeclareWithColor (String variable, String color);
        
-       /**
-        * Set the value of a variable of a host. 
-        * 
-        * @param host
-        * @param variable
-        * @param value
-        */
-       public final static native      void hostVariableSet (String host, String variable, double value);
+       
        /**
         *  Add a value to a variable of a host. 
         *  
@@ -296,5 +282,20 @@ public final class Trace {
         */
        public final static native void hostPopState (String host, String state);
 
-       
+       /**
+        * Declare a new user variable associated to hosts. 
+        * 
+        * @param variable
+        */
+       public final static native      void hostVariableDeclare (String variable);
+
+       /**
+        * Set the value of a variable of a host. 
+        * 
+        * @param host
+        * @param variable
+        * @param value
+        */
+       public final static native      void hostVariableSet (String host, String variable, double value);
 }
index c279a14..df2d878 100644 (file)
@@ -90,3 +90,25 @@ Java_org_simgrid_trace_Trace_hostPopState
   (*env)->ReleaseStringUTFChars(env, js_host, host);
   (*env)->ReleaseStringUTFChars(env, js_state, state);
 }
+
+JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableDeclare
+  (JNIEnv *env, jclass cls, jstring js_state)
+{
+  const char *state = (*env)->GetStringUTFChars(env, js_state, 0);
+
+  TRACE_host_variable_declare(state);
+
+  (*env)->ReleaseStringUTFChars(env, js_state, state);
+}
+
+JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostVariableSet
+  (JNIEnv *env, jclass cls, jstring js_host, jstring js_state, jdouble value)
+{
+  const char *host = (*env)->GetStringUTFChars(env, js_host, 0);
+  const char *state = (*env)->GetStringUTFChars(env, js_state, 0);
+
+  TRACE_host_variable_set(host, state, value);
+
+  (*env)->ReleaseStringUTFChars(env, js_host, host);
+  (*env)->ReleaseStringUTFChars(env, js_state, state);
+}