[lttng-dev] [lttng-ust PATCH 2/2] Add "2x int" and "2x long" types to the Java interface

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue May 22 12:35:43 EDT 2012


* Alexandre Montplaisir (alexandre.montplaisir at polymtl.ca) wrote:
> 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.

merged, thanks!

Mathieu

> 
> Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir at polymtl.ca>
> ---
>  liblttng-ust-java/LTTngUst.c       |   28 ++++++++++++++++++++++++++++
>  liblttng-ust-java/LTTngUst.java    |   28 ++++++++++++++++++++++++++++
>  liblttng-ust-java/lttng_ust_java.h |   18 ++++++++++++++++++
>  3 files changed, 74 insertions(+)
> 
> diff --git a/liblttng-ust-java/LTTngUst.c b/liblttng-ust-java/LTTngUst.c
> index 0bef89d..9ae3983 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 f4bea32..79ad97a 100644
> --- a/liblttng-ust-java/LTTngUst.java
> +++ b/liblttng-ust-java/LTTngUst.java
> @@ -57,6 +57,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
>       *
>       * @param name
> @@ -68,6 +82,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.
>       *
>       * @param name
> diff --git a/liblttng-ust-java/lttng_ust_java.h b/liblttng-ust-java/lttng_ust_java.h
> index 7cdbea5..7a8b391 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(
> -- 
> 1.7.10
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list