| 1 | /* |
| 2 | * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com> |
| 3 | * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; |
| 8 | * version 2.1 of the License. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * |
| 20 | * Trace files that want to automate creationg of all tracepoints defined |
| 21 | * in their file should include this file. The following are macros that the |
| 22 | * trace file may define: |
| 23 | * |
| 24 | * TRACEPOINT_PROVIDER defines the provider the tracepoint is for: |
| 25 | * < [com_company_]project_[component_] > |
| 26 | * |
| 27 | * TRACEPOINT_INCLUDE_FILE if the file name is something other than |
| 28 | * TRACEPOINT_PROVIDER.h. This macro may be defined to tell |
| 29 | * define_trace.h what file to include. Note, leave off the ".h". |
| 30 | * |
| 31 | * TRACEPOINT_INCLUDE_PATH if the path is something other than within |
| 32 | * the system's include/tracepoint/ path, then this macro can define |
| 33 | * the path to use. This path is relative to tracepoint-event.h, or |
| 34 | * to the include search path. Trick: Use a |
| 35 | * #define TRACEPOINT_INCLUDE_PATH . |
| 36 | * combined with -Ipath_to_header as compiler argument to allow |
| 37 | * searching for a header within your project build tree. |
| 38 | */ |
| 39 | |
| 40 | #ifdef __cplusplus |
| 41 | extern "C" { |
| 42 | #endif |
| 43 | |
| 44 | #ifdef TRACEPOINT_CREATE_PROBES |
| 45 | |
| 46 | /* Prevent recursion */ |
| 47 | #undef TRACEPOINT_CREATE_PROBES |
| 48 | |
| 49 | #ifndef __tp_stringify |
| 50 | #define __tp_stringify_1(x...) #x |
| 51 | #define __tp_stringify(x...) __tp_stringify_1(x) |
| 52 | #endif |
| 53 | |
| 54 | #undef TRACEPOINT_EVENT |
| 55 | #define TRACEPOINT_EVENT(provider, name, proto, args, fields) \ |
| 56 | _DEFINE_TRACEPOINT(provider, name) |
| 57 | |
| 58 | #undef TRACEPOINT_EVENT_INSTANCE |
| 59 | #define TRACEPOINT_EVENT_INSTANCE(provider, template, name, proto, args) \ |
| 60 | _DEFINE_TRACEPOINT(provider, name) |
| 61 | |
| 62 | #undef TRACEPOINT_EVENT_NOARGS |
| 63 | #define TRACEPOINT_EVENT_NOARGS(provider, name, fields) \ |
| 64 | _DEFINE_TRACEPOINT(provider, name) |
| 65 | |
| 66 | #undef TRACEPOINT_EVENT_INSTANCE_NOARGS |
| 67 | #define TRACEPOINT_EVENT_INSTANCE_NOARGS(provider, template, name) \ |
| 68 | _DEFINE_TRACEPOINT(provider, name) |
| 69 | |
| 70 | #undef TRACEPOINT_INCLUDE |
| 71 | #undef __TRACEPOINT_INCLUDE |
| 72 | |
| 73 | #ifndef TRACEPOINT_INCLUDE_FILE |
| 74 | # define TRACEPOINT_INCLUDE_FILE TRACEPOINT_PROVIDER |
| 75 | # define UNDEF_TRACEPOINT_INCLUDE_FILE |
| 76 | #endif |
| 77 | |
| 78 | #ifndef TRACEPOINT_INCLUDE_PATH |
| 79 | # define __TRACEPOINT_INCLUDE(provider) <tracepoint/provider.h> |
| 80 | # define UNDEF_TRACEPOINT_INCLUDE_PATH |
| 81 | #else |
| 82 | # define __TRACEPOINT_INCLUDE(provider) \ |
| 83 | __tp_stringify(TRACEPOINT_INCLUDE_PATH/provider.h) |
| 84 | #endif |
| 85 | |
| 86 | # define TRACEPOINT_INCLUDE(provider) __TRACEPOINT_INCLUDE(provider) |
| 87 | |
| 88 | /* Let the trace headers be reread */ |
| 89 | #define TRACEPOINT_HEADER_MULTI_READ |
| 90 | |
| 91 | #include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) |
| 92 | |
| 93 | #include <lttng/ust-tracepoint-event.h> |
| 94 | |
| 95 | #undef TRACEPOINT_EVENT |
| 96 | #undef TRACEPOINT_EVENT_CLASS |
| 97 | #undef TRACEPOINT_EVENT_INSTANCE |
| 98 | #undef TRACEPOINT_EVENT_NOARGS |
| 99 | #undef TRACEPOINT_EVENT_CLASS_NOARGS |
| 100 | #undef TRACEPOINT_EVENT_INSTANCE_NOARGS |
| 101 | #undef TRACEPOINT_HEADER_MULTI_READ |
| 102 | |
| 103 | /* Only undef what we defined in this file */ |
| 104 | #ifdef UNDEF_TRACEPOINT_INCLUDE_FILE |
| 105 | # undef TRACEPOINT_INCLUDE_FILE |
| 106 | # undef UNDEF_TRACEPOINT_INCLUDE_FILE |
| 107 | #endif |
| 108 | |
| 109 | #ifdef UNDEF_TRACEPOINT_INCLUDE_PATH |
| 110 | # undef TRACEPOINT_INCLUDE_PATH |
| 111 | # undef UNDEF_TRACEPOINT_INCLUDE_PATH |
| 112 | #endif |
| 113 | |
| 114 | /* We may be processing more files */ |
| 115 | #define TRACEPOINT_CREATE_PROBES |
| 116 | |
| 117 | #endif /* TRACEPOINT_CREATE_PROBES */ |
| 118 | |
| 119 | #ifdef __cplusplus |
| 120 | } |
| 121 | #endif |