Build the liblttng-ust-java library using the new M4 macros
[lttng-ust.git] / liblttng-ust-jul / LTTngUst.c
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 "org_lttng_ust_jul_LTTngUst.h"
20
21 #define TRACEPOINT_DEFINE
22 #define TRACEPOINT_CREATE_PROBES
23 #include "lttng_ust_jul.h"
24
25 /*
26 * System tracepoint meaning only root agent will fire this.
27 */
28 JNIEXPORT void JNICALL Java_org_lttng_ust_jul_LTTngUst_tracepointS(JNIEnv *env,
29 jobject jobj,
30 jstring msg,
31 jstring logger_name,
32 jstring class_name,
33 jstring method_name,
34 jlong millis,
35 jint log_level,
36 jint thread_id)
37 {
38 jboolean iscopy;
39 const char *msg_cstr = (*env)->GetStringUTFChars(env, msg, &iscopy);
40 const char *logger_name_cstr = (*env)->GetStringUTFChars(env, logger_name, &iscopy);
41 const char *class_name_cstr = (*env)->GetStringUTFChars(env, class_name, &iscopy);
42 const char *method_name_cstr = (*env)->GetStringUTFChars(env, method_name, &iscopy);
43
44 tracepoint(lttng_jul, sys_event, msg_cstr, logger_name_cstr,
45 class_name_cstr, method_name_cstr, millis, log_level, thread_id);
46
47 (*env)->ReleaseStringUTFChars(env, msg, msg_cstr);
48 (*env)->ReleaseStringUTFChars(env, logger_name, logger_name_cstr);
49 (*env)->ReleaseStringUTFChars(env, class_name, class_name_cstr);
50 (*env)->ReleaseStringUTFChars(env, method_name, method_name_cstr);
51 }
52
53 /*
54 * User tracepoint meaning only a non root agent will fire this.
55 */
56 JNIEXPORT void JNICALL Java_org_lttng_ust_jul_LTTngUst_tracepointU(JNIEnv *env,
57 jobject jobj,
58 jstring msg,
59 jstring logger_name,
60 jstring class_name,
61 jstring method_name,
62 jlong millis,
63 jint log_level,
64 jint thread_id)
65 {
66 jboolean iscopy;
67 const char *msg_cstr = (*env)->GetStringUTFChars(env, msg, &iscopy);
68 const char *logger_name_cstr = (*env)->GetStringUTFChars(env, logger_name, &iscopy);
69 const char *class_name_cstr = (*env)->GetStringUTFChars(env, class_name, &iscopy);
70 const char *method_name_cstr = (*env)->GetStringUTFChars(env, method_name, &iscopy);
71
72 tracepoint(lttng_jul, user_event, msg_cstr, logger_name_cstr,
73 class_name_cstr, method_name_cstr, millis, log_level, thread_id);
74
75 (*env)->ReleaseStringUTFChars(env, msg, msg_cstr);
76 (*env)->ReleaseStringUTFChars(env, logger_name, logger_name_cstr);
77 (*env)->ReleaseStringUTFChars(env, class_name, class_name_cstr);
78 (*env)->ReleaseStringUTFChars(env, method_name, method_name_cstr);
79 }
This page took 0.030638 seconds and 4 git commands to generate.