Add a simple test case for TRACE_EVENT v2
[lttng-ust.git] / include / ust / ust_trace.h
... / ...
CommitLineData
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
26/*
27 * Stage 1. Create a struct and a printf calling function
28 * that is connected to the tracepoint at load time.
29 */
30#undef TRACE_EVENT
31#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
32 DECLARE_TRACE_EVENT_CLASS(name, \
33 PARAMS(proto), \
34 PARAMS(args), \
35 PARAMS(tstruct), \
36 PARAMS(assign), \
37 PARAMS(print)); \
38 DEFINE_TRACE_EVENT(name, name, PARAMS(proto), PARAMS(args));
39
40#undef __field
41#define __field(type, item) type item;
42
43#undef TP_STRUCT__entry
44#define TP_STRUCT__entry(args...) args
45
46#undef TP_printf
47#define TP_printf(fmt, args...) fmt "\n", args
48
49#undef TP_fast_assign
50#define TP_fast_assign(args...) args
51
52#undef DEFINE_TRACE_EVENT
53#define DEFINE_TRACE_EVENT(template, name, proto, args)
54
55
56#undef DECLARE_TRACE_EVENT_CLASS
57#define DECLARE_TRACE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \
58 struct trace_raw_##name { \
59 tstruct \
60 }; \
61 static void trace_printf_##name(proto) \
62 { \
63 struct trace_raw_##name entry_struct, *__entry; \
64 __entry = &entry_struct; \
65 { assign }; \
66 \
67 printf(print); \
68 } \
69 static void __attribute__((constructor)) init_##name() \
70 { \
71 printf("connecting tracepoint " #name "\n"); \
72 register_trace_##name(trace_printf_##name); \
73 }
74
75
76#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
This page took 0.023956 seconds and 4 git commands to generate.