Update licensing info
[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>
5 * Copyright (C) 2010-2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 *
7 * Dual LGPL v2.1/GPL v2 license.
8 */
9
f62b389e
MD
10/*
11 * Trace files that want to automate creationg of all tracepoints defined
12 * in their file should include this file. The following are macros that the
13 * trace file may define:
14 *
15 * TRACE_SYSTEM defines the system the tracepoint is for
16 *
17 * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
18 * This macro may be defined to tell define_trace.h what file to include.
19 * Note, leave off the ".h".
20 *
21 * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
22 * then this macro can define the path to use. Note, the path is relative to
23 * define_trace.h, not the file including it. Full path names for out of tree
24 * modules must be used.
25 */
26
27#ifdef CREATE_TRACE_POINTS
28
29/* Prevent recursion */
30#undef CREATE_TRACE_POINTS
31
32#include <linux/stringify.h>
33/*
34 * module.h includes tracepoints, and because ftrace.h
35 * pulls in module.h:
36 * trace/ftrace.h -> linux/ftrace_event.h -> linux/perf_event.h ->
37 * linux/ftrace.h -> linux/module.h
38 * we must include module.h here before we play with any of
39 * the TRACE_EVENT() macros, otherwise the tracepoints included
40 * by module.h may break the build.
41 */
42#include <linux/module.h>
43
44#undef TRACE_EVENT
45#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
46 DEFINE_TRACE(name)
47
48#undef TRACE_EVENT_CONDITION
49#define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
50 TRACE_EVENT(name, \
51 PARAMS(proto), \
52 PARAMS(args), \
53 PARAMS(tstruct), \
54 PARAMS(assign), \
55 PARAMS(print))
56
57#undef TRACE_EVENT_FN
58#define TRACE_EVENT_FN(name, proto, args, tstruct, \
59 assign, print, reg, unreg) \
60 DEFINE_TRACE_FN(name, reg, unreg)
61
62#undef DEFINE_EVENT
63#define DEFINE_EVENT(template, name, proto, args) \
64 DEFINE_TRACE(name)
65
66#undef DEFINE_EVENT_PRINT
67#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
68 DEFINE_TRACE(name)
69
70#undef DEFINE_EVENT_CONDITION
71#define DEFINE_EVENT_CONDITION(template, name, proto, args, cond) \
72 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
73
74#undef DECLARE_TRACE
75#define DECLARE_TRACE(name, proto, args) \
76 DEFINE_TRACE(name)
77
78#undef TRACE_INCLUDE
79#undef __TRACE_INCLUDE
80
81#ifndef TRACE_INCLUDE_FILE
82# define TRACE_INCLUDE_FILE TRACE_SYSTEM
83# define UNDEF_TRACE_INCLUDE_FILE
84#endif
85
86#ifndef TRACE_INCLUDE_PATH
87# define __TRACE_INCLUDE(system) <trace/events/system.h>
88# define UNDEF_TRACE_INCLUDE_PATH
89#else
90# define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
91#endif
92
93# define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
94
95/* Let the trace headers be reread */
96#define TRACE_HEADER_MULTI_READ
97
98#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
99
100/* Make all open coded DECLARE_TRACE nops */
101#undef DECLARE_TRACE
102#define DECLARE_TRACE(name, proto, args)
103
104#ifdef LTTNG_PACKAGE_BUILD
105#include "lttng-events.h"
106#endif
107
108#undef TRACE_EVENT
109#undef TRACE_EVENT_FN
110#undef TRACE_EVENT_CONDITION
111#undef DECLARE_EVENT_CLASS
112#undef DEFINE_EVENT
113#undef DEFINE_EVENT_PRINT
114#undef DEFINE_EVENT_CONDITION
115#undef TRACE_HEADER_MULTI_READ
116#undef DECLARE_TRACE
117
118/* Only undef what we defined in this file */
119#ifdef UNDEF_TRACE_INCLUDE_FILE
120# undef TRACE_INCLUDE_FILE
121# undef UNDEF_TRACE_INCLUDE_FILE
122#endif
123
124#ifdef UNDEF_TRACE_INCLUDE_PATH
125# undef TRACE_INCLUDE_PATH
126# undef UNDEF_TRACE_INCLUDE_PATH
127#endif
128
129/* We may be processing more files */
130#define CREATE_TRACE_POINTS
131
132#endif /* CREATE_TRACE_POINTS */
This page took 0.027094 seconds and 4 git commands to generate.