Commit | Line | Data |
---|---|---|
e92f3e28 MD |
1 | /* |
2 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
3 | * | |
4 | * This library is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU Lesser General Public | |
6 | * License as published by the Free Software Foundation; only | |
7 | * version 2.1 of the License. | |
8 | * | |
9 | * This library is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * Lesser General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU Lesser General Public | |
15 | * License along with this library; if not, write to the Free Software | |
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | */ | |
18 | ||
5ab4c5cb | 19 | #include <jni.h> |
5ab4c5cb | 20 | |
cc885e49 | 21 | #define TRACEPOINT_DEFINE |
2b6f8df9 | 22 | #define TRACEPOINT_CREATE_PROBES |
2ac85198 | 23 | #include "lttng_ust_java.h" |
2b6f8df9 | 24 | |
14d1b9ce AM |
25 | JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointInt(JNIEnv *env, |
26 | jobject jobj, | |
27 | jstring ev_name, | |
28 | jint payload) | |
29 | { | |
30 | jboolean iscopy; | |
31 | const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy); | |
32 | ||
33 | tracepoint(lttng_ust_java, int_event, ev_name_cstr, payload); | |
34 | ||
35 | (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr); | |
36 | } | |
37 | ||
071f1d0b AM |
38 | JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointIntInt(JNIEnv *env, |
39 | jobject jobj, | |
40 | jstring ev_name, | |
41 | jint payload1, | |
42 | jint payload2) | |
43 | { | |
44 | jboolean iscopy; | |
45 | const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy); | |
46 | ||
47 | tracepoint(lttng_ust_java, int_int_event, ev_name_cstr, payload1, payload2); | |
48 | ||
49 | (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr); | |
50 | } | |
51 | ||
14d1b9ce AM |
52 | JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointLong(JNIEnv *env, |
53 | jobject jobj, | |
54 | jstring ev_name, | |
55 | jlong payload) | |
56 | { | |
57 | jboolean iscopy; | |
58 | const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy); | |
59 | ||
60 | tracepoint(lttng_ust_java, long_event, ev_name_cstr, payload); | |
61 | ||
62 | (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr); | |
63 | } | |
64 | ||
071f1d0b AM |
65 | JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointLongLong(JNIEnv *env, |
66 | jobject jobj, | |
67 | jstring ev_name, | |
68 | jlong payload1, | |
69 | jlong payload2) | |
70 | { | |
71 | jboolean iscopy; | |
72 | const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy); | |
73 | ||
74 | tracepoint(lttng_ust_java, long_long_event, ev_name_cstr, payload1, payload2); | |
75 | ||
76 | (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr); | |
77 | } | |
78 | ||
a58ac6c8 | 79 | JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointString(JNIEnv *env, |
2ac85198 MD |
80 | jobject jobj, |
81 | jstring ev_name, | |
14d1b9ce | 82 | jstring payload) |
5ab4c5cb PMF |
83 | { |
84 | jboolean iscopy; | |
14d1b9ce AM |
85 | const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy); |
86 | const char *payload_cstr = (*env)->GetStringUTFChars(env, payload, &iscopy); | |
5ab4c5cb | 87 | |
14d1b9ce | 88 | tracepoint(lttng_ust_java, string_event, ev_name_cstr, payload_cstr); |
a58ac6c8 AM |
89 | |
90 | (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr); | |
14d1b9ce | 91 | (*env)->ReleaseStringUTFChars(env, payload, payload_cstr); |
5ab4c5cb | 92 | } |
14d1b9ce | 93 |