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_RAW_FMT> "%s", <ARGS> "\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, print, assign) \
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 * " size:%d; offset:%d;\n",
81 * offsetof(struct ftrace_raw_##call,
87 #undef TP_STRUCT__entry
88 #define TP_STRUCT__entry(args...) args
91 #define __field(type, item) \
92 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
93 "offset:%u;\tsize:%u;\n", \
94 (unsigned int)offsetof(typeof(field), item), \
95 (unsigned int)sizeof(field.item)); \
100 #define __array(type, item, len) \
101 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
102 "offset:%u;\tsize:%u;\n", \
103 (unsigned int)offsetof(typeof(field), item), \
104 (unsigned int)sizeof(field.item)); \
109 #define __entry "REC"
112 #define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
114 #undef TP_fast_assign
115 #define TP_fast_assign(args...) args
118 #define TRACE_EVENT(call, proto, args, tstruct, print, func) \
120 ftrace_format_##call(struct trace_seq *s) \
122 struct ftrace_raw_##call field; \
127 trace_seq_printf(s, "\nprint fmt: " print); \
132 #include <trace/trace_event_types.h>