Adrien BĂ©raud | 612b55b | 2023-05-29 10:42:04 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022-2023 Savoir-faire Linux Inc. |
| 3 | * |
| 4 | * Author: Olivier Dion <olivier.dion@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | */ |
| 20 | |
| 21 | #pragma once |
| 22 | #pragma GCC diagnostic push |
| 23 | #pragma GCC diagnostic ignored "-Wmissing-field-initializers" |
| 24 | #include "tracepoint-def.h" |
| 25 | #pragma GCC diagnostic pop |
| 26 | |
| 27 | #ifdef ENABLE_TRACEPOINTS |
| 28 | |
| 29 | # ifndef lttng_ust_tracepoint |
| 30 | # define lttng_ust_tracepoint(...) tracepoint(__VA_ARGS__) |
| 31 | # endif |
| 32 | |
| 33 | # ifndef lttng_ust_do_tracepoint |
| 34 | # define lttng_ust_do_tracepoint(...) do_tracepoint(__VA_ARGS__) |
| 35 | # endif |
| 36 | |
| 37 | # ifndef lttng_ust_tracepoint_enabled |
| 38 | # define lttng_ust_tracepoint_enabled(...) tracepoint_enabled(__VA_ARGS__) |
| 39 | # endif |
| 40 | |
| 41 | # define jami_tracepoint(tp_name, ...) \ |
| 42 | lttng_ust_tracepoint(jami, tp_name __VA_OPT__(,) __VA_ARGS__) |
| 43 | |
| 44 | # define jami_tracepoint_if_enabled(tp_name, ...) \ |
| 45 | do { \ |
| 46 | if (lttng_ust_tracepoint_enabled(jami, tp_name)) { \ |
| 47 | lttng_ust_do_tracepoint(jami, \ |
| 48 | tp_name \ |
| 49 | __VA_OPT__(,) \ |
| 50 | __VA_ARGS__); \ |
| 51 | } \ |
| 52 | } \ |
| 53 | while (0) |
| 54 | |
| 55 | #else |
| 56 | |
| 57 | # define jami_tracepoint(...) static_assert(true) |
| 58 | # define jami_tracepoint_if_enabled(...) static_assert(true) |
| 59 | |
| 60 | #endif |