Adapt to 3.15 tracepoint API
[lttng-modules.git] / probes / define_trace.h
CommitLineData
17baffe2
MD
1/*
2 * define_trace.h
3 *
4 * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org>
886d51a3 5 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
17baffe2 6 *
886d51a3
MD
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
17baffe2
MD
20 */
21
f62b389e
MD
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 * module.h includes tracepoints, and because ftrace.h
47 * pulls in module.h:
48 * trace/ftrace.h -> linux/ftrace_event.h -> linux/perf_event.h ->
49 * linux/ftrace.h -> linux/module.h
50 * we must include module.h here before we play with any of
51 * the TRACE_EVENT() macros, otherwise the tracepoints included
52 * by module.h may break the build.
53 */
54#include <linux/module.h>
55
76e4f017 56#undef TRACE_EVENT_MAP
20591cf7 57#define TRACE_EVENT_MAP(name, map, proto, args, tstruct, assign, print)
76e4f017
MD
58
59#undef TRACE_EVENT_CONDITION_MAP
60#define TRACE_EVENT_CONDITION_MAP(name, map, proto, args, cond, tstruct, assign, print) \
61 TRACE_EVENT(name, \
62 PARAMS(proto), \
63 PARAMS(args), \
64 PARAMS(tstruct), \
65 PARAMS(assign), \
66 PARAMS(print))
67
68#undef TRACE_EVENT_FN_MAP
69#define TRACE_EVENT_FN_MAP(name, map, proto, args, tstruct, \
20591cf7 70 assign, print, reg, unreg)
76e4f017
MD
71
72#undef DEFINE_EVENT_MAP
20591cf7 73#define DEFINE_EVENT_MAP(template, name, map, proto, args)
76e4f017
MD
74
75#undef DEFINE_EVENT_PRINT_MAP
20591cf7 76#define DEFINE_EVENT_PRINT_MAP(template, name, map, proto, args, print)
76e4f017
MD
77
78#undef DEFINE_EVENT_CONDITION_MAP
79#define DEFINE_EVENT_CONDITION_MAP(template, name, map, proto, args, cond) \
80 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
81
82
f62b389e 83#undef TRACE_EVENT
20591cf7 84#define TRACE_EVENT(name, proto, args, tstruct, assign, print)
f62b389e
MD
85
86#undef TRACE_EVENT_CONDITION
87#define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
88 TRACE_EVENT(name, \
89 PARAMS(proto), \
90 PARAMS(args), \
91 PARAMS(tstruct), \
92 PARAMS(assign), \
93 PARAMS(print))
94
95#undef TRACE_EVENT_FN
96#define TRACE_EVENT_FN(name, proto, args, tstruct, \
20591cf7 97 assign, print, reg, unreg)
f62b389e
MD
98
99#undef DEFINE_EVENT
20591cf7 100#define DEFINE_EVENT(template, name, proto, args)
f62b389e
MD
101
102#undef DEFINE_EVENT_PRINT
20591cf7 103#define DEFINE_EVENT_PRINT(template, name, proto, args, print)
f62b389e
MD
104
105#undef DEFINE_EVENT_CONDITION
106#define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
107 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
108
109#undef DECLARE_TRACE
20591cf7 110#define DECLARE_TRACE(name, proto, args)
f62b389e
MD
111
112#undef TRACE_INCLUDE
113#undef __TRACE_INCLUDE
114
115#ifndef TRACE_INCLUDE_FILE
116# define TRACE_INCLUDE_FILE TRACE_SYSTEM
117# define UNDEF_TRACE_INCLUDE_FILE
118#endif
119
120#ifndef TRACE_INCLUDE_PATH
121# define __TRACE_INCLUDE(system) <trace/events/system.h>
122# define UNDEF_TRACE_INCLUDE_PATH
123#else
124# define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
125#endif
126
127# define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
128
129/* Let the trace headers be reread */
130#define TRACE_HEADER_MULTI_READ
131
132#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
133
134/* Make all open coded DECLARE_TRACE nops */
135#undef DECLARE_TRACE
136#define DECLARE_TRACE(name, proto, args)
137
138#ifdef LTTNG_PACKAGE_BUILD
139#include "lttng-events.h"
140#endif
141
142#undef TRACE_EVENT
143#undef TRACE_EVENT_FN
144#undef TRACE_EVENT_CONDITION
f62b389e
MD
145#undef DEFINE_EVENT
146#undef DEFINE_EVENT_PRINT
147#undef DEFINE_EVENT_CONDITION
76e4f017
MD
148#undef TRACE_EVENT_MAP
149#undef TRACE_EVENT_FN_MAP
150#undef TRACE_EVENT_CONDITION_MAP
151#undef DECLARE_EVENT_CLASS
152#undef DEFINE_EVENT_MAP
153#undef DEFINE_EVENT_PRINT_MAP
154#undef DEFINE_EVENT_CONDITION_MAP
f62b389e 155#undef TRACE_HEADER_MULTI_READ
f62b389e
MD
156
157/* Only undef what we defined in this file */
158#ifdef UNDEF_TRACE_INCLUDE_FILE
159# undef TRACE_INCLUDE_FILE
160# undef UNDEF_TRACE_INCLUDE_FILE
161#endif
162
163#ifdef UNDEF_TRACE_INCLUDE_PATH
164# undef TRACE_INCLUDE_PATH
165# undef UNDEF_TRACE_INCLUDE_PATH
166#endif
167
168/* We may be processing more files */
169#define CREATE_TRACE_POINTS
170
171#endif /* CREATE_TRACE_POINTS */
This page took 0.032894 seconds and 4 git commands to generate.