Commit | Line | Data |
---|---|---|
9f36eaed MJ |
1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
2 | * | |
17baffe2 MD |
3 | * define_trace.h |
4 | * | |
5 | * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org> | |
886d51a3 | 6 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
17baffe2 MD |
7 | */ |
8 | ||
f62b389e MD |
9 | /* |
10 | * Trace files that want to automate creationg of all tracepoints defined | |
11 | * in their file should include this file. The following are macros that the | |
12 | * trace file may define: | |
13 | * | |
14 | * TRACE_SYSTEM defines the system the tracepoint is for | |
15 | * | |
16 | * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h | |
17 | * This macro may be defined to tell define_trace.h what file to include. | |
18 | * Note, leave off the ".h". | |
19 | * | |
20 | * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace | |
21 | * then this macro can define the path to use. Note, the path is relative to | |
22 | * define_trace.h, not the file including it. Full path names for out of tree | |
23 | * modules must be used. | |
24 | */ | |
25 | ||
26 | #ifdef CREATE_TRACE_POINTS | |
27 | ||
28 | /* Prevent recursion */ | |
29 | #undef CREATE_TRACE_POINTS | |
30 | ||
31 | #include <linux/stringify.h> | |
f62b389e | 32 | |
3bc29f0a | 33 | #undef LTTNG_TRACEPOINT_EVENT_MAP |
f127e61e | 34 | #define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, fields) |
3bc29f0a MD |
35 | |
36 | #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS | |
f127e61e | 37 | #define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, fields) |
76e4f017 | 38 | |
3bc29f0a MD |
39 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP |
40 | #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(template, name, map, proto, args) | |
76e4f017 | 41 | |
3bc29f0a | 42 | #undef LTTNG_TRACEPOINT_EVENT |
f127e61e | 43 | #define LTTNG_TRACEPOINT_EVENT(name, proto, args, fields) |
f62b389e | 44 | |
3bc29f0a | 45 | #undef LTTNG_TRACEPOINT_EVENT_CODE |
265822ae | 46 | #define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code_pre, fields, _code_post) |
7ca580f8 | 47 | |
f127e61e | 48 | #undef LTTNG_TRACEPOINT_EVENT_CODE_MAP |
265822ae | 49 | #define LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, map, proto, args, _locvar, _code_pre, fields, _code_post) |
f62b389e | 50 | |
3bc29f0a MD |
51 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE |
52 | #define LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) | |
f62b389e | 53 | |
3bc29f0a MD |
54 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS |
55 | #define LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name) | |
f62b389e | 56 | |
3bc29f0a MD |
57 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS |
58 | #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(template, name, map) | |
f62b389e | 59 | |
f62b389e MD |
60 | #undef TRACE_INCLUDE |
61 | #undef __TRACE_INCLUDE | |
62 | ||
63 | #ifndef TRACE_INCLUDE_FILE | |
64 | # define TRACE_INCLUDE_FILE TRACE_SYSTEM | |
65 | # define UNDEF_TRACE_INCLUDE_FILE | |
66 | #endif | |
67 | ||
68 | #ifndef TRACE_INCLUDE_PATH | |
69 | # define __TRACE_INCLUDE(system) <trace/events/system.h> | |
70 | # define UNDEF_TRACE_INCLUDE_PATH | |
71 | #else | |
72 | # define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h) | |
73 | #endif | |
74 | ||
75 | # define TRACE_INCLUDE(system) __TRACE_INCLUDE(system) | |
76 | ||
77 | /* Let the trace headers be reread */ | |
78 | #define TRACE_HEADER_MULTI_READ | |
79 | ||
80 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | |
81 | ||
82 | /* Make all open coded DECLARE_TRACE nops */ | |
83 | #undef DECLARE_TRACE | |
84 | #define DECLARE_TRACE(name, proto, args) | |
85 | ||
86 | #ifdef LTTNG_PACKAGE_BUILD | |
2def77ec | 87 | #include <probes/lttng-tracepoint-event-impl.h> |
f62b389e MD |
88 | #endif |
89 | ||
3bc29f0a | 90 | #undef LTTNG_TRACEPOINT_EVENT |
3bc29f0a | 91 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE |
3bc29f0a | 92 | #undef LTTNG_TRACEPOINT_EVENT_MAP |
3bc29f0a MD |
93 | #undef LTTNG_TRACEPOINT_EVENT_CLASS |
94 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP | |
f127e61e | 95 | #undef LTTNG_TRACEPOINT_EVENT_CODE_MAP |
3bc29f0a MD |
96 | #undef LTTNG_TRACEPOINT_EVENT_CODE |
97 | #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS | |
98 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS | |
99 | #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS | |
f62b389e | 100 | #undef TRACE_HEADER_MULTI_READ |
f62b389e MD |
101 | |
102 | /* Only undef what we defined in this file */ | |
103 | #ifdef UNDEF_TRACE_INCLUDE_FILE | |
104 | # undef TRACE_INCLUDE_FILE | |
105 | # undef UNDEF_TRACE_INCLUDE_FILE | |
106 | #endif | |
107 | ||
108 | #ifdef UNDEF_TRACE_INCLUDE_PATH | |
109 | # undef TRACE_INCLUDE_PATH | |
110 | # undef UNDEF_TRACE_INCLUDE_PATH | |
111 | #endif | |
112 | ||
3bc29f0a MD |
113 | /* |
114 | * We want to re-include lttng-tracepoint-event.h for a following probe. | |
115 | */ | |
116 | #undef LTTNG_TRACEPOINT_EVENT_H | |
117 | ||
f62b389e MD |
118 | /* We may be processing more files */ |
119 | #define CREATE_TRACE_POINTS | |
120 | ||
121 | #endif /* CREATE_TRACE_POINTS */ |