aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-04-23 10:00:22 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-14 14:20:34 -0400
commit80decc70afc57c87eee9d6b836aec2ecacba3457 (patch)
tree3aec4c67a5518a9c4e60a6914c5dbb9eb82e952f /include/trace
parenta9a5776380208a3e48a92d0c763ee1a3b486fb73 (diff)
tracing: Move print functions into event class
Currently, every event has its own trace_event structure. This is fine since the structure is needed anyway. But the print function structure (trace_event_functions) is now separate. Since the output of the trace event is done by the class (with the exception of events defined by DEFINE_EVENT_PRINT), it makes sense to have the class define the print functions that all events in the class can use. This makes a bigger deal with the syscall events since all syscall events use the same class. The savings here is another 30K. text data bss dec hex filename 4913961 1088356 861512 6863829 68bbd5 vmlinux.orig 4900382 1048964 861512 6810858 67ecea vmlinux.init 4900446 1049028 861512 6810986 67ed6a vmlinux.preprint 4895024 1023812 861512 6780348 6775bc vmlinux.print To accomplish this, and to let the class know what event is being printed, the event structure is embedded in the ftrace_event_call structure. This should not be an issues since the event structure was created for each event anyway. Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/ftrace.h45
1 files changed, 19 insertions, 26 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 51ed7f3568a5..824141d5cf04 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -206,18 +206,22 @@
206#undef DECLARE_EVENT_CLASS 206#undef DECLARE_EVENT_CLASS
207#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 207#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
208static notrace enum print_line_t \ 208static notrace enum print_line_t \
209ftrace_raw_output_id_##call(int event_id, const char *name, \ 209ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
210 struct trace_iterator *iter, int flags) \ 210 struct trace_event *trace_event) \
211{ \ 211{ \
212 struct ftrace_event_call *event; \
212 struct trace_seq *s = &iter->seq; \ 213 struct trace_seq *s = &iter->seq; \
213 struct ftrace_raw_##call *field; \ 214 struct ftrace_raw_##call *field; \
214 struct trace_entry *entry; \ 215 struct trace_entry *entry; \
215 struct trace_seq *p; \ 216 struct trace_seq *p; \
216 int ret; \ 217 int ret; \
217 \ 218 \
219 event = container_of(trace_event, struct ftrace_event_call, \
220 event); \
221 \
218 entry = iter->ent; \ 222 entry = iter->ent; \
219 \ 223 \
220 if (entry->type != event_id) { \ 224 if (entry->type != event->id) { \
221 WARN_ON_ONCE(1); \ 225 WARN_ON_ONCE(1); \
222 return TRACE_TYPE_UNHANDLED; \ 226 return TRACE_TYPE_UNHANDLED; \
223 } \ 227 } \
@@ -226,7 +230,7 @@ ftrace_raw_output_id_##call(int event_id, const char *name, \
226 \ 230 \
227 p = &get_cpu_var(ftrace_event_seq); \ 231 p = &get_cpu_var(ftrace_event_seq); \
228 trace_seq_init(p); \ 232 trace_seq_init(p); \
229 ret = trace_seq_printf(s, "%s: ", name); \ 233 ret = trace_seq_printf(s, "%s: ", event->name); \
230 if (ret) \ 234 if (ret) \
231 ret = trace_seq_printf(s, print); \ 235 ret = trace_seq_printf(s, print); \
232 put_cpu(); \ 236 put_cpu(); \
@@ -234,17 +238,10 @@ ftrace_raw_output_id_##call(int event_id, const char *name, \
234 return TRACE_TYPE_PARTIAL_LINE; \ 238 return TRACE_TYPE_PARTIAL_LINE; \
235 \ 239 \
236 return TRACE_TYPE_HANDLED; \ 240 return TRACE_TYPE_HANDLED; \
237} 241} \
238 242static struct trace_event_functions ftrace_event_type_funcs_##call = { \
239#undef DEFINE_EVENT 243 .trace = ftrace_raw_output_##call, \
240#define DEFINE_EVENT(template, name, proto, args) \ 244};
241static notrace enum print_line_t \
242ftrace_raw_output_##name(struct trace_iterator *iter, int flags, \
243 struct trace_event *event) \
244{ \
245 return ftrace_raw_output_id_##template(event_##name.id, \
246 #name, iter, flags); \
247}
248 245
249#undef DEFINE_EVENT_PRINT 246#undef DEFINE_EVENT_PRINT
250#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ 247#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
@@ -277,7 +274,10 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
277 return TRACE_TYPE_PARTIAL_LINE; \ 274 return TRACE_TYPE_PARTIAL_LINE; \
278 \ 275 \
279 return TRACE_TYPE_HANDLED; \ 276 return TRACE_TYPE_HANDLED; \
280} 277} \
278static struct trace_event_functions ftrace_event_type_funcs_##call = { \
279 .trace = ftrace_raw_output_##call, \
280};
281 281
282#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 282#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
283 283
@@ -533,20 +533,13 @@ ftrace_raw_event_##call(void *__data, proto) \
533 533
534#undef DEFINE_EVENT 534#undef DEFINE_EVENT
535#define DEFINE_EVENT(template, call, proto, args) \ 535#define DEFINE_EVENT(template, call, proto, args) \
536static struct trace_event_functions ftrace_event_type_funcs_##call = { \
537 .trace = ftrace_raw_output_##call, \
538}; \
539static struct trace_event ftrace_event_type_##call = { \
540 .funcs = &ftrace_event_type_funcs_##call, \
541}; \
542static inline void ftrace_test_probe_##call(void) \ 536static inline void ftrace_test_probe_##call(void) \
543{ \ 537{ \
544 check_trace_callback_type_##call(ftrace_raw_event_##template); \ 538 check_trace_callback_type_##call(ftrace_raw_event_##template); \
545} 539}
546 540
547#undef DEFINE_EVENT_PRINT 541#undef DEFINE_EVENT_PRINT
548#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ 542#define DEFINE_EVENT_PRINT(template, name, proto, args, print)
549 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
550 543
551#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 544#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
552 545
@@ -582,7 +575,7 @@ __attribute__((__aligned__(4))) \
582__attribute__((section("_ftrace_events"))) event_##call = { \ 575__attribute__((section("_ftrace_events"))) event_##call = { \
583 .name = #call, \ 576 .name = #call, \
584 .class = &event_class_##template, \ 577 .class = &event_class_##template, \
585 .event = &ftrace_event_type_##call, \ 578 .event.funcs = &ftrace_event_type_funcs_##template, \
586 .print_fmt = print_fmt_##template, \ 579 .print_fmt = print_fmt_##template, \
587}; 580};
588 581
@@ -596,7 +589,7 @@ __attribute__((__aligned__(4))) \
596__attribute__((section("_ftrace_events"))) event_##call = { \ 589__attribute__((section("_ftrace_events"))) event_##call = { \
597 .name = #call, \ 590 .name = #call, \
598 .class = &event_class_##template, \ 591 .class = &event_class_##template, \
599 .event = &ftrace_event_type_##call, \ 592 .event.funcs = &ftrace_event_type_funcs_##call, \
600 .print_fmt = print_fmt_##call, \ 593 .print_fmt = print_fmt_##call, \
601} 594}
602 595