From ee53bbd172571c944bc2d01b4846fc7c49ebd353 Mon Sep 17 00:00:00 2001 From: "Steven Rostedt (Red Hat)" Date: Wed, 29 Apr 2015 13:11:00 -0400 Subject: tracing: Move the perf code out of trace_event.h The trace_event.h file is for the generic trace event code. Move the perf related code into its own trace header file perf.h Signed-off-by: Steven Rostedt diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index b13ba2f..09b3880 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h @@ -88,6 +88,7 @@ #ifdef CONFIG_EVENT_TRACING #include +#include #endif #undef TRACE_EVENT diff --git a/include/trace/perf.h b/include/trace/perf.h new file mode 100644 index 0000000..5e82add --- /dev/null +++ b/include/trace/perf.h @@ -0,0 +1,350 @@ +/* + * Stage 4 of the trace events. + * + * Override the macros in to include the following: + * + * For those macros defined with TRACE_EVENT: + * + * static struct ftrace_event_call event_; + * + * static void ftrace_raw_event_(void *__data, proto) + * { + * struct ftrace_event_file *ftrace_file = __data; + * struct ftrace_event_call *event_call = ftrace_file->event_call; + * struct ftrace_data_offsets_ __maybe_unused __data_offsets; + * unsigned long eflags = ftrace_file->flags; + * enum event_trigger_type __tt = ETT_NONE; + * struct ring_buffer_event *event; + * struct ftrace_raw_ *entry; <-- defined in stage 1 + * struct ring_buffer *buffer; + * unsigned long irq_flags; + * int __data_size; + * int pc; + * + * if (!(eflags & FTRACE_EVENT_FL_TRIGGER_COND)) { + * if (eflags & FTRACE_EVENT_FL_TRIGGER_MODE) + * event_triggers_call(ftrace_file, NULL); + * if (eflags & FTRACE_EVENT_FL_SOFT_DISABLED) + * return; + * } + * + * local_save_flags(irq_flags); + * pc = preempt_count(); + * + * __data_size = ftrace_get_offsets_(&__data_offsets, args); + * + * event = trace_event_buffer_lock_reserve(&buffer, ftrace_file, + * event_->event.type, + * sizeof(*entry) + __data_size, + * irq_flags, pc); + * if (!event) + * return; + * entry = ring_buffer_event_data(event); + * + * { ; } <-- Here we assign the entries by the __field and + * __array macros. + * + * if (eflags & FTRACE_EVENT_FL_TRIGGER_COND) + * __tt = event_triggers_call(ftrace_file, entry); + * + * if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, + * &ftrace_file->flags)) + * ring_buffer_discard_commit(buffer, event); + * else if (!filter_check_discard(ftrace_file, entry, buffer, event)) + * trace_buffer_unlock_commit(buffer, event, irq_flags, pc); + * + * if (__tt) + * event_triggers_post_call(ftrace_file, __tt); + * } + * + * static struct trace_event ftrace_event_type_ = { + * .trace = ftrace_raw_output_, <-- stage 2 + * }; + * + * static char print_fmt_[] = ; + * + * static struct ftrace_event_class __used event_class_