From: Alexandre Montplaisir Date: Tue, 22 May 2012 16:38:17 +0000 (-0400) Subject: Add "2x int" and "2x long" types to the Java interface X-Git-Tag: v2.1.0-rc1~81 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=071f1d0be5fb8e07972f59f4c1cde9cf874718b3;p=lttng-ust.git Add "2x int" and "2x long" types to the Java interface 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 Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-java/LTTngUst.c b/liblttng-ust-java/LTTngUst.c index 0bef89dd..9ae39830 100644 --- a/liblttng-ust-java/LTTngUst.c +++ b/liblttng-ust-java/LTTngUst.c @@ -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, diff --git a/liblttng-ust-java/LTTngUst.java b/liblttng-ust-java/LTTngUst.java index f4bea324..79ad97af 100644 --- a/liblttng-ust-java/LTTngUst.java +++ b/liblttng-ust-java/LTTngUst.java @@ -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. * diff --git a/liblttng-ust-java/lttng_ust_java.h b/liblttng-ust-java/lttng_ust_java.h index 7cdbea57..7a8b391c 100644 --- a/liblttng-ust-java/lttng_ust_java.h +++ b/liblttng-ust-java/lttng_ust_java.h @@ -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(