diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-06-10 14:28:34 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-06-10 14:28:34 -0400 |
commit | 6ff9a64d2aaa6eae396adc95e9c91c0cbfa6dbe4 (patch) | |
tree | 1ca1b9a0aff32f1542a9dc3d2f5ccac7ab8a52e3 /include/trace | |
parent | bc5c6c043d8381676339fb3da59cc4cc5921d368 (diff) |
tracing: do not translate event helper macros in print format
By moving the macro that creates the print format code above the
defining of the event macro helpers (__get_str, __print_symbolic,
and __get_dynamic_array), we get a little cleaner print format.
Instead of:
(char *)((void *)REC + REC->__data_loc_name)
we get:
__get_str(name)
Instead of:
({ static const struct trace_print_flags symbols[] = { { HI_SOFTIRQ, "HI" }, {
we get:
__print_symbolic(REC->vec, { HI_SOFTIRQ, "HI" }, {
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/trace')
-rw-r--r-- | include/trace/ftrace.h | 158 |
1 files changed, 81 insertions, 77 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 40ede4db4d88..1867553c61e5 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
@@ -81,6 +81,87 @@ | |||
81 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 81 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
82 | 82 | ||
83 | /* | 83 | /* |
84 | * Setup the showing format of trace point. | ||
85 | * | ||
86 | * int | ||
87 | * ftrace_format_##call(struct trace_seq *s) | ||
88 | * { | ||
89 | * struct ftrace_raw_##call field; | ||
90 | * int ret; | ||
91 | * | ||
92 | * ret = trace_seq_printf(s, #type " " #item ";" | ||
93 | * " offset:%u; size:%u;\n", | ||
94 | * offsetof(struct ftrace_raw_##call, item), | ||
95 | * sizeof(field.type)); | ||
96 | * | ||
97 | * } | ||
98 | */ | ||
99 | |||
100 | #undef TP_STRUCT__entry | ||
101 | #define TP_STRUCT__entry(args...) args | ||
102 | |||
103 | #undef __field | ||
104 | #define __field(type, item) \ | ||
105 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ | ||
106 | "offset:%u;\tsize:%u;\n", \ | ||
107 | (unsigned int)offsetof(typeof(field), item), \ | ||
108 | (unsigned int)sizeof(field.item)); \ | ||
109 | if (!ret) \ | ||
110 | return 0; | ||
111 | |||
112 | #undef __array | ||
113 | #define __array(type, item, len) \ | ||
114 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ | ||
115 | "offset:%u;\tsize:%u;\n", \ | ||
116 | (unsigned int)offsetof(typeof(field), item), \ | ||
117 | (unsigned int)sizeof(field.item)); \ | ||
118 | if (!ret) \ | ||
119 | return 0; | ||
120 | |||
121 | #undef __dynamic_array | ||
122 | #define __dynamic_array(type, item, len) \ | ||
123 | ret = trace_seq_printf(s, "\tfield:__data_loc " #item ";\t" \ | ||
124 | "offset:%u;\tsize:%u;\n", \ | ||
125 | (unsigned int)offsetof(typeof(field), \ | ||
126 | __data_loc_##item), \ | ||
127 | (unsigned int)sizeof(field.__data_loc_##item)); \ | ||
128 | if (!ret) \ | ||
129 | return 0; | ||
130 | |||
131 | #undef __string | ||
132 | #define __string(item, src) __dynamic_array(char, item, -1) | ||
133 | |||
134 | #undef __entry | ||
135 | #define __entry REC | ||
136 | |||
137 | #undef __print_symbolic | ||
138 | #undef __get_dynamic_array | ||
139 | #undef __get_str | ||
140 | |||
141 | #undef TP_printk | ||
142 | #define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args) | ||
143 | |||
144 | #undef TP_fast_assign | ||
145 | #define TP_fast_assign(args...) args | ||
146 | |||
147 | #undef TRACE_EVENT | ||
148 | #define TRACE_EVENT(call, proto, args, tstruct, func, print) \ | ||
149 | static int \ | ||
150 | ftrace_format_##call(struct trace_seq *s) \ | ||
151 | { \ | ||
152 | struct ftrace_raw_##call field __attribute__((unused)); \ | ||
153 | int ret = 0; \ | ||
154 | \ | ||
155 | tstruct; \ | ||
156 | \ | ||
157 | trace_seq_printf(s, "\nprint fmt: " print); \ | ||
158 | \ | ||
159 | return ret; \ | ||
160 | } | ||
161 | |||
162 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | ||
163 | |||
164 | /* | ||
84 | * Stage 3 of the trace events. | 165 | * Stage 3 of the trace events. |
85 | * | 166 | * |
86 | * Override the macros in <trace/trace_events.h> to include the following: | 167 | * Override the macros in <trace/trace_events.h> to include the following: |
@@ -179,83 +260,6 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ | |||
179 | 260 | ||
180 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | 261 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
181 | 262 | ||
182 | /* | ||
183 | * Setup the showing format of trace point. | ||
184 | * | ||
185 | * int | ||
186 | * ftrace_format_##call(struct trace_seq *s) | ||
187 | * { | ||
188 | * struct ftrace_raw_##call field; | ||
189 | * int ret; | ||
190 | * | ||
191 | * ret = trace_seq_printf(s, #type " " #item ";" | ||
192 | * " offset:%u; size:%u;\n", | ||
193 | * offsetof(struct ftrace_raw_##call, item), | ||
194 | * sizeof(field.type)); | ||
195 | * | ||
196 | * } | ||
197 | */ | ||
198 | |||
199 | #undef TP_STRUCT__entry | ||
200 | #define TP_STRUCT__entry(args...) args | ||
201 | |||
202 | #undef __field | ||
203 | #define __field(type, item) \ | ||
204 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ | ||
205 | "offset:%u;\tsize:%u;\n", \ | ||
206 | (unsigned int)offsetof(typeof(field), item), \ | ||
207 | (unsigned int)sizeof(field.item)); \ | ||
208 | if (!ret) \ | ||
209 | return 0; | ||
210 | |||
211 | #undef __array | ||
212 | #define __array(type, item, len) \ | ||
213 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ | ||
214 | "offset:%u;\tsize:%u;\n", \ | ||
215 | (unsigned int)offsetof(typeof(field), item), \ | ||
216 | (unsigned int)sizeof(field.item)); \ | ||
217 | if (!ret) \ | ||
218 | return 0; | ||
219 | |||
220 | #undef __dynamic_array | ||
221 | #define __dynamic_array(type, item, len) \ | ||
222 | ret = trace_seq_printf(s, "\tfield:__data_loc " #item ";\t" \ | ||
223 | "offset:%u;\tsize:%u;\n", \ | ||
224 | (unsigned int)offsetof(typeof(field), \ | ||
225 | __data_loc_##item), \ | ||
226 | (unsigned int)sizeof(field.__data_loc_##item)); \ | ||
227 | if (!ret) \ | ||
228 | return 0; | ||
229 | |||
230 | #undef __string | ||
231 | #define __string(item, src) __dynamic_array(char, item, -1) | ||
232 | |||
233 | #undef __entry | ||
234 | #define __entry REC | ||
235 | |||
236 | #undef TP_printk | ||
237 | #define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args) | ||
238 | |||
239 | #undef TP_fast_assign | ||
240 | #define TP_fast_assign(args...) args | ||
241 | |||
242 | #undef TRACE_EVENT | ||
243 | #define TRACE_EVENT(call, proto, args, tstruct, func, print) \ | ||
244 | static int \ | ||
245 | ftrace_format_##call(struct trace_seq *s) \ | ||
246 | { \ | ||
247 | struct ftrace_raw_##call field __attribute__((unused)); \ | ||
248 | int ret = 0; \ | ||
249 | \ | ||
250 | tstruct; \ | ||
251 | \ | ||
252 | trace_seq_printf(s, "\nprint fmt: " print); \ | ||
253 | \ | ||
254 | return ret; \ | ||
255 | } | ||
256 | |||
257 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | ||
258 | |||
259 | #undef __field | 263 | #undef __field |
260 | #define __field(type, item) \ | 264 | #define __field(type, item) \ |
261 | ret = trace_define_field(event_call, #type, #item, \ | 265 | ret = trace_define_field(event_call, #type, #item, \ |