Tracepoint and TRACEPOINT_EVENT API cleanup
[ust.git] / include / ust / ust_trace.h
CommitLineData
22d72948
NC
1/*
2 * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com>
3 * Copyright (C) 2010 Nils Carlson <nils.carlson@ericsson.com>
8d71973c 4 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
22d72948
NC
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
f37142a4
MD
8 * License as published by the Free Software Foundation;
9 * version 2.1 of the License.
22d72948
NC
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
22d72948
NC
19 */
20
21/*
81614639 22 * This whole file is currently a dummy.
22d72948
NC
23 */
24
0c0686ee
NC
25#include <stdio.h>
26
8d71973c 27#undef TRACEPOINT_EVENT
81614639
MD
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));
22d72948 35
81614639
MD
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);
22d72948 41
81614639
MD
42#undef tp_field
43#define tp_field(type, item, src) type item;
22d72948 44
81614639
MD
45#undef TP_FIELDS
46#define TP_FIELDS(args...) args
22d72948 47
81614639
MD
48#undef TRACEPOINT_EVENT_INSTANCE
49#define TRACEPOINT_EVENT_INSTANCE(template, name, proto, args)
22d72948 50
81614639
MD
51#undef TRACEPOINT_EVENT_INSTANCE_NOARGS
52#define TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name)
22d72948 53
81614639
MD
54#undef TRACEPOINT_EVENT_CLASS
55#define TRACEPOINT_EVENT_CLASS(name, proto, args, fields) \
22d72948 56 struct trace_raw_##name { \
81614639 57 fields \
22d72948 58 }; \
9dec086e 59 static void trace_printf_##name(void *dummy, proto) \
22d72948 60 { \
22d72948 61 } \
81614639
MD
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() \
0c0686ee 70 { \
81614639
MD
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) \
0c0686ee 81 { \
0c0686ee 82 } \
fc1caebc 83 struct trace_event __event_##name = { \
0c0686ee 84 __tpstrtab_##name, \
0c0686ee 85 }; \
fc1caebc
MD
86 static struct trace_event * const __event_ptrs_##name \
87 __attribute__((used, section("__trace_events_ptrs"))) = \
88 &__event_##name; \
89 \
22d72948
NC
90 static void __attribute__((constructor)) init_##name() \
91 { \
fbae86d6 92 void *dummy = NULL; \
81614639 93 __register_tracepoint(name, trace_printf_##name, dummy);\
22d72948
NC
94 }
95
22d72948 96#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
This page took 0.03307 seconds and 4 git commands to generate.