blob: d9e3d4aa3f6e3bc6a9fabc50457f30c7bb5f667a [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Steven Rostedta8d154b2009-04-10 09:36:00 -04002/*
Anatol Pomozov4907cb72012-09-01 10:31:09 -07003 * Trace files that want to automate creation of all tracepoints defined
Steven Rostedta8d154b2009-04-10 09:36:00 -04004 * in their file should include this file. The following are macros that the
5 * trace file may define:
6 *
7 * TRACE_SYSTEM defines the system the tracepoint is for
8 *
9 * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
10 * This macro may be defined to tell define_trace.h what file to include.
11 * Note, leave off the ".h".
12 *
13 * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
14 * then this macro can define the path to use. Note, the path is relative to
15 * define_trace.h, not the file including it. Full path names for out of tree
16 * modules must be used.
17 */
18
19#ifdef CREATE_TRACE_POINTS
20
21/* Prevent recursion */
22#undef CREATE_TRACE_POINTS
23
24#include <linux/stringify.h>
25
26#undef TRACE_EVENT
27#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
28 DEFINE_TRACE(name)
29
Steven Rostedt287050d2010-12-02 16:46:18 -050030#undef TRACE_EVENT_CONDITION
31#define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
32 TRACE_EVENT(name, \
33 PARAMS(proto), \
34 PARAMS(args), \
35 PARAMS(tstruct), \
36 PARAMS(assign), \
37 PARAMS(print))
38
Josh Stone97419872009-08-24 14:43:13 -070039#undef TRACE_EVENT_FN
40#define TRACE_EVENT_FN(name, proto, args, tstruct, \
41 assign, print, reg, unreg) \
42 DEFINE_TRACE_FN(name, reg, unreg)
43
Denis Kirjanov27011212015-12-14 23:18:05 +030044#undef TRACE_EVENT_FN_COND
45#define TRACE_EVENT_FN_COND(name, proto, args, cond, tstruct, \
46 assign, print, reg, unreg) \
47 DEFINE_TRACE_FN(name, reg, unreg)
48
Steven Rostedtff038f52009-11-18 20:27:27 -050049#undef DEFINE_EVENT
50#define DEFINE_EVENT(template, name, proto, args) \
51 DEFINE_TRACE(name)
52
Steven Rostedtf5abaa12013-06-20 11:44:44 -040053#undef DEFINE_EVENT_FN
54#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
55 DEFINE_TRACE_FN(name, reg, unreg)
56
Steven Rostedte5bc9722009-11-18 20:36:26 -050057#undef DEFINE_EVENT_PRINT
58#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
59 DEFINE_TRACE(name)
60
Steven Rostedt287050d2010-12-02 16:46:18 -050061#undef DEFINE_EVENT_CONDITION
62#define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
63 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
64
Steven Rostedta8d154b2009-04-10 09:36:00 -040065#undef DECLARE_TRACE
66#define DECLARE_TRACE(name, proto, args) \
67 DEFINE_TRACE(name)
68
69#undef TRACE_INCLUDE
70#undef __TRACE_INCLUDE
71
72#ifndef TRACE_INCLUDE_FILE
73# define TRACE_INCLUDE_FILE TRACE_SYSTEM
74# define UNDEF_TRACE_INCLUDE_FILE
75#endif
76
77#ifndef TRACE_INCLUDE_PATH
Steven Rostedtad8d75f2009-04-14 19:39:12 -040078# define __TRACE_INCLUDE(system) <trace/events/system.h>
Steven Rostedtc2518c42009-04-23 23:26:18 -040079# define UNDEF_TRACE_INCLUDE_PATH
Steven Rostedta8d154b2009-04-10 09:36:00 -040080#else
81# define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
82#endif
83
84# define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
85
86/* Let the trace headers be reread */
87#define TRACE_HEADER_MULTI_READ
88
89#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
90
Steven Rostedt2e26ca72010-05-05 10:52:31 -040091/* Make all open coded DECLARE_TRACE nops */
92#undef DECLARE_TRACE
93#define DECLARE_TRACE(name, proto, args)
94
Tal Shorerc63b7682015-08-01 15:27:57 +030095#ifdef TRACEPOINTS_ENABLED
Steven Rostedt (Red Hat)2167ae72015-04-29 09:57:36 -040096#include <trace/trace_events.h>
Steven Rostedt (Red Hat)ee53bbd2015-04-29 13:11:00 -040097#include <trace/perf.h>
Steven Rostedtf42c85e2009-04-13 12:25:37 -040098#endif
99
Xiao Guangrong5ac35da2009-08-25 14:06:22 +0800100#undef TRACE_EVENT
Frederic Weisbecker6c347d42009-08-27 18:17:34 +0200101#undef TRACE_EVENT_FN
Denis Kirjanov27011212015-12-14 23:18:05 +0300102#undef TRACE_EVENT_FN_COND
Steven Rostedt287050d2010-12-02 16:46:18 -0500103#undef TRACE_EVENT_CONDITION
Ingo Molnar091ad362009-11-26 09:04:55 +0100104#undef DECLARE_EVENT_CLASS
Steven Rostedtff038f52009-11-18 20:27:27 -0500105#undef DEFINE_EVENT
Steven Rostedtf5abaa12013-06-20 11:44:44 -0400106#undef DEFINE_EVENT_FN
Steven Rostedte5bc9722009-11-18 20:36:26 -0500107#undef DEFINE_EVENT_PRINT
Steven Rostedt287050d2010-12-02 16:46:18 -0500108#undef DEFINE_EVENT_CONDITION
Steven Rostedta8d154b2009-04-10 09:36:00 -0400109#undef TRACE_HEADER_MULTI_READ
Steven Rostedt2e26ca72010-05-05 10:52:31 -0400110#undef DECLARE_TRACE
Steven Rostedta8d154b2009-04-10 09:36:00 -0400111
112/* Only undef what we defined in this file */
113#ifdef UNDEF_TRACE_INCLUDE_FILE
Steven Rostedtc2518c42009-04-23 23:26:18 -0400114# undef TRACE_INCLUDE_FILE
Steven Rostedta8d154b2009-04-10 09:36:00 -0400115# undef UNDEF_TRACE_INCLUDE_FILE
116#endif
117
Steven Rostedtc2518c42009-04-23 23:26:18 -0400118#ifdef UNDEF_TRACE_INCLUDE_PATH
Steven Rostedta8d154b2009-04-10 09:36:00 -0400119# undef TRACE_INCLUDE_PATH
Steven Rostedtc2518c42009-04-23 23:26:18 -0400120# undef UNDEF_TRACE_INCLUDE_PATH
Steven Rostedta8d154b2009-04-10 09:36:00 -0400121#endif
122
123/* We may be processing more files */
124#define CREATE_TRACE_POINTS
125
126#endif /* CREATE_TRACE_POINTS */