UST-wide warning fixes/bugfixes
[lttng-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>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21/*
22 * This whole file is currently a dummy, mapping a TRACE_EVENT
23 * to a printf
24 */
25
0c0686ee
NC
26#include <stdio.h>
27
22d72948
NC
28/*
29 * Stage 1. Create a struct and a printf calling function
30 * that is connected to the tracepoint at load time.
31 */
32#undef TRACE_EVENT
33#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
34 DECLARE_TRACE_EVENT_CLASS(name, \
35 PARAMS(proto), \
36 PARAMS(args), \
37 PARAMS(tstruct), \
38 PARAMS(assign), \
39 PARAMS(print)); \
40 DEFINE_TRACE_EVENT(name, name, PARAMS(proto), PARAMS(args));
41
42#undef __field
43#define __field(type, item) type item;
44
45#undef TP_STRUCT__entry
46#define TP_STRUCT__entry(args...) args
47
48#undef TP_printf
49#define TP_printf(fmt, args...) fmt "\n", args
50
51#undef TP_fast_assign
52#define TP_fast_assign(args...) args
53
54#undef DEFINE_TRACE_EVENT
55#define DEFINE_TRACE_EVENT(template, name, proto, args)
56
57
58#undef DECLARE_TRACE_EVENT_CLASS
59#define DECLARE_TRACE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \
60 struct trace_raw_##name { \
61 tstruct \
62 }; \
9dec086e 63 static void trace_printf_##name(void *dummy, proto) \
22d72948
NC
64 { \
65 struct trace_raw_##name entry_struct, *__entry; \
66 __entry = &entry_struct; \
67 { assign }; \
68 \
69 printf(print); \
70 } \
0c0686ee
NC
71 static inline int register_event_##name(void *data) \
72 { \
73 return register_trace_##name(trace_printf_##name, data); \
74 } \
75 static inline int unregister_event_##name(void *data) \
76 { \
77 return unregister_trace_##name(trace_printf_##name, data); \
78 } \
79 struct trace_event __event_##name \
80 __attribute__((section("__trace_events"), aligned(32))) = { \
81 __tpstrtab_##name, \
82 register_event_##name, \
83 unregister_event_##name \
84 }; \
22d72948
NC
85 static void __attribute__((constructor)) init_##name() \
86 { \
fbae86d6 87 void *dummy = NULL; \
9dec086e 88 register_trace_##name(trace_printf_##name, dummy); \
22d72948
NC
89 }
90
91
92#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
This page took 0.027989 seconds and 4 git commands to generate.