| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (C) 2013-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef _LTTNG_UST_TRACEF_H |
| 8 | #define _LTTNG_UST_TRACEF_H |
| 9 | |
| 10 | #include <lttng/ust-api-compat.h> |
| 11 | #include <lttng/tp/lttng-ust-tracef.h> |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | |
| 17 | extern |
| 18 | void lttng_ust__tracef(const char *fmt, ...) |
| 19 | __attribute__((format(printf, 1, 2))); |
| 20 | |
| 21 | extern |
| 22 | void lttng_ust__vtracef(const char *fmt, va_list ap) |
| 23 | __attribute__((format(printf, 1, 0))); |
| 24 | |
| 25 | #define lttng_ust_tracef(fmt, ...) \ |
| 26 | do { \ |
| 27 | LTTNG_UST_STAP_PROBEV(tracepoint_lttng_ust_tracef, event, ## __VA_ARGS__); \ |
| 28 | if (caa_unlikely(lttng_ust_tracepoint_lttng_ust_tracef___event.state)) \ |
| 29 | lttng_ust__tracef(fmt, ## __VA_ARGS__); \ |
| 30 | } while (0) |
| 31 | |
| 32 | #define lttng_ust_vtracef(fmt, ap) \ |
| 33 | do { \ |
| 34 | if (caa_unlikely(lttng_ust_tracepoint_lttng_ust_tracef___event.state)) \ |
| 35 | lttng_ust__vtracef(fmt, ap); \ |
| 36 | } while (0) |
| 37 | |
| 38 | #if LTTNG_UST_COMPAT_API(0) |
| 39 | #define tracef lttng_ust_tracef |
| 40 | #endif |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | } |
| 44 | #endif |
| 45 | |
| 46 | #endif /* _LTTNG_UST_TRACEF_H */ |