2 * Stage 2 of the trace events.
4 * Override the macros in <trace/trace_event_types.h> to include the following:
7 * ftrace_raw_output_<call>(struct trace_iterator *iter, int flags)
9 * struct trace_seq *s = &iter->seq;
10 * struct ftrace_raw_<call> *field; <-- defined in stage 1
11 * struct trace_entry *entry;
16 * if (entry->type != event_<call>.id) {
18 * return TRACE_TYPE_UNHANDLED;
21 * field = (typeof(field))entry;
23 * ret = trace_seq_printf(s, <TP_printk> "\n");
25 * return TRACE_TYPE_PARTIAL_LINE;
27 * return TRACE_TYPE_HANDLED;
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
39 #define TP_printk(fmt, args...) fmt "\n", args
42 #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
44 ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
46 struct trace_seq *s = &iter->seq; \
47 struct ftrace_raw_##call *field; \
48 struct trace_entry *entry; \
53 if (entry->type != event_##call.id) { \
55 return TRACE_TYPE_UNHANDLED; \
58 field = (typeof(field))entry; \
60 ret = trace_seq_printf(s, print); \
62 return TRACE_TYPE_PARTIAL_LINE; \
64 return TRACE_TYPE_HANDLED; \
67 #include <trace/trace_event_types.h>
70 * Setup the showing format of trace point.
73 * ftrace_format_##call(struct trace_seq *s)
75 * struct ftrace_raw_##call field;
78 * ret = trace_seq_printf(s, #type " " #item ";"
79 * " offset:%u; size:%u;\n",
80 * offsetof(struct ftrace_raw_##call, item),
81 * sizeof(field.type));
86 #undef TP_STRUCT__entry
87 #define TP_STRUCT__entry(args...) args
90 #define __field(type, item) \
91 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
92 "offset:%u;\tsize:%u;\n", \
93 (unsigned int)offsetof(typeof(field), item), \
94 (unsigned int)sizeof(field.item)); \
99 #define __array(type, item, len) \
100 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
101 "offset:%u;\tsize:%u;\n", \
102 (unsigned int)offsetof(typeof(field), item), \
103 (unsigned int)sizeof(field.item)); \
108 #define __entry "REC"
111 #define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
113 #undef TP_fast_assign
114 #define TP_fast_assign(args...) args
117 #define TRACE_EVENT(call, proto, args, tstruct, func, print) \
119 ftrace_format_##call(struct trace_seq *s) \
121 struct ftrace_raw_##call field; \
126 trace_seq_printf(s, "\nprint fmt: " print); \
131 #include <trace/trace_event_types.h>