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. | |
1909f468 MD |
38 | * |
39 | * Note considering licensing: | |
40 | * | |
41 | * Including the tracepoint-event.h header without the | |
42 | * TRACEPOINT_CREATE_PROBES macro defined is fine within any application | |
43 | * source code, even for non-LGPL-compatible applications. | |
44 | * | |
45 | * However, TRACEPOINT_CREATE_PROBES should only be defined within | |
46 | * LGPL-compatible C files. This means that the tracepoint probe object | |
47 | * should be relinkable when distributed, either by providing it as a | |
48 | * dynamically linkable shared object (.so library), or by providing the | |
49 | * build scripts and object files required to relink the object if | |
50 | * statically linked. | |
22d72948 NC |
51 | */ |
52 | ||
4737566d MD |
53 | #ifdef __cplusplus |
54 | extern "C" { | |
55 | #endif | |
56 | ||
8d71973c | 57 | #ifdef TRACEPOINT_CREATE_PROBES |
22d72948 NC |
58 | |
59 | /* Prevent recursion */ | |
8d71973c | 60 | #undef TRACEPOINT_CREATE_PROBES |
22d72948 | 61 | |
3c82ede9 MD |
62 | #ifndef __tp_stringify |
63 | #define __tp_stringify_1(x...) #x | |
64 | #define __tp_stringify(x...) __tp_stringify_1(x) | |
65 | #endif | |
22d72948 | 66 | |
8d71973c | 67 | #undef TRACEPOINT_EVENT |
63ef2693 | 68 | #define TRACEPOINT_EVENT(provider, name, args, fields) \ |
7083f0fe | 69 | _DEFINE_TRACEPOINT(provider, name) |
22d72948 | 70 | |
81614639 | 71 | #undef TRACEPOINT_EVENT_INSTANCE |
63ef2693 | 72 | #define TRACEPOINT_EVENT_INSTANCE(provider, template, name, args) \ |
7083f0fe | 73 | _DEFINE_TRACEPOINT(provider, name) |
22d72948 | 74 | |
8d8a24c8 MD |
75 | #undef TRACEPOINT_INCLUDE |
76 | #undef __TRACEPOINT_INCLUDE | |
22d72948 | 77 | |
8d8a24c8 | 78 | #ifndef TRACEPOINT_INCLUDE_FILE |
a4ada9b8 | 79 | # define TRACEPOINT_INCLUDE_FILE TRACEPOINT_PROVIDER |
8d8a24c8 | 80 | # define UNDEF_TRACEPOINT_INCLUDE_FILE |
22d72948 NC |
81 | #endif |
82 | ||
8d8a24c8 | 83 | #ifndef TRACEPOINT_INCLUDE_PATH |
a4ada9b8 | 84 | # define __TRACEPOINT_INCLUDE(provider) <tracepoint/provider.h> |
8d8a24c8 | 85 | # define UNDEF_TRACEPOINT_INCLUDE_PATH |
22d72948 | 86 | #else |
a4ada9b8 MD |
87 | # define __TRACEPOINT_INCLUDE(provider) \ |
88 | __tp_stringify(TRACEPOINT_INCLUDE_PATH/provider.h) | |
22d72948 NC |
89 | #endif |
90 | ||
a4ada9b8 | 91 | # define TRACEPOINT_INCLUDE(provider) __TRACEPOINT_INCLUDE(provider) |
22d72948 NC |
92 | |
93 | /* Let the trace headers be reread */ | |
8d8a24c8 | 94 | #define TRACEPOINT_HEADER_MULTI_READ |
22d72948 | 95 | |
8d8a24c8 | 96 | #include TRACEPOINT_INCLUDE(TRACEPOINT_INCLUDE_FILE) |
22d72948 | 97 | |
4318ae1b | 98 | #include <lttng/ust-tracepoint-event.h> |
22d72948 | 99 | |
8d71973c | 100 | #undef TRACEPOINT_EVENT |
81614639 MD |
101 | #undef TRACEPOINT_EVENT_CLASS |
102 | #undef TRACEPOINT_EVENT_INSTANCE | |
8d8a24c8 | 103 | #undef TRACEPOINT_HEADER_MULTI_READ |
22d72948 NC |
104 | |
105 | /* Only undef what we defined in this file */ | |
8d8a24c8 MD |
106 | #ifdef UNDEF_TRACEPOINT_INCLUDE_FILE |
107 | # undef TRACEPOINT_INCLUDE_FILE | |
108 | # undef UNDEF_TRACEPOINT_INCLUDE_FILE | |
22d72948 NC |
109 | #endif |
110 | ||
8d8a24c8 MD |
111 | #ifdef UNDEF_TRACEPOINT_INCLUDE_PATH |
112 | # undef TRACEPOINT_INCLUDE_PATH | |
113 | # undef UNDEF_TRACEPOINT_INCLUDE_PATH | |
22d72948 NC |
114 | #endif |
115 | ||
116 | /* We may be processing more files */ | |
8d71973c | 117 | #define TRACEPOINT_CREATE_PROBES |
22d72948 | 118 | |
8d71973c | 119 | #endif /* TRACEPOINT_CREATE_PROBES */ |
4737566d MD |
120 | |
121 | #ifdef __cplusplus | |
122 | } | |
123 | #endif |