Commit | Line | Data |
---|---|---|
22d72948 NC |
1 | /* |
2 | * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com> | |
9edd34bd | 3 | * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
22d72948 NC |
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 | |
f37142a4 MD |
7 | * License as published by the Free Software Foundation; |
8 | * version 2.1 of the License. | |
22d72948 NC |
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 | * | |
a4ada9b8 | 24 | * TRACEPOINT_PROVIDER defines the provider the tracepoint is for: |
8d8a24c8 | 25 | * < [com_company_]project_[component_] > |
22d72948 | 26 | * |
8d8a24c8 | 27 | * TRACEPOINT_INCLUDE_FILE if the file name is something other than |
a4ada9b8 | 28 | * TRACEPOINT_PROVIDER.h. This macro may be defined to tell |
8d8a24c8 | 29 | * define_trace.h what file to include. Note, leave off the ".h". |
22d72948 | 30 | * |
9b22dc6b MD |
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. | |
22d72948 NC |
38 | */ |
39 | ||
4737566d MD |
40 | #ifdef __cplusplus |
41 | extern "C" { | |
42 | #endif | |
43 | ||
8d71973c | 44 | #ifdef TRACEPOINT_CREATE_PROBES |
22d72948 NC |
45 | |
46 | /* Prevent recursion */ | |
8d71973c | 47 | #undef TRACEPOINT_CREATE_PROBES |
22d72948 | 48 | |
3c82ede9 MD |
49 | #ifndef __tp_stringify |
50 | #define __tp_stringify_1(x...) #x | |
51 | #define __tp_stringify(x...) __tp_stringify_1(x) | |
52 | #endif | |
22d72948 | 53 | |
8d71973c | 54 | #undef TRACEPOINT_EVENT |
63ef2693 | 55 | #define TRACEPOINT_EVENT(provider, name, args, fields) \ |
7083f0fe | 56 | _DEFINE_TRACEPOINT(provider, name) |
22d72948 | 57 | |
81614639 | 58 | #undef TRACEPOINT_EVENT_INSTANCE |
63ef2693 | 59 | #define TRACEPOINT_EVENT_INSTANCE(provider, template, name, args) \ |
7083f0fe | 60 | _DEFINE_TRACEPOINT(provider, name) |
22d72948 | 61 | |
8d8a24c8 MD |
62 | #undef TRACEPOINT_INCLUDE |
63 | #undef __TRACEPOINT_INCLUDE | |
22d72948 | 64 | |
8d8a24c8 | 65 | #ifndef TRACEPOINT_INCLUDE_FILE |
a4ada9b8 | 66 | # define TRACEPOINT_INCLUDE_FILE TRACEPOINT_PROVIDER |
8d8a24c8 | 67 | # define UNDEF_TRACEPOINT_INCLUDE_FILE |
22d72948 NC |
68 | #endif |
69 | ||
8d8a24c8 | 70 | #ifndef TRACEPOINT_INCLUDE_PATH |
a4ada9b8 | 71 | # define __TRACEPOINT_INCLUDE(provider) <tracepoint/provider.h> |
8d8a24c8 | 72 | # define UNDEF_TRACEPOINT_INCLUDE_PATH |
22d72948 | 73 | #else |
a4ada9b8 MD |
74 | # define __TRACEPOINT_INCLUDE(provider) \ |
75 | __tp_stringify(TRACEPOINT_INCLUDE_PATH/provider.h) | |
22d72948 NC |
76 | #endif |
77 | ||
a4ada9b8 | 78 | # define TRACEPOINT_INCLUDE(provider) __TRACEPOINT_INCLUDE(provider) |
22d72948 NC |
79 | |
80 | /* Let the trace headers be reread */ | |
8d8a24c8 | 81 | #define TRACEPOINT_HEADER_MULTI_READ |
22d72948 | 82 | |
8d8a24c8 | 83 | #include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) |
22d72948 | 84 | |
4318ae1b | 85 | #include <lttng/ust-tracepoint-event.h> |
22d72948 | 86 | |
8d71973c | 87 | #undef TRACEPOINT_EVENT |
81614639 MD |
88 | #undef TRACEPOINT_EVENT_CLASS |
89 | #undef TRACEPOINT_EVENT_INSTANCE | |
8d8a24c8 | 90 | #undef TRACEPOINT_HEADER_MULTI_READ |
22d72948 NC |
91 | |
92 | /* Only undef what we defined in this file */ | |
8d8a24c8 MD |
93 | #ifdef UNDEF_TRACEPOINT_INCLUDE_FILE |
94 | # undef TRACEPOINT_INCLUDE_FILE | |
95 | # undef UNDEF_TRACEPOINT_INCLUDE_FILE | |
22d72948 NC |
96 | #endif |
97 | ||
8d8a24c8 MD |
98 | #ifdef UNDEF_TRACEPOINT_INCLUDE_PATH |
99 | # undef TRACEPOINT_INCLUDE_PATH | |
100 | # undef UNDEF_TRACEPOINT_INCLUDE_PATH | |
22d72948 NC |
101 | #endif |
102 | ||
103 | /* We may be processing more files */ | |
8d71973c | 104 | #define TRACEPOINT_CREATE_PROBES |
22d72948 | 105 | |
8d71973c | 106 | #endif /* TRACEPOINT_CREATE_PROBES */ |
4737566d MD |
107 | |
108 | #ifdef __cplusplus | |
109 | } | |
110 | #endif |