Add "2x int" and "2x long" types to the Java interface
authorAlexandre Montplaisir <alexandre.montplaisir@polymtl.ca>
Tue, 22 May 2012 16:38:17 +0000 (12:38 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 22 May 2012 16:38:17 +0000 (12:38 -0400)
Since we have to statically define all the available event types,
offer types for two integers and two longs, which are relatively
common use cases.

Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-java/LTTngUst.c
liblttng-ust-java/LTTngUst.java
liblttng-ust-java/lttng_ust_java.h

index 0bef89ddb5252f2be069b8129081414bd6b7de84..9ae3983050b0095afcde4da886b26aed0798f343 100644 (file)
@@ -35,6 +35,20 @@ JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointInt(JNIEnv *env,
        (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
 }
 
+JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointIntInt(JNIEnv *env,
+                                               jobject jobj,
+                                               jstring ev_name,
+                                               jint payload1,
+                                               jint payload2)
+{
+       jboolean iscopy;
+       const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
+
+       tracepoint(lttng_ust_java, int_int_event, ev_name_cstr, payload1, payload2);
+
+       (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
+}
+
 JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointLong(JNIEnv *env,
                                                jobject jobj,
                                                jstring ev_name,
@@ -48,6 +62,20 @@ JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointLong(JNIEnv *env,
        (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
 }
 
+JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointLongLong(JNIEnv *env,
+                                               jobject jobj,
+                                               jstring ev_name,
+                                               jlong payload1,
+                                               jlong payload2)
+{
+       jboolean iscopy;
+       const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
+
+       tracepoint(lttng_ust_java, long_long_event, ev_name_cstr, payload1, payload2);
+
+       (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
+}
+
 JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointString(JNIEnv *env,
                                                jobject jobj,
                                                jstring ev_name,
index f4bea3242b5934a47596915120bc373b429978dd..79ad97afc7cb73570917201c9dcbcbe35b026eb0 100644 (file)
@@ -56,6 +56,20 @@ public abstract class LTTngUst {
      */
     public static native void tracepointInt(String name, int payload);
 
+    /**
+     * Insert a tracepoint with a payload consisting of two integers.
+     *
+     * @param name
+     *            The name assigned to this event. For best performance, this
+     *            should be a statically-defined String, or a literal.
+     * @param payload1
+     *            The first int payload
+     * @param payload2
+     *            The second int payload
+     */
+    public static native void
+    tracepointIntInt(String name, int payload1, int payload2);
+
     /**
      * Insert a tracepoint with a payload of type Long
      *
@@ -67,6 +81,20 @@ public abstract class LTTngUst {
      */
     public static native void tracepointLong(String name, long payload);
 
+    /**
+     * Insert a tracepoint with a payload consisting of two longs.
+     *
+     * @param name
+     *            The name assigned to this event. For best performance, this
+     *            should be a statically-defined String, or a literal.
+     * @param payload1
+     *            The first long payload
+     * @param payload2
+     *            The second long payload
+     */
+    public static native void
+    tracepointLongLong(String name, long payload1, long payload2);
+
     /**
      * Insert a tracepoint with a String payload.
      *
index 7cdbea5703ceede1ad0db5c02878793017913b03..7a8b391c61e5fa2f0a69085e1e76168b9a2b0e85 100644 (file)
@@ -32,6 +32,15 @@ TRACEPOINT_EVENT(lttng_ust_java, int_event,
        )
 )
 
+TRACEPOINT_EVENT(lttng_ust_java, int_int_event,
+       TP_ARGS(const char *, name, int, payload1, int, payload2),
+       TP_FIELDS(
+               ctf_string(name, name)
+               ctf_integer(int, int_payload1, payload1)
+               ctf_integer(int, int_payload2, payload2)
+       )
+)
+
 TRACEPOINT_EVENT(lttng_ust_java, long_event,
        TP_ARGS(const char *, name, long, payload),
        TP_FIELDS(
@@ -40,6 +49,15 @@ TRACEPOINT_EVENT(lttng_ust_java, long_event,
        )
 )
 
+TRACEPOINT_EVENT(lttng_ust_java, long_long_event,
+       TP_ARGS(const char *, name, long, payload1, long, payload2),
+       TP_FIELDS(
+               ctf_string(name, name)
+               ctf_integer(long, long_payload1, payload1)
+               ctf_integer(long, long_payload2, payload2)
+       )
+)
+
 TRACEPOINT_EVENT(lttng_ust_java, string_event,
        TP_ARGS(const char *, name, const char *, payload),
        TP_FIELDS(
This page took 0.034539 seconds and 4 git commands to generate.