blob: 00723935dcc7bdba5b960edaf00f3283f7c0c56d [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) \
Steven Rostedt (VMware)d25e37d2020-08-18 15:57:52 +020028 DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
Steven Rostedta8d154b2009-04-10 09:36:00 -040029
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) \
Steven Rostedt (VMware)d25e37d2020-08-18 15:57:52 +020042 DEFINE_TRACE_FN(name, reg, unreg, PARAMS(proto), PARAMS(args))
Josh Stone97419872009-08-24 14:43:13 -070043
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) \
Steven Rostedt (VMware)d25e37d2020-08-18 15:57:52 +020047 DEFINE_TRACE_FN(name, reg, unreg, PARAMS(proto), PARAMS(args))
Denis Kirjanov27011212015-12-14 23:18:05 +030048
Yafang Shao16336342019-03-26 20:13:09 +080049#undef TRACE_EVENT_NOP
50#define TRACE_EVENT_NOP(name, proto, args, struct, assign, print)
51
52#undef DEFINE_EVENT_NOP
53#define DEFINE_EVENT_NOP(template, name, proto, args)
54
Steven Rostedtff038f52009-11-18 20:27:27 -050055#undef DEFINE_EVENT
56#define DEFINE_EVENT(template, name, proto, args) \
Steven Rostedt (VMware)d25e37d2020-08-18 15:57:52 +020057 DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
Steven Rostedtff038f52009-11-18 20:27:27 -050058
Steven Rostedtf5abaa12013-06-20 11:44:44 -040059#undef DEFINE_EVENT_FN
60#define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
Steven Rostedt (VMware)d25e37d2020-08-18 15:57:52 +020061 DEFINE_TRACE_FN(name, reg, unreg, PARAMS(proto), PARAMS(args))
Steven Rostedtf5abaa12013-06-20 11:44:44 -040062
Steven Rostedte5bc9722009-11-18 20:36:26 -050063#undef DEFINE_EVENT_PRINT
64#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
Steven Rostedt (VMware)d25e37d2020-08-18 15:57:52 +020065 DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
Steven Rostedte5bc9722009-11-18 20:36:26 -050066
Steven Rostedt287050d2010-12-02 16:46:18 -050067#undef DEFINE_EVENT_CONDITION
68#define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
69 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
70
Steven Rostedta8d154b2009-04-10 09:36:00 -040071#undef DECLARE_TRACE
72#define DECLARE_TRACE(name, proto, args) \
Steven Rostedt (VMware)d25e37d2020-08-18 15:57:52 +020073 DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
Steven Rostedta8d154b2009-04-10 09:36:00 -040074
75#undef TRACE_INCLUDE
76#undef __TRACE_INCLUDE
77
78#ifndef TRACE_INCLUDE_FILE
79# define TRACE_INCLUDE_FILE TRACE_SYSTEM
80# define UNDEF_TRACE_INCLUDE_FILE
81#endif
82
83#ifndef TRACE_INCLUDE_PATH
Steven Rostedtad8d75f2009-04-14 19:39:12 -040084# define __TRACE_INCLUDE(system) <trace/events/system.h>
Steven Rostedtc2518c42009-04-23 23:26:18 -040085# define UNDEF_TRACE_INCLUDE_PATH
Steven Rostedta8d154b2009-04-10 09:36:00 -040086#else
87# define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
88#endif
89
90# define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
91
92/* Let the trace headers be reread */
93#define TRACE_HEADER_MULTI_READ
94
95#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
96
Steven Rostedt2e26ca72010-05-05 10:52:31 -040097/* Make all open coded DECLARE_TRACE nops */
98#undef DECLARE_TRACE
99#define DECLARE_TRACE(name, proto, args)
100
Tal Shorerc63b7682015-08-01 15:27:57 +0300101#ifdef TRACEPOINTS_ENABLED
Steven Rostedt (Red Hat)2167ae72015-04-29 09:57:36 -0400102#include <trace/trace_events.h>
Steven Rostedt (Red Hat)ee53bbd2015-04-29 13:11:00 -0400103#include <trace/perf.h>
Alexei Starovoitovc4f66992018-03-28 12:05:37 -0700104#include <trace/bpf_probe.h>
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400105#endif
106
Xiao Guangrong5ac35da2009-08-25 14:06:22 +0800107#undef TRACE_EVENT
Frederic Weisbecker6c347d42009-08-27 18:17:34 +0200108#undef TRACE_EVENT_FN
Denis Kirjanov27011212015-12-14 23:18:05 +0300109#undef TRACE_EVENT_FN_COND
Steven Rostedt287050d2010-12-02 16:46:18 -0500110#undef TRACE_EVENT_CONDITION
Yafang Shao16336342019-03-26 20:13:09 +0800111#undef TRACE_EVENT_NOP
112#undef DEFINE_EVENT_NOP
Ingo Molnar091ad362009-11-26 09:04:55 +0100113#undef DECLARE_EVENT_CLASS
Steven Rostedtff038f52009-11-18 20:27:27 -0500114#undef DEFINE_EVENT
Steven Rostedtf5abaa12013-06-20 11:44:44 -0400115#undef DEFINE_EVENT_FN
Steven Rostedte5bc9722009-11-18 20:36:26 -0500116#undef DEFINE_EVENT_PRINT
Steven Rostedt287050d2010-12-02 16:46:18 -0500117#undef DEFINE_EVENT_CONDITION
Steven Rostedta8d154b2009-04-10 09:36:00 -0400118#undef TRACE_HEADER_MULTI_READ
Steven Rostedt2e26ca72010-05-05 10:52:31 -0400119#undef DECLARE_TRACE
Steven Rostedta8d154b2009-04-10 09:36:00 -0400120
121/* Only undef what we defined in this file */
122#ifdef UNDEF_TRACE_INCLUDE_FILE
Steven Rostedtc2518c42009-04-23 23:26:18 -0400123# undef TRACE_INCLUDE_FILE
Steven Rostedta8d154b2009-04-10 09:36:00 -0400124# undef UNDEF_TRACE_INCLUDE_FILE
125#endif
126
Steven Rostedtc2518c42009-04-23 23:26:18 -0400127#ifdef UNDEF_TRACE_INCLUDE_PATH
Steven Rostedta8d154b2009-04-10 09:36:00 -0400128# undef TRACE_INCLUDE_PATH
Steven Rostedtc2518c42009-04-23 23:26:18 -0400129# undef UNDEF_TRACE_INCLUDE_PATH
Steven Rostedta8d154b2009-04-10 09:36:00 -0400130#endif
131
132/* We may be processing more files */
133#define CREATE_TRACE_POINTS
134
135#endif /* CREATE_TRACE_POINTS */