Fix: pass private data to context callbacks
[lttng-ust.git] / liblttng-ust-java / LTTngUst.c
1 /*
2 * SPDX-License-Identifier: LGPL-2.1-only
3 *
4 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 */
6
7 #define _LGPL_SOURCE
8 #include "org_lttng_ust_LTTngUst.h"
9
10 #define TRACEPOINT_DEFINE
11 #define TRACEPOINT_CREATE_PROBES
12 #include "lttng_ust_java.h"
13
14 JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointInt(JNIEnv *env,
15 jobject jobj __attribute__((unused)),
16 jstring ev_name,
17 jint payload)
18 {
19 jboolean iscopy;
20 const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
21
22 tracepoint(lttng_ust_java, int_event, ev_name_cstr, payload);
23
24 (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
25 }
26
27 JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointIntInt(JNIEnv *env,
28 jobject jobj __attribute__((unused)),
29 jstring ev_name,
30 jint payload1,
31 jint payload2)
32 {
33 jboolean iscopy;
34 const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
35
36 tracepoint(lttng_ust_java, int_int_event, ev_name_cstr, payload1, payload2);
37
38 (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
39 }
40
41 JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointLong(JNIEnv *env,
42 jobject jobj __attribute__((unused)),
43 jstring ev_name,
44 jlong payload)
45 {
46 jboolean iscopy;
47 const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
48
49 tracepoint(lttng_ust_java, long_event, ev_name_cstr, payload);
50
51 (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
52 }
53
54 JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointLongLong(JNIEnv *env,
55 jobject jobj __attribute__((unused)),
56 jstring ev_name,
57 jlong payload1,
58 jlong payload2)
59 {
60 jboolean iscopy;
61 const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
62
63 tracepoint(lttng_ust_java, long_long_event, ev_name_cstr, payload1, payload2);
64
65 (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
66 }
67
68 JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointString(JNIEnv *env,
69 jobject jobj __attribute__((unused)),
70 jstring ev_name,
71 jstring payload)
72 {
73 jboolean iscopy;
74 const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
75 const char *payload_cstr = (*env)->GetStringUTFChars(env, payload, &iscopy);
76
77 tracepoint(lttng_ust_java, string_event, ev_name_cstr, payload_cstr);
78
79 (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
80 (*env)->ReleaseStringUTFChars(env, payload, payload_cstr);
81 }
82
This page took 0.032164 seconds and 4 git commands to generate.