| 1 | /* |
| 2 | * define_trace.h |
| 3 | * |
| 4 | * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org> |
| 5 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; only |
| 10 | * version 2.1 of the License. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * Trace files that want to automate creationg of all tracepoints defined |
| 24 | * in their file should include this file. The following are macros that the |
| 25 | * trace file may define: |
| 26 | * |
| 27 | * TRACE_SYSTEM defines the system the tracepoint is for |
| 28 | * |
| 29 | * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h |
| 30 | * This macro may be defined to tell define_trace.h what file to include. |
| 31 | * Note, leave off the ".h". |
| 32 | * |
| 33 | * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace |
| 34 | * then this macro can define the path to use. Note, the path is relative to |
| 35 | * define_trace.h, not the file including it. Full path names for out of tree |
| 36 | * modules must be used. |
| 37 | */ |
| 38 | |
| 39 | #ifdef CREATE_TRACE_POINTS |
| 40 | |
| 41 | /* Prevent recursion */ |
| 42 | #undef CREATE_TRACE_POINTS |
| 43 | |
| 44 | #include <linux/stringify.h> |
| 45 | |
| 46 | #undef LTTNG_TRACEPOINT_EVENT_MAP |
| 47 | #define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, fields) |
| 48 | |
| 49 | #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS |
| 50 | #define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, fields) |
| 51 | |
| 52 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP |
| 53 | #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(template, name, map, proto, args) |
| 54 | |
| 55 | #undef LTTNG_TRACEPOINT_EVENT |
| 56 | #define LTTNG_TRACEPOINT_EVENT(name, proto, args, fields) |
| 57 | |
| 58 | #undef LTTNG_TRACEPOINT_EVENT_CODE |
| 59 | #define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code_pre, fields, _code_post) |
| 60 | |
| 61 | #undef LTTNG_TRACEPOINT_EVENT_CODE_MAP |
| 62 | #define LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, map, proto, args, _locvar, _code_pre, fields, _code_post) |
| 63 | |
| 64 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE |
| 65 | #define LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) |
| 66 | |
| 67 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS |
| 68 | #define LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name) |
| 69 | |
| 70 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS |
| 71 | #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(template, name, map) |
| 72 | |
| 73 | #undef TRACE_INCLUDE |
| 74 | #undef __TRACE_INCLUDE |
| 75 | |
| 76 | #ifndef TRACE_INCLUDE_FILE |
| 77 | # define TRACE_INCLUDE_FILE TRACE_SYSTEM |
| 78 | # define UNDEF_TRACE_INCLUDE_FILE |
| 79 | #endif |
| 80 | |
| 81 | #ifndef TRACE_INCLUDE_PATH |
| 82 | # define __TRACE_INCLUDE(system) <trace/events/system.h> |
| 83 | # define UNDEF_TRACE_INCLUDE_PATH |
| 84 | #else |
| 85 | # define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h) |
| 86 | #endif |
| 87 | |
| 88 | # define TRACE_INCLUDE(system) __TRACE_INCLUDE(system) |
| 89 | |
| 90 | /* Let the trace headers be reread */ |
| 91 | #define TRACE_HEADER_MULTI_READ |
| 92 | |
| 93 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 94 | |
| 95 | /* Make all open coded DECLARE_TRACE nops */ |
| 96 | #undef DECLARE_TRACE |
| 97 | #define DECLARE_TRACE(name, proto, args) |
| 98 | |
| 99 | #ifdef LTTNG_PACKAGE_BUILD |
| 100 | #include <probes/lttng-tracepoint-event-impl.h> |
| 101 | #endif |
| 102 | |
| 103 | #undef LTTNG_TRACEPOINT_EVENT |
| 104 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE |
| 105 | #undef LTTNG_TRACEPOINT_EVENT_MAP |
| 106 | #undef LTTNG_TRACEPOINT_EVENT_CLASS |
| 107 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP |
| 108 | #undef LTTNG_TRACEPOINT_EVENT_CODE_MAP |
| 109 | #undef LTTNG_TRACEPOINT_EVENT_CODE |
| 110 | #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS |
| 111 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS |
| 112 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS |
| 113 | #undef TRACE_HEADER_MULTI_READ |
| 114 | |
| 115 | /* Only undef what we defined in this file */ |
| 116 | #ifdef UNDEF_TRACE_INCLUDE_FILE |
| 117 | # undef TRACE_INCLUDE_FILE |
| 118 | # undef UNDEF_TRACE_INCLUDE_FILE |
| 119 | #endif |
| 120 | |
| 121 | #ifdef UNDEF_TRACE_INCLUDE_PATH |
| 122 | # undef TRACE_INCLUDE_PATH |
| 123 | # undef UNDEF_TRACE_INCLUDE_PATH |
| 124 | #endif |
| 125 | |
| 126 | /* |
| 127 | * We want to re-include lttng-tracepoint-event.h for a following probe. |
| 128 | */ |
| 129 | #undef LTTNG_TRACEPOINT_EVENT_H |
| 130 | |
| 131 | /* We may be processing more files */ |
| 132 | #define CREATE_TRACE_POINTS |
| 133 | |
| 134 | #endif /* CREATE_TRACE_POINTS */ |