Tracepoints: Introduce DEFINE/DECLARE_TRACEPOINT, TRACEPOINT_EVENT...
[ust.git] / include / ust / define_trace.h
CommitLineData
22d72948
NC
1/*
2 * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
f37142a4
MD
6 * License as published by the Free Software Foundation;
7 * version 2.1 of the License.
22d72948
NC
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 *
19 * Trace files that want to automate creationg of all tracepoints defined
20 * in their file should include this file. The following are macros that the
21 * trace file may define:
22 *
23 * TRACE_SYSTEM defines the system the tracepoint is for
24 *
25 * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
26 * This macro may be defined to tell define_trace.h what file to include.
27 * Note, leave off the ".h".
28 *
29 * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
30 * then this macro can define the path to use. Note, the path is relative to
31 * define_trace.h, not the file including it. Full path names for out of tree
32 * modules must be used.
33 */
34
8d71973c 35#ifdef TRACEPOINT_CREATE_PROBES
22d72948
NC
36
37/* Prevent recursion */
8d71973c 38#undef TRACEPOINT_CREATE_PROBES
22d72948
NC
39
40#include <ust/kcompat/stringify.h>
41
8d71973c
MD
42#undef TRACEPOINT_EVENT
43#define TRACEPOINT_EVENT(name, proto, args, tstruct, assign, print) \
44 DEFINE_TRACEPOINT(name)
22d72948 45
8d71973c
MD
46#undef TRACEPOINT_EVENT_FN
47#define TRACEPOINT_EVENT_FN(name, proto, args, tstruct, \
22d72948 48 assign, print, reg, unreg) \
8d71973c 49 DEFINE_TRACEPOINT_FN(name, reg, unreg)
22d72948 50
8d71973c
MD
51#undef DEFINE_TRACEPOINT_EVENT
52#define DEFINE_TRACEPOINT_EVENT(template, name, proto, args) \
53 DEFINE_TRACEPOINT(name)
22d72948 54
8d71973c
MD
55#undef DEFINE_TRACEPOINT_EVENT_PRINT
56#define DEFINE_TRACEPOINT_EVENT_PRINT(template, name, proto, args, print) \
57 DEFINE_TRACEPOINT(name)
22d72948 58
8d71973c
MD
59#undef DECLARE_TRACEPOINT
60#define DECLARE_TRACEPOINT(name, proto, args) \
61 DEFINE_TRACEPOINT(name)
22d72948
NC
62
63#undef TRACE_INCLUDE
64#undef __TRACE_INCLUDE
65
66#ifndef TRACE_INCLUDE_FILE
67# define TRACE_INCLUDE_FILE TRACE_SYSTEM
68# define UNDEF_TRACE_INCLUDE_FILE
69#endif
70
71#ifndef TRACE_INCLUDE_PATH
72# define __TRACE_INCLUDE(system) <trace/events/system.h>
73# define UNDEF_TRACE_INCLUDE_PATH
74#else
75# define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
76#endif
77
78# define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
79
80/* Let the trace headers be reread */
81#define TRACE_HEADER_MULTI_READ
82
83#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
84
8d71973c
MD
85/* Make all open coded DECLARE_TRACEPOINT nops */
86#undef DECLARE_TRACEPOINT
87#define DECLARE_TRACEPOINT(name, proto, args)
22d72948
NC
88
89#ifndef CONFIG_NO_EVENT_TRACING
90#include <ust/ust_trace.h>
91#endif
92
8d71973c
MD
93#undef TRACEPOINT_EVENT
94#undef TRACEPOINT_EVENT_FN
95#undef DECLARE_TRACEPOINT_EVENT_CLASS
96#undef DEFINE_TRACEPOINT_EVENT
97#undef DEFINE_TRACEPOINT_EVENT_PRINT
22d72948 98#undef TRACE_HEADER_MULTI_READ
8d71973c 99#undef DECLARE_TRACEPOINT
22d72948
NC
100
101/* Only undef what we defined in this file */
102#ifdef UNDEF_TRACE_INCLUDE_FILE
103# undef TRACE_INCLUDE_FILE
104# undef UNDEF_TRACE_INCLUDE_FILE
105#endif
106
107#ifdef UNDEF_TRACE_INCLUDE_PATH
108# undef TRACE_INCLUDE_PATH
109# undef UNDEF_TRACE_INCLUDE_PATH
110#endif
111
112/* We may be processing more files */
8d71973c 113#define TRACEPOINT_CREATE_PROBES
22d72948 114
8d71973c 115#endif /* TRACEPOINT_CREATE_PROBES */
This page took 0.03165 seconds and 4 git commands to generate.