aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_export.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-09-23 17:08:43 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-09-23 17:08:43 -0400
commitd7a4b414eed51f1653bb05ebe84122bf9a7ae18b (patch)
treebd6603a0c27de4c138a1767871897e9cd3e1a1d2 /kernel/trace/trace_export.c
parent1f0ab40976460bc4673fa204ce917a725185d8f2 (diff)
parenta724eada8c2a7b62463b73ccf73fd0bb6e928aeb (diff)
Merge commit 'linus/master' into tracing/kprobes
Conflicts: kernel/trace/Makefile kernel/trace/trace.h kernel/trace/trace_event_types.h kernel/trace/trace_export.c Merge reason: Sync with latest significant tracing core changes.
Diffstat (limited to 'kernel/trace/trace_export.c')
-rw-r--r--kernel/trace/trace_export.c285
1 files changed, 154 insertions, 131 deletions
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index a79ef6f193c0..ed7d48083520 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -15,147 +15,124 @@
15 15
16#include "trace_output.h" 16#include "trace_output.h"
17 17
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM ftrace
18 20
19#undef TRACE_STRUCT 21/* not needed for this file */
20#define TRACE_STRUCT(args...) args 22#undef __field_struct
23#define __field_struct(type, item)
21 24
22extern void __bad_type_size(void); 25#undef __field
26#define __field(type, item) type item;
23 27
24#undef TRACE_FIELD 28#undef __field_desc
25#define TRACE_FIELD(type, item, assign) \ 29#define __field_desc(type, container, item) type item;
26 if (sizeof(type) != sizeof(field.item)) \ 30
27 __bad_type_size(); \ 31#undef __array
32#define __array(type, item, size) type item[size];
33
34#undef __array_desc
35#define __array_desc(type, container, item, size) type item[size];
36
37#undef __dynamic_array
38#define __dynamic_array(type, item) type item[];
39
40#undef F_STRUCT
41#define F_STRUCT(args...) args
42
43#undef F_printk
44#define F_printk(fmt, args...) fmt, args
45
46#undef FTRACE_ENTRY
47#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
48struct ____ftrace_##name { \
49 tstruct \
50}; \
51static void __used ____ftrace_check_##name(void) \
52{ \
53 struct ____ftrace_##name *__entry = NULL; \
54 \
55 /* force cmpile-time check on F_printk() */ \
56 printk(print); \
57}
58
59#undef FTRACE_ENTRY_DUP
60#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print) \
61 FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
62
63#include "trace_entries.h"
64
65
66#undef __field
67#define __field(type, item) \
28 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ 68 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
29 "offset:%u;\tsize:%u;\n", \ 69 "offset:%zu;\tsize:%zu;\n", \
30 (unsigned int)offsetof(typeof(field), item), \ 70 offsetof(typeof(field), item), \
31 (unsigned int)sizeof(field.item)); \ 71 sizeof(field.item)); \
32 if (!ret) \ 72 if (!ret) \
33 return 0; 73 return 0;
34 74
75#undef __field_desc
76#define __field_desc(type, container, item) \
77 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
78 "offset:%zu;\tsize:%zu;\n", \
79 offsetof(typeof(field), container.item), \
80 sizeof(field.container.item)); \
81 if (!ret) \
82 return 0;
35 83
36#undef TRACE_FIELD_SPECIAL 84#undef __array
37#define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \ 85#define __array(type, item, len) \
38 ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \ 86 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
39 "offset:%u;\tsize:%u;\n", \ 87 "offset:%zu;\tsize:%zu;\n", \
40 (unsigned int)offsetof(typeof(field), item), \ 88 offsetof(typeof(field), item), \
41 (unsigned int)sizeof(field.item)); \ 89 sizeof(field.item)); \
42 if (!ret) \ 90 if (!ret) \
43 return 0; 91 return 0;
44 92
45#undef TRACE_FIELD_ZERO 93#undef __array_desc
46#define TRACE_FIELD_ZERO(type, item) \ 94#define __array_desc(type, container, item, len) \
47 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ 95 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
48 "offset:%u;\tsize:0;\n", \ 96 "offset:%zu;\tsize:%zu;\n", \
49 (unsigned int)offsetof(typeof(field), item)); \ 97 offsetof(typeof(field), container.item), \
98 sizeof(field.container.item)); \
50 if (!ret) \ 99 if (!ret) \
51 return 0; 100 return 0;
52 101
53#undef TRACE_FIELD_SIGN 102#undef __dynamic_array
54#define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ 103#define __dynamic_array(type, item) \
55 TRACE_FIELD(type, item, assign) 104 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
105 "offset:%zu;\tsize:0;\n", \
106 offsetof(typeof(field), item)); \
107 if (!ret) \
108 return 0;
56 109
57#undef TP_RAW_FMT 110#undef F_printk
58#define TP_RAW_FMT(args...) args 111#define F_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
59 112
60#undef TRACE_EVENT_FORMAT 113#undef __entry
61#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \ 114#define __entry REC
62static int \
63ftrace_format_##call(struct ftrace_event_call *unused, \
64 struct trace_seq *s) \
65{ \
66 struct args field; \
67 int ret; \
68 \
69 tstruct; \
70 \
71 trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt); \
72 \
73 return ret; \
74}
75 115
76#undef TRACE_EVENT_FORMAT_NOFILTER 116#undef FTRACE_ENTRY
77#define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \ 117#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
78 tpfmt) \
79static int \ 118static int \
80ftrace_format_##call(struct ftrace_event_call *unused, \ 119ftrace_format_##name(struct ftrace_event_call *unused, \
81 struct trace_seq *s) \ 120 struct trace_seq *s) \
82{ \ 121{ \
83 struct args field; \ 122 struct struct_name field __attribute__((unused)); \
84 int ret; \ 123 int ret = 0; \
85 \ 124 \
86 tstruct; \ 125 tstruct; \
87 \ 126 \
88 trace_seq_printf(s, "\nprint fmt: \"%s\"\n", tpfmt); \ 127 trace_seq_printf(s, "\nprint fmt: " print); \
89 \ 128 \
90 return ret; \ 129 return ret; \
91} 130}
92 131
93#include "trace_event_types.h" 132#include "trace_entries.h"
94
95#undef TRACE_FIELD
96#define TRACE_FIELD(type, item, assign)\
97 entry->item = assign;
98
99#undef TRACE_FIELD
100#define TRACE_FIELD(type, item, assign)\
101 entry->item = assign;
102
103#undef TRACE_FIELD_SIGN
104#define TRACE_FIELD_SIGN(type, item, assign, is_signed) \
105 TRACE_FIELD(type, item, assign)
106
107#undef TRACE_FIELD_ZERO
108#define TRACE_FIELD_ZERO(type, item)
109
110#undef TP_CMD
111#define TP_CMD(cmd...) cmd
112
113#undef TRACE_ENTRY
114#define TRACE_ENTRY entry
115
116#undef TRACE_FIELD_SPECIAL
117#define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \
118 cmd;
119
120static int ftrace_raw_init_event(struct ftrace_event_call *event_call)
121{
122 INIT_LIST_HEAD(&event_call->fields);
123
124 return 0;
125}
126
127#undef TRACE_EVENT_FORMAT
128#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
129int ftrace_define_fields_##call(struct ftrace_event_call *event_call); \
130 \
131struct ftrace_event_call __used \
132__attribute__((__aligned__(4))) \
133__attribute__((section("_ftrace_events"))) event_##call = { \
134 .name = #call, \
135 .id = proto, \
136 .system = __stringify(TRACE_SYSTEM), \
137 .raw_init = ftrace_raw_init_event, \
138 .show_format = ftrace_format_##call, \
139 .define_fields = ftrace_define_fields_##call, \
140}; \
141
142#undef TRACE_EVENT_FORMAT_NOFILTER
143#define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \
144 tpfmt) \
145 \
146struct ftrace_event_call __used \
147__attribute__((__aligned__(4))) \
148__attribute__((section("_ftrace_events"))) event_##call = { \
149 .name = #call, \
150 .id = proto, \
151 .system = __stringify(TRACE_SYSTEM), \
152 .show_format = ftrace_format_##call, \
153};
154
155#include "trace_event_types.h"
156 133
157#undef TRACE_FIELD 134#undef __field
158#define TRACE_FIELD(type, item, assign) \ 135#define __field(type, item) \
159 ret = trace_define_field(event_call, #type, #item, \ 136 ret = trace_define_field(event_call, #type, #item, \
160 offsetof(typeof(field), item), \ 137 offsetof(typeof(field), item), \
161 sizeof(field.item), \ 138 sizeof(field.item), \
@@ -163,32 +140,45 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
163 if (ret) \ 140 if (ret) \
164 return ret; 141 return ret;
165 142
166#undef TRACE_FIELD_SPECIAL 143#undef __field_desc
167#define TRACE_FIELD_SPECIAL(type, item, len, cmd) \ 144#define __field_desc(type, container, item) \
145 ret = trace_define_field(event_call, #type, #item, \
146 offsetof(typeof(field), \
147 container.item), \
148 sizeof(field.container.item), \
149 is_signed_type(type), FILTER_OTHER); \
150 if (ret) \
151 return ret;
152
153#undef __array
154#define __array(type, item, len) \
155 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
168 ret = trace_define_field(event_call, #type "[" #len "]", #item, \ 156 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
169 offsetof(typeof(field), item), \ 157 offsetof(typeof(field), item), \
170 sizeof(field.item), 0, FILTER_OTHER); \ 158 sizeof(field.item), 0, FILTER_OTHER); \
171 if (ret) \ 159 if (ret) \
172 return ret; 160 return ret;
173 161
174#undef TRACE_FIELD_SIGN 162#undef __array_desc
175#define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ 163#define __array_desc(type, container, item, len) \
176 ret = trace_define_field(event_call, #type, #item, \ 164 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
177 offsetof(typeof(field), item), \ 165 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
178 sizeof(field.item), is_signed, \ 166 offsetof(typeof(field), \
167 container.item), \
168 sizeof(field.container.item), 0, \
179 FILTER_OTHER); \ 169 FILTER_OTHER); \
180 if (ret) \ 170 if (ret) \
181 return ret; 171 return ret;
182 172
183#undef TRACE_FIELD_ZERO 173#undef __dynamic_array
184#define TRACE_FIELD_ZERO(type, item) 174#define __dynamic_array(type, item)
185 175
186#undef TRACE_EVENT_FORMAT 176#undef FTRACE_ENTRY
187#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \ 177#define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
188int \ 178int \
189ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ 179ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
190{ \ 180{ \
191 struct args field; \ 181 struct struct_name field; \
192 int ret; \ 182 int ret; \
193 \ 183 \
194 ret = trace_define_common_fields(event_call); \ 184 ret = trace_define_common_fields(event_call); \
@@ -200,8 +190,41 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
200 return ret; \ 190 return ret; \
201} 191}
202 192
203#undef TRACE_EVENT_FORMAT_NOFILTER 193#include "trace_entries.h"
204#define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, \ 194
205 tpfmt) 195static int ftrace_raw_init_event(struct ftrace_event_call *call)
196{
197 INIT_LIST_HEAD(&call->fields);
198 return 0;
199}
200
201#undef __field
202#define __field(type, item)
203
204#undef __field_desc
205#define __field_desc(type, container, item)
206
207#undef __array
208#define __array(type, item, len)
209
210#undef __array_desc
211#define __array_desc(type, container, item, len)
212
213#undef __dynamic_array
214#define __dynamic_array(type, item)
215
216#undef FTRACE_ENTRY
217#define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \
218 \
219struct ftrace_event_call __used \
220__attribute__((__aligned__(4))) \
221__attribute__((section("_ftrace_events"))) event_##call = { \
222 .name = #call, \
223 .id = type, \
224 .system = __stringify(TRACE_SYSTEM), \
225 .raw_init = ftrace_raw_init_event, \
226 .show_format = ftrace_format_##call, \
227 .define_fields = ftrace_define_fields_##call, \
228}; \
206 229
207#include "trace_event_types.h" 230#include "trace_entries.h"