sleep(delay);
fprintf(stderr, "Tracing... ");
- tracepoint(ust_tests_demo, starting, 123);
+ lttng_ust_tracepoint(ust_tests_demo, starting, 123);
for (i = 0; i < 5; i++) {
netint = htonl(i);
- tracepoint(ust_tests_demo2, loop, i, netint, values,
+ lttng_ust_tracepoint(ust_tests_demo2, loop, i, netint, values,
text, strlen(text), dbl, flt);
}
- tracepoint(ust_tests_demo, done, 456);
- tracepoint(ust_tests_demo3, done, 42);
+ lttng_ust_tracepoint(ust_tests_demo, done, 456);
+ lttng_ust_tracepoint(ust_tests_demo3, done, 42);
fprintf(stderr, " done.\n");
return 0;
}
int i = 0;
for (i = 0; i < 100000; i++) {
- tracepoint(sample_component, message, "Hello World");
+ lttng_ust_tracepoint(sample_component, message, "Hello World");
usleep(1);
}
return 0;
int i = 0;
for (i = 0; i < 100000; i++) {
- tracepoint(sample_tracepoint, message, "Hello World\n");
+ lttng_ust_tracepoint(sample_tracepoint, message, "Hello World\n");
usleep(1);
}
return 0;
void inthandler(int sig __attribute__((unused)))
{
printf("in SIGUSR1 handler\n");
- tracepoint(ust_tests_hello, tptest_sighandler);
+ lttng_ust_tracepoint(ust_tests_hello, tptest_sighandler);
}
static
fprintf(stderr, "Tracing... ");
for (i = 0; i < 1000000; i++) {
netint = htonl(i);
- tracepoint(ust_tests_hello, tptest, i, netint, values,
+ lttng_ust_tracepoint(ust_tests_hello, tptest, i, netint, values,
text, strlen(text), dbl, flt);
}
fprintf(stderr, " done.\n");
lttng/ust-tracepoint-event-reset.h \
lttng/ust-tracepoint-event-write.h \
lttng/ust-tracepoint-event-nowrite.h \
+ lttng/ust-api-compat.h \
lttng/ust-arch.h \
lttng/ust-events.h \
lttng/ust-common.h \
#include <lttng/ust-config.h> /* for sdt */
#include <lttng/ust-compiler.h>
#include <lttng/ust-tracer.h>
+#include <lttng/ust-api-compat.h>
#define LTTNG_UST_TRACEPOINT_NAME_LEN_MAX 256
extern "C" {
#endif
-#define tracepoint_enabled(provider, name) \
+#define lttng_ust_tracepoint_enabled(provider, name) \
caa_unlikely(CMM_LOAD_SHARED(__tracepoint_##provider##___##name.state))
-#define do_tracepoint(provider, name, ...) \
+#define lttng_ust_do_tracepoint(provider, name, ...) \
__tracepoint_cb_##provider##___##name(__VA_ARGS__)
-#define tracepoint(provider, name, ...) \
- do { \
- LTTNG_UST_STAP_PROBEV(provider, name, ## __VA_ARGS__); \
- if (tracepoint_enabled(provider, name)) \
- do_tracepoint(provider, name, __VA_ARGS__); \
+#define lttng_ust_tracepoint(provider, name, ...) \
+ do { \
+ LTTNG_UST_STAP_PROBEV(provider, name, ## __VA_ARGS__); \
+ if (lttng_ust_tracepoint_enabled(provider, name)) \
+ lttng_ust_do_tracepoint(provider, name, __VA_ARGS__); \
} while (0)
#define TP_ARGS(...) __VA_ARGS__
#endif /* #else TRACEPOINT_DEFINE */
+#if LTTNG_UST_COMPAT_API(0)
+#define tracepoint lttng_ust_tracepoint
+#define do_tracepoint lttng_ust_do_tracepoint
+#define tracepoint_enabled lttng_ust_tracepoint_enabled
+#endif /* #if LTTNG_UST_COMPAT_API(0) */
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright (C) 2021 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng-UST API compatibility header
+ */
+
+#ifndef _LTTNG_UST_API_COMPAT_H
+#define _LTTNG_UST_API_COMPAT_H
+
+/*
+ * In order to disable compatibility API for a range of soname major
+ * versions, define LTTNG_UST_COMPAT_API_VERSION to the oldest major
+ * version API for which to provide compatibility.
+ *
+ * If LTTNG_UST_COMPAT_API_VERSION is undefined, API compatibility for
+ * all API versions is provided.
+ * If LTTNG_UST_COMPAT_API_VERSION is defined to N, API compatibility
+ * for soname N or higher is provided, leaving out (not compiling)
+ * compatibility for soname lower than N.
+ */
+
+#ifndef LTTNG_UST_COMPAT_API_VERSION
+#define LTTNG_UST_COMPAT_API_VERSION 0
+#endif
+
+#define LTTNG_UST_COMPAT_API(major) \
+ (LTTNG_UST_COMPAT_API_VERSION <= (major))
+
+#endif /* _LTTNG_UST_API_COMPAT_H */
void __cyg_profile_func_enter(void *this_fn, void *call_site __attribute__((unused)))
{
- tracepoint(lttng_ust_cyg_profile_fast, func_entry, this_fn);
+ lttng_ust_tracepoint(lttng_ust_cyg_profile_fast, func_entry, this_fn);
}
void __cyg_profile_func_exit(void *this_fn, void *call_site __attribute__((unused)))
{
- tracepoint(lttng_ust_cyg_profile_fast, func_exit, this_fn);
+ lttng_ust_tracepoint(lttng_ust_cyg_profile_fast, func_exit, this_fn);
}
void __cyg_profile_func_enter(void *this_fn, void *call_site)
{
- tracepoint(lttng_ust_cyg_profile, func_entry, this_fn, call_site);
+ lttng_ust_tracepoint(lttng_ust_cyg_profile, func_entry, this_fn, call_site);
}
void __cyg_profile_func_exit(void *this_fn, void *call_site)
{
- tracepoint(lttng_ust_cyg_profile, func_exit, this_fn, call_site);
+ lttng_ust_tracepoint(lttng_ust_cyg_profile, func_exit, this_fn, call_site);
}
goto end;
}
- tracepoint(lttng_ust_dl, dlopen,
+ lttng_ust_tracepoint(lttng_ust_dl, dlopen,
ip, so_base, resolved_path, flags, memsz,
has_build_id, has_debug_link);
if (has_build_id) {
- tracepoint(lttng_ust_dl, build_id,
+ lttng_ust_tracepoint(lttng_ust_dl, build_id,
ip, so_base, build_id, build_id_len);
}
if (has_debug_link) {
- tracepoint(lttng_ust_dl, debug_link,
+ lttng_ust_tracepoint(lttng_ust_dl, debug_link,
ip, so_base, dbg_file, crc);
}
goto end;
}
- tracepoint(lttng_ust_dl, dlmopen,
+ lttng_ust_tracepoint(lttng_ust_dl, dlmopen,
ip, so_base, nsid, resolved_path, flags, memsz,
has_build_id, has_debug_link);
if (has_build_id) {
- tracepoint(lttng_ust_dl, build_id,
+ lttng_ust_tracepoint(lttng_ust_dl, build_id,
ip, so_base, build_id, build_id_len);
}
if (has_debug_link) {
- tracepoint(lttng_ust_dl, debug_link,
+ lttng_ust_tracepoint(lttng_ust_dl, debug_link,
ip, so_base, dbg_file, crc);
}
ret = dlinfo(handle, RTLD_DI_LINKMAP, &p);
if (ret != -1 && p != NULL && p->l_addr != 0) {
- tracepoint(lttng_ust_dl, dlclose,
+ lttng_ust_tracepoint(lttng_ust_dl, dlclose,
LTTNG_UST_CALLER_IP(),
(void *) p->l_addr);
}
const char *class_name_cstr = (*env)->GetStringUTFChars(env, class_name, &iscopy);
const char *method_name_cstr = (*env)->GetStringUTFChars(env, method_name, &iscopy);
- tracepoint(lttng_jul, event, msg_cstr, logger_name_cstr,
+ lttng_ust_tracepoint(lttng_jul, event, msg_cstr, logger_name_cstr,
class_name_cstr, method_name_cstr, millis, log_level, thread_id);
(*env)->ReleaseStringUTFChars(env, msg, msg_cstr);
lttng_ust_context_info_tls.ctx_strings = context_info_strings_array;
lttng_ust_context_info_tls.ctx_strings_len = (*env)->GetArrayLength(env, context_info_strings);
- tracepoint(lttng_jul, event, msg_cstr, logger_name_cstr,
+ lttng_ust_tracepoint(lttng_jul, event, msg_cstr, logger_name_cstr,
class_name_cstr, method_name_cstr, millis, log_level, thread_id);
lttng_ust_context_info_tls.ctx_entries = NULL;
const char *file_name_cstr = (*env)->GetStringUTFChars(env, file_name, &iscopy);
const char *thread_name_cstr = (*env)->GetStringUTFChars(env, thread_name, &iscopy);
- tracepoint(lttng_log4j, event, msg_cstr, logger_name_cstr,
+ lttng_ust_tracepoint(lttng_log4j, event, msg_cstr, logger_name_cstr,
class_name_cstr, method_name_cstr, file_name_cstr,
line_number, timestamp, loglevel, thread_name_cstr);
lttng_ust_context_info_tls.ctx_strings = context_info_strings_array;
lttng_ust_context_info_tls.ctx_strings_len = (*env)->GetArrayLength(env, context_info_strings);
- tracepoint(lttng_log4j, event, msg_cstr, logger_name_cstr,
+ lttng_ust_tracepoint(lttng_log4j, event, msg_cstr, logger_name_cstr,
class_name_cstr, method_name_cstr, file_name_cstr,
line_number, timestamp, loglevel, thread_name_cstr);
jboolean iscopy;
const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
- tracepoint(lttng_ust_java, int_event, ev_name_cstr, payload);
+ lttng_ust_tracepoint(lttng_ust_java, int_event, ev_name_cstr, payload);
(*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
}
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);
+ lttng_ust_tracepoint(lttng_ust_java, int_int_event, ev_name_cstr, payload1, payload2);
(*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
}
jboolean iscopy;
const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
- tracepoint(lttng_ust_java, long_event, ev_name_cstr, payload);
+ lttng_ust_tracepoint(lttng_ust_java, long_event, ev_name_cstr, payload);
(*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
}
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);
+ lttng_ust_tracepoint(lttng_ust_java, long_long_event, ev_name_cstr, payload1, payload2);
(*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
}
const char *ev_name_cstr = (*env)->GetStringUTFChars(env, ev_name, &iscopy);
const char *payload_cstr = (*env)->GetStringUTFChars(env, payload, &iscopy);
- tracepoint(lttng_ust_java, string_event, ev_name_cstr, payload_cstr);
+ lttng_ust_tracepoint(lttng_ust_java, string_event, ev_name_cstr, payload_cstr);
(*env)->ReleaseStringUTFChars(env, ev_name, ev_name_cstr);
(*env)->ReleaseStringUTFChars(env, payload, payload_cstr);
}
retval = cur_alloc.malloc(size);
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(lttng_ust_libc, malloc,
+ lttng_ust_tracepoint(lttng_ust_libc, malloc,
size, retval, LTTNG_UST_CALLER_IP());
}
URCU_TLS(malloc_nesting)--;
}
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(lttng_ust_libc, free,
+ lttng_ust_tracepoint(lttng_ust_libc, free,
ptr, LTTNG_UST_CALLER_IP());
}
}
retval = cur_alloc.calloc(nmemb, size);
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(lttng_ust_libc, calloc,
+ lttng_ust_tracepoint(lttng_ust_libc, calloc,
nmemb, size, retval, LTTNG_UST_CALLER_IP());
}
URCU_TLS(malloc_nesting)--;
retval = cur_alloc.realloc(ptr, size);
end:
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(lttng_ust_libc, realloc,
+ lttng_ust_tracepoint(lttng_ust_libc, realloc,
ptr, size, retval, LTTNG_UST_CALLER_IP());
}
URCU_TLS(malloc_nesting)--;
}
retval = cur_alloc.memalign(alignment, size);
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(lttng_ust_libc, memalign,
+ lttng_ust_tracepoint(lttng_ust_libc, memalign,
alignment, size, retval,
LTTNG_UST_CALLER_IP());
}
}
retval = cur_alloc.posix_memalign(memptr, alignment, size);
if (URCU_TLS(malloc_nesting) == 1) {
- tracepoint(lttng_ust_libc, posix_memalign,
+ lttng_ust_tracepoint(lttng_ust_libc, posix_memalign,
*memptr, alignment, size,
retval, LTTNG_UST_CALLER_IP());
}
}
thread_in_trace = 1;
- tracepoint(lttng_ust_pthread, pthread_mutex_lock_req, mutex,
+ lttng_ust_tracepoint(lttng_ust_pthread, pthread_mutex_lock_req, mutex,
LTTNG_UST_CALLER_IP());
retval = mutex_lock(mutex);
- tracepoint(lttng_ust_pthread, pthread_mutex_lock_acq, mutex,
+ lttng_ust_tracepoint(lttng_ust_pthread, pthread_mutex_lock_acq, mutex,
retval, LTTNG_UST_CALLER_IP());
thread_in_trace = 0;
return retval;
thread_in_trace = 1;
retval = mutex_trylock(mutex);
- tracepoint(lttng_ust_pthread, pthread_mutex_trylock, mutex,
+ lttng_ust_tracepoint(lttng_ust_pthread, pthread_mutex_trylock, mutex,
retval, LTTNG_UST_CALLER_IP());
thread_in_trace = 0;
return retval;
thread_in_trace = 1;
retval = mutex_unlock(mutex);
- tracepoint(lttng_ust_pthread, pthread_mutex_unlock, mutex,
+ lttng_ust_tracepoint(lttng_ust_pthread, pthread_mutex_unlock, mutex,
retval, LTTNG_UST_CALLER_IP());
thread_in_trace = 0;
return retval;
const char *logger_name, const char *funcName, unsigned int lineno,
unsigned int int_loglevel, unsigned int thread, const char *threadName)
{
- tracepoint(lttng_python, event, asctime, msg, logger_name, funcName,
+ lttng_ust_tracepoint(lttng_python, event, asctime, msg, logger_name, funcName,
lineno, int_loglevel, thread, threadName);
}
{
struct bin_info_data *bin_data = (struct bin_info_data *) priv;
- tracepoint(lttng_ust_statedump, bin_info,
+ lttng_ust_tracepoint(lttng_ust_statedump, bin_info,
session, bin_data->base_addr_ptr,
bin_data->resolved_path, bin_data->memsz,
bin_data->is_pic, bin_data->has_build_id,
{
struct bin_info_data *bin_data = (struct bin_info_data *) priv;
- tracepoint(lttng_ust_statedump, build_id,
+ lttng_ust_tracepoint(lttng_ust_statedump, build_id,
session, bin_data->base_addr_ptr,
bin_data->build_id, bin_data->build_id_len);
}
{
struct bin_info_data *bin_data = (struct bin_info_data *) priv;
- tracepoint(lttng_ust_statedump, debug_link,
+ lttng_ust_tracepoint(lttng_ust_statedump, debug_link,
session, bin_data->base_addr_ptr,
bin_data->dbg_file, bin_data->crc);
}
void procname_cb(struct lttng_ust_session *session, void *priv)
{
char *procname = (char *) priv;
- tracepoint(lttng_ust_statedump, procname, session, procname);
+ lttng_ust_tracepoint(lttng_ust_statedump, procname, session, procname);
}
static
void trace_start_cb(struct lttng_ust_session *session, void *priv __attribute__((unused)))
{
- tracepoint(lttng_ust_statedump, start, session);
+ lttng_ust_tracepoint(lttng_ust_statedump, start, session);
}
static
void trace_end_cb(struct lttng_ust_session *session, void *priv __attribute__((unused)))
{
- tracepoint(lttng_ust_statedump, end, session);
+ lttng_ust_tracepoint(lttng_ust_statedump, end, session);
}
static
static
void trace_lib_load(const struct bin_info_data *bin_data, void *ip)
{
- tracepoint(lttng_ust_lib, load,
+ lttng_ust_tracepoint(lttng_ust_lib, load,
ip, bin_data->base_addr_ptr, bin_data->resolved_path,
bin_data->memsz, bin_data->has_build_id,
bin_data->has_debug_link);
if (bin_data->has_build_id) {
- tracepoint(lttng_ust_lib, build_id,
+ lttng_ust_tracepoint(lttng_ust_lib, build_id,
ip, bin_data->base_addr_ptr, bin_data->build_id,
bin_data->build_id_len);
}
if (bin_data->has_debug_link) {
- tracepoint(lttng_ust_lib, debug_link,
+ lttng_ust_tracepoint(lttng_ust_lib, debug_link,
ip, bin_data->base_addr_ptr, bin_data->dbg_file,
bin_data->crc);
}
static
void trace_lib_unload(const struct bin_info_data *bin_data, void *ip)
{
- tracepoint(lttng_ust_lib, unload, ip, bin_data->base_addr_ptr);
+ lttng_ust_tracepoint(lttng_ust_lib, unload, ip, bin_data->base_addr_ptr);
}
static
for (i = 0; i < 100; i++)
cmm_barrier();
#ifdef TRACING
- tracepoint(ust_tests_benchmark, tpbench, v);
+ lttng_ust_tracepoint(ust_tests_benchmark, tpbench, v);
#endif
}
fprintf(stderr, "Tracing... ");
for (i = 0; i < 100; i++) {
- tracepoint(ust_tests_ctf_types, tptest, i, i % 6,
+ lttng_ust_tracepoint(ust_tests_ctf_types, tptest, i, i % 6,
i % 21);
}
for (i = 0; i < 10; i++) {
- tracepoint(ust_tests_ctf_types, tptest_bis, i, i % 6);
+ lttng_ust_tracepoint(ust_tests_ctf_types, tptest_bis, i, i % 6);
}
fprintf(stderr, " done.\n");
return 0;
sleep(delay);
fprintf(stderr, "Tracing... ");
- tracepoint(ust_tests_hello_many, tptest_simple1);
- tracepoint(ust_tests_hello_many, tptest_simple34);
+ lttng_ust_tracepoint(ust_tests_hello_many, tptest_simple1);
+ lttng_ust_tracepoint(ust_tests_hello_many, tptest_simple34);
fprintf(stderr, " done.\n");
return 0;
}
void inthandler(int sig __attribute__((unused)))
{
printf("in SIGUSR1 handler\n");
- tracepoint(ust_tests_hello, tptest_sighandler);
+ lttng_ust_tracepoint(ust_tests_hello, tptest_sighandler);
}
static
fprintf(stderr, "Tracing... ");
for (i = 0; i < 1000000; i++) {
netint = htonl(i);
- tracepoint(ust_tests_hello, tptest, i, netint, values,
+ lttng_ust_tracepoint(ust_tests_hello, tptest, i, netint, values,
text, strlen(text), dbl, flt, mybool);
//usleep(100000);
}
int main(void)
{
- tracepoint(ust_tests_sameline, event1); tracepoint(ust_tests_sameline, event2);
+ lttng_ust_tracepoint(ust_tests_sameline, event1); lttng_ust_tracepoint(ust_tests_sameline, event2);
return 0;
}
void inthandler(int sig __attribute__((unused)))
{
printf("in SIGUSR1 handler\n");
- tracepoint(ust_tests_hello, tptest_sighandler);
+ lttng_ust_tracepoint(ust_tests_hello, tptest_sighandler);
}
static
fprintf(stderr, "Tracing... ");
for (i = 0; i < 1000000; i++) {
netint = htonl(i);
- tracepoint(ust_tests_hello, tptest, i, netint, values,
+ lttng_ust_tracepoint(ust_tests_hello, tptest, i, netint, values,
text, strlen(text), dbl, flt, mybool);
test_inc_count();
//usleep(100000);