Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6] / kernel / trace / trace_events_stage_2.h
1 /*
2  * Stage 2 of the trace events.
3  *
4  * Override the macros in <trace/trace_event_types.h> to include the following:
5  *
6  * enum print_line_t
7  * ftrace_raw_output_<call>(struct trace_iterator *iter, int flags)
8  * {
9  *      struct trace_seq *s = &iter->seq;
10  *      struct ftrace_raw_<call> *field; <-- defined in stage 1
11  *      struct trace_entry *entry;
12  *      int ret;
13  *
14  *      entry = iter->ent;
15  *
16  *      if (entry->type != event_<call>.id) {
17  *              WARN_ON_ONCE(1);
18  *              return TRACE_TYPE_UNHANDLED;
19  *      }
20  *
21  *      field = (typeof(field))entry;
22  *
23  *      ret = trace_seq_printf(s, <TPRAWFMT> "%s", <ARGS> "\n");
24  *      if (!ret)
25  *              return TRACE_TYPE_PARTIAL_LINE;
26  *
27  *      return TRACE_TYPE_HANDLED;
28  * }
29  *
30  * This is the method used to print the raw event to the trace
31  * output format. Note, this is not needed if the data is read
32  * in binary.
33  */
34
35 #undef TRACE_STRUCT
36 #define TRACE_STRUCT(args...) args
37
38 #undef TRACE_FIELD
39 #define TRACE_FIELD(type, item, assign) \
40         field->item,
41
42
43 #undef TPRAWFMT
44 #define TPRAWFMT(args...)       args
45
46 #undef TRACE_EVENT_FORMAT
47 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)      \
48 enum print_line_t                                                       \
49 ftrace_raw_output_##call(struct trace_iterator *iter, int flags)        \
50 {                                                                       \
51         struct trace_seq *s = &iter->seq;                               \
52         struct ftrace_raw_##call *field;                                \
53         struct trace_entry *entry;                                      \
54         int ret;                                                        \
55                                                                         \
56         entry = iter->ent;                                              \
57                                                                         \
58         if (entry->type != event_##call.id) {                           \
59                 WARN_ON_ONCE(1);                                        \
60                 return TRACE_TYPE_UNHANDLED;                            \
61         }                                                               \
62                                                                         \
63         field = (typeof(field))entry;                                   \
64                                                                         \
65         ret = trace_seq_printf(s, tpfmt "%s", tstruct "\n");            \
66         if (!ret)                                                       \
67                 return TRACE_TYPE_PARTIAL_LINE;                         \
68                                                                         \
69         return TRACE_TYPE_HANDLED;                                      \
70 }
71
72 #include <trace/trace_event_types.h>