added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / kernel / trace / trace_events_stage_2.h
blob30743f7d41108b942cc596f06856ab633b792c47
1 /*
2 * Stage 2 of the trace events.
4 * Override the macros in <trace/trace_event_types.h> to include the following:
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;
14 * entry = iter->ent;
16 * if (entry->type != event_<call>.id) {
17 * WARN_ON_ONCE(1);
18 * return TRACE_TYPE_UNHANDLED;
19 * }
21 * field = (typeof(field))entry;
23 * ret = trace_seq_printf(s, <TP_printk> "\n");
24 * if (!ret)
25 * return TRACE_TYPE_PARTIAL_LINE;
27 * return TRACE_TYPE_HANDLED;
28 * }
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.
35 #undef __entry
36 #define __entry field
38 #undef TP_printk
39 #define TP_printk(fmt, args...) fmt "\n", args
41 #undef TRACE_EVENT
42 #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
43 enum print_line_t \
44 ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
45 { \
46 struct trace_seq *s = &iter->seq; \
47 struct ftrace_raw_##call *field; \
48 struct trace_entry *entry; \
49 int ret; \
51 entry = iter->ent; \
53 if (entry->type != event_##call.id) { \
54 WARN_ON_ONCE(1); \
55 return TRACE_TYPE_UNHANDLED; \
56 } \
58 field = (typeof(field))entry; \
60 ret = trace_seq_printf(s, #call ": " print); \
61 if (!ret) \
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.
72 * int
73 * ftrace_format_##call(struct trace_seq *s)
74 * {
75 * struct ftrace_raw_##call field;
76 * int ret;
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));
83 * }
86 #undef TP_STRUCT__entry
87 #define TP_STRUCT__entry(args...) args
89 #undef __field
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)); \
95 if (!ret) \
96 return 0;
98 #undef __array
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)); \
104 if (!ret) \
105 return 0;
107 #undef __entry
108 #define __entry "REC"
110 #undef TP_printk
111 #define TP_printk(fmt, args...) "%s, %s\n", #fmt, #args
113 #undef TP_fast_assign
114 #define TP_fast_assign(args...) args
116 #undef TRACE_EVENT
117 #define TRACE_EVENT(call, proto, args, tstruct, func, print) \
118 static int \
119 ftrace_format_##call(struct trace_seq *s) \
121 struct ftrace_raw_##call field; \
122 int ret; \
124 tstruct; \
126 trace_seq_printf(s, "\nprint fmt: " print); \
128 return ret; \
131 #include <trace/trace_event_types.h>
133 #undef __field
134 #define __field(type, item) \
135 ret = trace_define_field(event_call, #type, #item, \
136 offsetof(typeof(field), item), \
137 sizeof(field.item)); \
138 if (ret) \
139 return ret;
141 #undef __array
142 #define __array(type, item, len) \
143 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
144 offsetof(typeof(field), item), \
145 sizeof(field.item)); \
146 if (ret) \
147 return ret;
149 #define __common_field(type, item) \
150 ret = trace_define_field(event_call, #type, "common_" #item, \
151 offsetof(typeof(field.ent), item), \
152 sizeof(field.ent.item)); \
153 if (ret) \
154 return ret;
156 #undef TRACE_EVENT
157 #define TRACE_EVENT(call, proto, args, tstruct, func, print) \
158 int \
159 ftrace_define_fields_##call(void) \
161 struct ftrace_raw_##call field; \
162 struct ftrace_event_call *event_call = &event_##call; \
163 int ret; \
165 __common_field(unsigned char, type); \
166 __common_field(unsigned char, flags); \
167 __common_field(unsigned char, preempt_count); \
168 __common_field(int, pid); \
169 __common_field(int, tgid); \
171 tstruct; \
173 return ret; \
176 #include <trace/trace_event_types.h>