diff options
Diffstat (limited to 'trace-ftrace.c')
-rw-r--r-- | trace-ftrace.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/trace-ftrace.c b/trace-ftrace.c index e6f7aa5..3e7ccde 100644 --- a/trace-ftrace.c +++ b/trace-ftrace.c | |||
@@ -31,13 +31,14 @@ static int function_handler(struct trace_seq *s, void *data, int size, | |||
31 | struct event *event, int cpu, | 31 | struct event *event, int cpu, |
32 | unsigned long long nsecs) | 32 | unsigned long long nsecs) |
33 | { | 33 | { |
34 | struct pevent *pevent = event->pevent; | ||
34 | unsigned long long function; | 35 | unsigned long long function; |
35 | const char *func; | 36 | const char *func; |
36 | 37 | ||
37 | if (get_field_val(s, data, event, "ip", &function)) | 38 | if (get_field_val(s, data, event, "ip", &function)) |
38 | return trace_seq_putc(s, '!'); | 39 | return trace_seq_putc(s, '!'); |
39 | 40 | ||
40 | func = pevent_find_function(function); | 41 | func = pevent_find_function(pevent, function); |
41 | if (func) | 42 | if (func) |
42 | trace_seq_printf(s, "%s <-- ", func); | 43 | trace_seq_printf(s, "%s <-- ", func); |
43 | else | 44 | else |
@@ -46,7 +47,7 @@ static int function_handler(struct trace_seq *s, void *data, int size, | |||
46 | if (get_field_val(s, data, event, "parent_ip", &function)) | 47 | if (get_field_val(s, data, event, "parent_ip", &function)) |
47 | return trace_seq_putc(s, '!'); | 48 | return trace_seq_putc(s, '!'); |
48 | 49 | ||
49 | func = pevent_find_function(function); | 50 | func = pevent_find_function(pevent, function); |
50 | if (func) | 51 | if (func) |
51 | trace_seq_printf(s, "%s", func); | 52 | trace_seq_printf(s, "%s", func); |
52 | else | 53 | else |
@@ -145,6 +146,7 @@ static int | |||
145 | print_graph_entry_leaf(struct trace_seq *s, | 146 | print_graph_entry_leaf(struct trace_seq *s, |
146 | struct event *event, void *data, struct record *ret_rec) | 147 | struct event *event, void *data, struct record *ret_rec) |
147 | { | 148 | { |
149 | struct pevent *pevent = event->pevent; | ||
148 | unsigned long long rettime, calltime; | 150 | unsigned long long rettime, calltime; |
149 | unsigned long long duration, depth; | 151 | unsigned long long duration, depth; |
150 | unsigned long long val; | 152 | unsigned long long val; |
@@ -175,7 +177,7 @@ print_graph_entry_leaf(struct trace_seq *s, | |||
175 | 177 | ||
176 | if (get_field_val(s, data, event, "func", &val)) | 178 | if (get_field_val(s, data, event, "func", &val)) |
177 | return trace_seq_putc(s, '!'); | 179 | return trace_seq_putc(s, '!'); |
178 | func = pevent_find_function(val); | 180 | func = pevent_find_function(pevent, val); |
179 | 181 | ||
180 | if (func) | 182 | if (func) |
181 | return trace_seq_printf(s, "%s();", func); | 183 | return trace_seq_printf(s, "%s();", func); |
@@ -186,6 +188,7 @@ print_graph_entry_leaf(struct trace_seq *s, | |||
186 | static int print_graph_nested(struct trace_seq *s, | 188 | static int print_graph_nested(struct trace_seq *s, |
187 | struct event *event, void *data) | 189 | struct event *event, void *data) |
188 | { | 190 | { |
191 | struct pevent *pevent = event->pevent; | ||
189 | unsigned long long depth; | 192 | unsigned long long depth; |
190 | unsigned long long val; | 193 | unsigned long long val; |
191 | const char *func; | 194 | const char *func; |
@@ -207,7 +210,7 @@ static int print_graph_nested(struct trace_seq *s, | |||
207 | if (get_field_val(s, data, event, "func", &val)) | 210 | if (get_field_val(s, data, event, "func", &val)) |
208 | return trace_seq_putc(s, '!'); | 211 | return trace_seq_putc(s, '!'); |
209 | 212 | ||
210 | func = pevent_find_function(val); | 213 | func = pevent_find_function(pevent, val); |
211 | 214 | ||
212 | if (func) | 215 | if (func) |
213 | return trace_seq_printf(s, "%s() {", func); | 216 | return trace_seq_printf(s, "%s() {", func); |
@@ -286,21 +289,24 @@ fgraph_ret_handler(struct trace_seq *s, void *data, int size, | |||
286 | return trace_seq_putc(s, '}'); | 289 | return trace_seq_putc(s, '}'); |
287 | } | 290 | } |
288 | 291 | ||
289 | int tracecmd_ftrace_overrides(void) | 292 | int tracecmd_ftrace_overrides(struct tracecmd_handle *handle) |
290 | { | 293 | { |
294 | struct pevent *pevent; | ||
291 | struct event *event; | 295 | struct event *event; |
292 | 296 | ||
293 | pevent_register_event_handler(-1, "ftrace", "function", | 297 | pevent = tracecmd_get_pevent(handle); |
298 | |||
299 | pevent_register_event_handler(pevent, -1, "ftrace", "function", | ||
294 | function_handler); | 300 | function_handler); |
295 | 301 | ||
296 | pevent_register_event_handler(-1, "ftrace", "funcgraph_entry", | 302 | pevent_register_event_handler(pevent, -1, "ftrace", "funcgraph_entry", |
297 | fgraph_ent_handler); | 303 | fgraph_ent_handler); |
298 | 304 | ||
299 | pevent_register_event_handler(-1, "ftrace", "funcgraph_exit", | 305 | pevent_register_event_handler(pevent, -1, "ftrace", "funcgraph_exit", |
300 | fgraph_ret_handler); | 306 | fgraph_ret_handler); |
301 | 307 | ||
302 | /* Store the func ret id and event for later use */ | 308 | /* Store the func ret id and event for later use */ |
303 | event = pevent_find_event_by_name("ftrace", "funcgraph_exit"); | 309 | event = pevent_find_event_by_name(pevent, "ftrace", "funcgraph_exit"); |
304 | if (!event) | 310 | if (!event) |
305 | return 0; | 311 | return 0; |
306 | 312 | ||