diff options
Diffstat (limited to 'kernel/trace/trace_export.c')
-rw-r--r-- | kernel/trace/trace_export.c | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 07a22c33ebf3..f4e46616c48e 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | 31 | ||
32 | #undef TRACE_FIELD_SPECIAL | 32 | #undef TRACE_FIELD_SPECIAL |
33 | #define TRACE_FIELD_SPECIAL(type_item, item, cmd) \ | 33 | #define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \ |
34 | ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \ | 34 | ret = trace_seq_printf(s, "\tfield special:" #type_item ";\t" \ |
35 | "offset:%u;\tsize:%u;\n", \ | 35 | "offset:%u;\tsize:%u;\n", \ |
36 | (unsigned int)offsetof(typeof(field), item), \ | 36 | (unsigned int)offsetof(typeof(field), item), \ |
@@ -85,18 +85,69 @@ ftrace_format_##call(struct trace_seq *s) \ | |||
85 | #define TRACE_ENTRY entry | 85 | #define TRACE_ENTRY entry |
86 | 86 | ||
87 | #undef TRACE_FIELD_SPECIAL | 87 | #undef TRACE_FIELD_SPECIAL |
88 | #define TRACE_FIELD_SPECIAL(type_item, item, cmd) \ | 88 | #define TRACE_FIELD_SPECIAL(type_item, item, len, cmd) \ |
89 | cmd; | 89 | cmd; |
90 | 90 | ||
91 | #undef TRACE_EVENT_FORMAT | 91 | #undef TRACE_EVENT_FORMAT |
92 | #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \ | 92 | #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \ |
93 | int ftrace_define_fields_##call(void); \ | ||
94 | static int ftrace_raw_init_event_##call(void); \ | ||
93 | \ | 95 | \ |
94 | static struct ftrace_event_call __used \ | 96 | struct ftrace_event_call __used \ |
95 | __attribute__((__aligned__(4))) \ | 97 | __attribute__((__aligned__(4))) \ |
96 | __attribute__((section("_ftrace_events"))) event_##call = { \ | 98 | __attribute__((section("_ftrace_events"))) event_##call = { \ |
97 | .name = #call, \ | 99 | .name = #call, \ |
98 | .id = proto, \ | 100 | .id = proto, \ |
99 | .system = __stringify(TRACE_SYSTEM), \ | 101 | .system = __stringify(TRACE_SYSTEM), \ |
102 | .raw_init = ftrace_raw_init_event_##call, \ | ||
100 | .show_format = ftrace_format_##call, \ | 103 | .show_format = ftrace_format_##call, \ |
104 | .define_fields = ftrace_define_fields_##call, \ | ||
105 | }; \ | ||
106 | static int ftrace_raw_init_event_##call(void) \ | ||
107 | { \ | ||
108 | INIT_LIST_HEAD(&event_##call.fields); \ | ||
109 | return 0; \ | ||
110 | } \ | ||
111 | |||
112 | #include "trace_event_types.h" | ||
113 | |||
114 | #undef TRACE_FIELD | ||
115 | #define TRACE_FIELD(type, item, assign) \ | ||
116 | ret = trace_define_field(event_call, #type, #item, \ | ||
117 | offsetof(typeof(field), item), \ | ||
118 | sizeof(field.item)); \ | ||
119 | if (ret) \ | ||
120 | return ret; | ||
121 | |||
122 | #undef TRACE_FIELD_SPECIAL | ||
123 | #define TRACE_FIELD_SPECIAL(type, item, len, cmd) \ | ||
124 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | ||
125 | offsetof(typeof(field), item), \ | ||
126 | sizeof(field.item)); \ | ||
127 | if (ret) \ | ||
128 | return ret; | ||
129 | |||
130 | #undef TRACE_FIELD_ZERO_CHAR | ||
131 | #define TRACE_FIELD_ZERO_CHAR(item) | ||
132 | |||
133 | #undef TRACE_EVENT_FORMAT | ||
134 | #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \ | ||
135 | int \ | ||
136 | ftrace_define_fields_##call(void) \ | ||
137 | { \ | ||
138 | struct ftrace_event_call *event_call = &event_##call; \ | ||
139 | struct args field; \ | ||
140 | int ret; \ | ||
141 | \ | ||
142 | __common_field(unsigned char, type); \ | ||
143 | __common_field(unsigned char, flags); \ | ||
144 | __common_field(unsigned char, preempt_count); \ | ||
145 | __common_field(int, pid); \ | ||
146 | __common_field(int, tgid); \ | ||
147 | \ | ||
148 | tstruct; \ | ||
149 | \ | ||
150 | return ret; \ | ||
101 | } | 151 | } |
152 | |||
102 | #include "trace_event_types.h" | 153 | #include "trace_event_types.h" |