Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Trace files that want to automate creation of all tracepoints defined
0004  * in their file should include this file. The following are macros that the
0005  * trace file may define:
0006  *
0007  * TRACE_SYSTEM defines the system the tracepoint is for
0008  *
0009  * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
0010  *     This macro may be defined to tell define_trace.h what file to include.
0011  *     Note, leave off the ".h".
0012  *
0013  * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
0014  *     then this macro can define the path to use. Note, the path is relative to
0015  *     define_trace.h, not the file including it. Full path names for out of tree
0016  *     modules must be used.
0017  */
0018 
0019 #ifdef CREATE_TRACE_POINTS
0020 
0021 /* Prevent recursion */
0022 #undef CREATE_TRACE_POINTS
0023 
0024 #include <linux/stringify.h>
0025 
0026 #undef TRACE_EVENT
0027 #define TRACE_EVENT(name, proto, args, tstruct, assign, print)  \
0028     DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
0029 
0030 #undef TRACE_EVENT_CONDITION
0031 #define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
0032     TRACE_EVENT(name,                       \
0033         PARAMS(proto),                      \
0034         PARAMS(args),                       \
0035         PARAMS(tstruct),                    \
0036         PARAMS(assign),                     \
0037         PARAMS(print))
0038 
0039 #undef TRACE_EVENT_FN
0040 #define TRACE_EVENT_FN(name, proto, args, tstruct,      \
0041         assign, print, reg, unreg)          \
0042     DEFINE_TRACE_FN(name, reg, unreg, PARAMS(proto), PARAMS(args))
0043 
0044 #undef TRACE_EVENT_FN_COND
0045 #define TRACE_EVENT_FN_COND(name, proto, args, cond, tstruct,       \
0046         assign, print, reg, unreg)          \
0047     DEFINE_TRACE_FN(name, reg, unreg, PARAMS(proto), PARAMS(args))
0048 
0049 #undef TRACE_EVENT_NOP
0050 #define TRACE_EVENT_NOP(name, proto, args, struct, assign, print)
0051 
0052 #undef DEFINE_EVENT_NOP
0053 #define DEFINE_EVENT_NOP(template, name, proto, args)
0054 
0055 #undef DEFINE_EVENT
0056 #define DEFINE_EVENT(template, name, proto, args) \
0057     DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
0058 
0059 #undef DEFINE_EVENT_FN
0060 #define DEFINE_EVENT_FN(template, name, proto, args, reg, unreg) \
0061     DEFINE_TRACE_FN(name, reg, unreg, PARAMS(proto), PARAMS(args))
0062 
0063 #undef DEFINE_EVENT_PRINT
0064 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)  \
0065     DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
0066 
0067 #undef DEFINE_EVENT_CONDITION
0068 #define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
0069     DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
0070 
0071 #undef DECLARE_TRACE
0072 #define DECLARE_TRACE(name, proto, args)    \
0073     DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
0074 
0075 #undef TRACE_INCLUDE
0076 #undef __TRACE_INCLUDE
0077 
0078 #ifndef TRACE_INCLUDE_FILE
0079 # define TRACE_INCLUDE_FILE TRACE_SYSTEM
0080 # define UNDEF_TRACE_INCLUDE_FILE
0081 #endif
0082 
0083 #ifndef TRACE_INCLUDE_PATH
0084 # define __TRACE_INCLUDE(system) <trace/events/system.h>
0085 # define UNDEF_TRACE_INCLUDE_PATH
0086 #else
0087 # define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
0088 #endif
0089 
0090 # define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
0091 
0092 /* Let the trace headers be reread */
0093 #define TRACE_HEADER_MULTI_READ
0094 
0095 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
0096 
0097 /* Make all open coded DECLARE_TRACE nops */
0098 #undef DECLARE_TRACE
0099 #define DECLARE_TRACE(name, proto, args)
0100 
0101 #ifdef TRACEPOINTS_ENABLED
0102 #include <trace/trace_events.h>
0103 #include <trace/perf.h>
0104 #include <trace/bpf_probe.h>
0105 #endif
0106 
0107 #undef TRACE_EVENT
0108 #undef TRACE_EVENT_FN
0109 #undef TRACE_EVENT_FN_COND
0110 #undef TRACE_EVENT_CONDITION
0111 #undef TRACE_EVENT_NOP
0112 #undef DEFINE_EVENT_NOP
0113 #undef DECLARE_EVENT_CLASS
0114 #undef DEFINE_EVENT
0115 #undef DEFINE_EVENT_FN
0116 #undef DEFINE_EVENT_PRINT
0117 #undef DEFINE_EVENT_CONDITION
0118 #undef TRACE_HEADER_MULTI_READ
0119 #undef DECLARE_TRACE
0120 
0121 /* Only undef what we defined in this file */
0122 #ifdef UNDEF_TRACE_INCLUDE_FILE
0123 # undef TRACE_INCLUDE_FILE
0124 # undef UNDEF_TRACE_INCLUDE_FILE
0125 #endif
0126 
0127 #ifdef UNDEF_TRACE_INCLUDE_PATH
0128 # undef TRACE_INCLUDE_PATH
0129 # undef UNDEF_TRACE_INCLUDE_PATH
0130 #endif
0131 
0132 /* We may be processing more files */
0133 #define CREATE_TRACE_POINTS
0134 
0135 #endif /* CREATE_TRACE_POINTS */