Tracepoint and TRACEPOINT_EVENT API cleanup
[ust.git] / include / ust / ust_trace.h
1 /*
2 * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com>
3 * Copyright (C) 2010 Nils Carlson <nils.carlson@ericsson.com>
4 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation;
9 * version 2.1 of the License.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /*
22 * This whole file is currently a dummy.
23 */
24
25 #include <stdio.h>
26
27 #undef TRACEPOINT_EVENT
28 #define TRACEPOINT_EVENT(name, proto, args, fields) \
29 TRACEPOINT_EVENT_CLASS(name, \
30 TP_PARAMS(proto), \
31 TP_PARAMS(args), \
32 TP_PARAMS(fields)); \
33 TRACEPOINT_EVENT_INSTANCE(name, name, TP_PARAMS(proto), \
34 TP_PARAMS(args));
35
36 #undef TRACEPOINT_EVENT_NOARGS
37 #define TRACEPOINT_EVENT_NOARGS(name, fields) \
38 TRACEPOINT_EVENT_CLASS_NOARGS(name, \
39 TP_PARAMS(fields)); \
40 TRACEPOINT_EVENT_INSTANCE_NOARGS(name, name);
41
42 #undef tp_field
43 #define tp_field(type, item, src) type item;
44
45 #undef TP_FIELDS
46 #define TP_FIELDS(args...) args
47
48 #undef TRACEPOINT_EVENT_INSTANCE
49 #define TRACEPOINT_EVENT_INSTANCE(template, name, proto, args)
50
51 #undef TRACEPOINT_EVENT_INSTANCE_NOARGS
52 #define TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name)
53
54 #undef TRACEPOINT_EVENT_CLASS
55 #define TRACEPOINT_EVENT_CLASS(name, proto, args, fields) \
56 struct trace_raw_##name { \
57 fields \
58 }; \
59 static void trace_printf_##name(void *dummy, proto) \
60 { \
61 } \
62 struct trace_event __event_##name = { \
63 __tpstrtab_##name, \
64 }; \
65 static struct trace_event * const __event_ptrs_##name \
66 __attribute__((used, section("__trace_events_ptrs"))) = \
67 &__event_##name; \
68 \
69 static void __attribute__((constructor)) init_##name() \
70 { \
71 void *dummy = NULL; \
72 __register_tracepoint(name, trace_printf_##name, dummy);\
73 }
74
75 #undef TRACEPOINT_EVENT_CLASS_NOARGS
76 #define TRACEPOINT_EVENT_CLASS_NOARGS(name, fields) \
77 struct trace_raw_##name { \
78 fields \
79 }; \
80 static void trace_printf_##name(void *dummy) \
81 { \
82 } \
83 struct trace_event __event_##name = { \
84 __tpstrtab_##name, \
85 }; \
86 static struct trace_event * const __event_ptrs_##name \
87 __attribute__((used, section("__trace_events_ptrs"))) = \
88 &__event_##name; \
89 \
90 static void __attribute__((constructor)) init_##name() \
91 { \
92 void *dummy = NULL; \
93 __register_tracepoint(name, trace_printf_##name, dummy);\
94 }
95
96 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
This page took 0.03084 seconds and 4 git commands to generate.