diff options
Diffstat (limited to 'trace-ftrace.c')
-rw-r--r-- | trace-ftrace.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/trace-ftrace.c b/trace-ftrace.c index 193e85d..76aef5b 100644 --- a/trace-ftrace.c +++ b/trace-ftrace.c | |||
@@ -25,6 +25,20 @@ | |||
25 | 25 | ||
26 | #include "trace-cmd.h" | 26 | #include "trace-cmd.h" |
27 | 27 | ||
28 | struct plugin_option trace_ftrace_options[] = { | ||
29 | { | ||
30 | .name = "tailprint", | ||
31 | .plugin_alias = "fgraph", | ||
32 | .description = | ||
33 | "Print function name at function exit in function graph", | ||
34 | }, | ||
35 | { | ||
36 | .name = NULL, | ||
37 | } | ||
38 | }; | ||
39 | |||
40 | static struct plugin_option *fgraph_tail = &trace_ftrace_options[0]; | ||
41 | |||
28 | static void find_long_size(struct tracecmd_ftrace *finfo) | 42 | static void find_long_size(struct tracecmd_ftrace *finfo) |
29 | { | 43 | { |
30 | finfo->long_size = tracecmd_long_size(finfo->handle); | 44 | finfo->long_size = tracecmd_long_size(finfo->handle); |
@@ -290,6 +304,8 @@ fgraph_ret_handler(struct trace_seq *s, struct record *record, | |||
290 | struct tracecmd_ftrace *finfo = context; | 304 | struct tracecmd_ftrace *finfo = context; |
291 | unsigned long long rettime, calltime; | 305 | unsigned long long rettime, calltime; |
292 | unsigned long long duration, depth; | 306 | unsigned long long duration, depth; |
307 | unsigned long long val; | ||
308 | const char *func; | ||
293 | int i; | 309 | int i; |
294 | 310 | ||
295 | ret_event_check(finfo, event->pevent); | 311 | ret_event_check(finfo, event->pevent); |
@@ -317,6 +333,15 @@ fgraph_ret_handler(struct trace_seq *s, struct record *record, | |||
317 | 333 | ||
318 | trace_seq_putc(s, '}'); | 334 | trace_seq_putc(s, '}'); |
319 | 335 | ||
336 | if (fgraph_tail->set) { | ||
337 | if (pevent_get_field_val(s, event, "func", record, &val, 0)) | ||
338 | return 0; | ||
339 | func = pevent_find_function(event->pevent, val); | ||
340 | if (!func) | ||
341 | return 0; | ||
342 | trace_seq_printf(s, " /* %s */", func); | ||
343 | } | ||
344 | |||
320 | return 0; | 345 | return 0; |
321 | } | 346 | } |
322 | 347 | ||