Add Integer and Long tracepoint types to the Java interface
[lttng-ust.git] / liblttng-ust-java / LTTngUst.c
... / ...
CommitLineData
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
19#include <jni.h>
20
21#define TRACEPOINT_DEFINE
22#define TRACEPOINT_CREATE_PROBES
23#include "lttng_ust_java.h"
24
25JNIEXPORT 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
38JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointLong(JNIEnv *env,
39 jobject jobj,
40 jstring ev_name,
41 jlong payload)
42{
43 jboolean iscopy;
44 const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
45
46 tracepoint(lttng_ust_java, long_event, ev_name_cstr, payload);
47
48 (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
49}
50
51JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointString(JNIEnv *env,
52 jobject jobj,
53 jstring ev_name,
54 jstring payload)
55{
56 jboolean iscopy;
57 const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
58 const char *payload_cstr = (*env)->GetStringUTFChars(env, payload, &iscopy);
59
60 tracepoint(lttng_ust_java, string_event, ev_name_cstr, payload_cstr);
61
62 (*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
63 (*env)->ReleaseStringUTFChars(env, payload, payload_cstr);
64}
65
This page took 0.024105 seconds and 4 git commands to generate.