Sometimes we want ftrace display more and longer information about the trace. $ sudo perf ftrace -G '*' 2) 0.979 us | mutex_unlock(); 2) 1.540 us | __fsnotify_parent(); 2) 0.433 us | fsnotify(); $ sudo perf ftrace -G '*' --graph-opts verbose 14160.770883 | 0) <...>-47814 | .... | 1.289 us | mutex_unlock(); 14160.770886 | 0) <...>-47814 | .... | 1.624 us | __fsnotify_parent(); 14160.770887 | 0) <...>-47814 | .... | 0.636 us | fsnotify(); 14160.770888 | 0) <...>-47814 | .... | 0.328 us | __sb_end_write(); 14160.770888 | 0) <...>-47814 | d... | 0.430 us | fpregs_assert_state_consistent(); 14160.770889 | 0) <...>-47814 | d... | | do_syscall_64() { 14160.770889 | 0) <...>-47814 | .... | | __x64_sys_close() {
Unified · Split
| @@ -106,6 +106,7 @@ OPTIONS · 105 unmodified lines | ||
| 106 | 106 | List of options allowed to set: |
| 107 | 107 | nosleep-time - Measure on-CPU time only for function_graph tracer. |
| 108 | 108 | noirqs - Ignore functions that happen inside interrupt. |
| 109 | + verbose - Show process names, PIDs, timestamps, etc. | |
| 109 | 110 | |
| 110 | 111 | SEE ALSO |
| 111 | 112 | -------- |
| @@ -47,6 +47,7 @@ struct perf_ftrace { · 46 unmodified lines | ||
| 47 | 47 | int func_irq_info; |
| 48 | 48 | int graph_nosleep_time; |
| 49 | 49 | int graph_noirqs; |
| 50 | + int graph_verbose; | |
| 50 | 51 | }; |
| 51 | 52 | |
| 52 | 53 | struct filter_entry { |
| @@ -210,6 +211,9 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) · 157 unmodified lines | ||
| 210 | 211 | write_tracing_option_file("func_stack_trace", "0"); |
| 211 | 212 | write_tracing_option_file("sleep-time", "1"); |
| 212 | 213 | write_tracing_option_file("funcgraph-irqs", "1"); |
| 214 | + write_tracing_option_file("funcgraph-proc", "0"); | |
| 215 | + write_tracing_option_file("funcgraph-abstime", "0"); | |
| 216 | + write_tracing_option_file("latency-format", "0"); | |
| 213 | 217 | write_tracing_option_file("irq-info", "0"); |
| 214 | 218 | } |
| 215 | 219 | |
| @@ -425,6 +429,23 @@ static int set_tracing_funcgraph_irqs(struct perf_ftrace *ftrace) · 209 unmodified lines | ||
| 425 | 429 | return 0; |
| 426 | 430 | } |
| 427 | 431 | |
| 432 | +static int set_tracing_funcgraph_verbose(struct perf_ftrace *ftrace) | |
| 433 | +{ | |
| 434 | + if (!ftrace->graph_verbose) | |
| 435 | + return 0; | |
| 436 | + | |
| 437 | + if (write_tracing_option_file("funcgraph-proc", "1") < 0) | |
| 438 | + return -1; | |
| 439 | + | |
| 440 | + if (write_tracing_option_file("funcgraph-abstime", "1") < 0) | |
| 441 | + return -1; | |
| 442 | + | |
| 443 | + if (write_tracing_option_file("latency-format", "1") < 0) | |
| 444 | + return -1; | |
| 445 | + | |
| 446 | + return 0; | |
| 447 | +} | |
| 448 | + | |
| 428 | 449 | static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) |
| 429 | 450 | { |
| 430 | 451 | char *trace_file; |
| @@ -519,6 +540,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) · 88 unmodified lines | ||
| 519 | 540 | goto out_reset; |
| 520 | 541 | } |
| 521 | 542 | |
| 543 | + if (set_tracing_funcgraph_verbose(ftrace) < 0) { | |
| 544 | + pr_err("failed to set tracing option funcgraph-proc/funcgraph-abstime\n"); | |
| 545 | + goto out_reset; | |
| 546 | + } | |
| 547 | + | |
| 522 | 548 | if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { |
| 523 | 549 | pr_err("failed to set current_tracer to %s\n", ftrace->tracer); |
| 524 | 550 | goto out_reset; |
| @@ -700,6 +726,7 @@ static int parse_graph_tracer_opts(const struct option *opt, · 175 unmodified lines | ||
| 700 | 726 | struct sublevel_option graph_tracer_opts[] = { |
| 701 | 727 | { .name = "nosleep-time", .value_ptr = &ftrace->graph_nosleep_time }, |
| 702 | 728 | { .name = "noirqs", .value_ptr = &ftrace->graph_noirqs }, |
| 729 | + { .name = "verbose", .value_ptr = &ftrace->graph_verbose }, | |
| 703 | 730 | { .name = NULL, } |
| 704 | 731 | }; |
| 705 | 732 | |
| @@ -771,7 +798,7 @@ int cmd_ftrace(int argc, const char **argv) · 65 unmodified lines | ||
| 771 | 798 | OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth, |
| 772 | 799 | "Max depth for function graph tracer"), |
| 773 | 800 | OPT_CALLBACK(0, "graph-opts", &ftrace, "options", |
| 774 | − "graph tracer options, available options: nosleep-time,noirqs", | |
| 801 | + "graph tracer options, available options: nosleep-time,noirqs,verbose", | |
| 775 | 802 | parse_graph_tracer_opts), |
| 776 | 803 | OPT_CALLBACK('m', "buffer-size", &ftrace.percpu_buffer_size, "size", |
| 777 | 804 | "size of per cpu buffer", parse_buffer_size), |