Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tracing: Allow disabling compilation of specific trace systems

Allow a trace events header file to disable compilation of its
trace events by defining the preprocessor macro NOTRACE.

This could be done, for example, according to a Kconfig option.

Link: http://lkml.kernel.org/r/1438432079-11704-3-git-send-email-tal.shorer@gmail.com

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Tal Shorer and committed by
Steven Rostedt
c63b7682 b86d9371

+15 -4
+14 -3
include/linux/tracepoint.h
··· 111 111 #define TP_ARGS(args...) args 112 112 #define TP_CONDITION(args...) args 113 113 114 - #ifdef CONFIG_TRACEPOINTS 114 + /* 115 + * Individual subsystem my have a separate configuration to 116 + * enable their tracepoints. By default, this file will create 117 + * the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem 118 + * wants to be able to disable its tracepoints from being created 119 + * it can define NOTRACE before including the tracepoint headers. 120 + */ 121 + #if defined(CONFIG_TRACEPOINTS) && !defined(NOTRACE) 122 + #define TRACEPOINTS_ENABLED 123 + #endif 124 + 125 + #ifdef TRACEPOINTS_ENABLED 115 126 116 127 /* 117 128 * it_func[0] is never NULL because there is at least one element in the array ··· 245 234 #define EXPORT_TRACEPOINT_SYMBOL(name) \ 246 235 EXPORT_SYMBOL(__tracepoint_##name) 247 236 248 - #else /* !CONFIG_TRACEPOINTS */ 237 + #else /* !TRACEPOINTS_ENABLED */ 249 238 #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \ 250 239 static inline void trace_##name(proto) \ 251 240 { } \ ··· 277 266 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) 278 267 #define EXPORT_TRACEPOINT_SYMBOL(name) 279 268 280 - #endif /* CONFIG_TRACEPOINTS */ 269 + #endif /* TRACEPOINTS_ENABLED */ 281 270 282 271 #ifdef CONFIG_TRACING 283 272 /**
+1 -1
include/trace/define_trace.h
··· 86 86 #undef DECLARE_TRACE 87 87 #define DECLARE_TRACE(name, proto, args) 88 88 89 - #ifdef CONFIG_EVENT_TRACING 89 + #ifdef TRACEPOINTS_ENABLED 90 90 #include <trace/trace_events.h> 91 91 #include <trace/perf.h> 92 92 #endif