thread brand java
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 12 Jun 2006 16:40:30 +0000 (16:40 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 12 Jun 2006 16:40:30 +0000 (16:40 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1922 04897980-b3bd-0310-b5e0-8ef037075253

ltt-usertrace/java/Sample.java
ltt-usertrace/java/TestBrand.java [new file with mode: 0644]
ltt-usertrace/java/ThreadBrand.java [new file with mode: 0644]
ltt-usertrace/java/generate.sh
ltt-usertrace/java/ltt-java-thread_brand.c [new file with mode: 0644]

index 75f1c0c406cbad8a0e80b7ee06813659afd88492..27f38b10a701a9165ba1232bf8e38ddf9f813fa1 100644 (file)
@@ -1,4 +1,4 @@
-// The Sample-java.java file
+// The Sample.java file
 public class Sample
 {
   // Declaration of the Native (C) function
diff --git a/ltt-usertrace/java/TestBrand.java b/ltt-usertrace/java/TestBrand.java
new file mode 100644 (file)
index 0000000..b6cb7c9
--- /dev/null
@@ -0,0 +1,11 @@
+
+import ThreadBrand;
+
+// The Sample.java file
+public class TestBrand
+{
+  public static void main(String[] args)
+  {
+    ThreadBrand.trace_java_generic_thread_brand("Brand_test");
+  }
+}
diff --git a/ltt-usertrace/java/ThreadBrand.java b/ltt-usertrace/java/ThreadBrand.java
new file mode 100644 (file)
index 0000000..14a3079
--- /dev/null
@@ -0,0 +1,9 @@
+// The ThreadBrand.java file
+public class ThreadBrand
+{
+  // Declaration of the Native (C) function
+  private static native void trace_java_generic_thread_brand(String arg);
+  static {
+    System.loadLibrary("ltt-java-thread_brand");
+  }
+}
index 92ca199262d00c5927cfdc838c701f23a1cd55fc..78a7b9f0d8915d07f2e5c832ac64af82a4942c25 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+#Sample
 javac Sample.java
 CLASSPATH=.:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/bin javah -jni Sample
 gcc -I /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/include \
@@ -8,3 +9,13 @@ gcc -I /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/include \
   -o libltt-java-string.so ltt-java-string.c \
   ../ltt-facility-loader-user_generic.c
 LD_LIBRARY_PATH=. java Sample
+
+#TestBrand
+javac TestBrand.java
+CLASSPATH=.:/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/bin javah -jni TestBrand
+gcc -I /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/include \
+  -I /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/include/linux \
+  -shared -Wl,-soname,libltt-java-thread_brand \
+  -o libltt-java-thread_brand.so ltt-java-thread_brand.c \
+  ../ltt-facility-loader-user_generic.c
+LD_LIBRARY_PATH=. java TestBrand
diff --git a/ltt-usertrace/java/ltt-java-thread_brand.c b/ltt-usertrace/java/ltt-java-thread_brand.c
new file mode 100644 (file)
index 0000000..aa08840
--- /dev/null
@@ -0,0 +1,20 @@
+
+#include <jni.h>
+#include "Sample.h"
+#include <stdio.h>
+#include <unistd.h>
+
+#define LTT_TRACE
+#define LTT_BLOCKING 1
+#include <ltt/ltt-facility-user_generic.h>
+
+JNIEXPORT void JNICALL Java_ThreadBrand_trace_1java_1generic_1thread_brand
+  (JNIEnv *env, jobject obj, jstring jstr)
+{
+  const char *str;
+  str = (*env)->GetStringUTFChars(env, jstr, NULL);
+  if (str == NULL) return; // out of memory error thrown
+       trace_user_generic_thread_brand(str);
+  (*env)->ReleaseStringUTFChars(env, jstr, str);
+}
+
This page took 0.025406 seconds and 4 git commands to generate.