History

perf ftrace: Add option 'verbose' to show more info for graph tracer

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() {

Changbin Du committed 6 years ago

Commit 59486fb1 parent c81fc342 files · +29 −1Browse files

Unified · Split

2 files
  1. tools/perf/Documentation/perf-ftrace.txt +1 −0
  2. tools/perf/builtin-ftrace.c +28 −1
tools/perf/Documentation/perf-ftrace.txt+1−0
@@ -106,6 +106,7 @@ OPTIONS · 105 unmodified lines
106106 List of options allowed to set:
107107 nosleep-time - Measure on-CPU time only for function_graph tracer.
108108 noirqs - Ignore functions that happen inside interrupt.
109+ verbose - Show process names, PIDs, timestamps, etc.
109110
110111 SEE ALSO
111112 --------
tools/perf/builtin-ftrace.c+28−1
@@ -47,6 +47,7 @@ struct perf_ftrace { · 46 unmodified lines
4747 int func_irq_info;
4848 int graph_nosleep_time;
4949 int graph_noirqs;
50+ int graph_verbose;
5051 };
5152
5253 struct filter_entry {
@@ -210,6 +211,9 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) · 157 unmodified lines
210211 write_tracing_option_file("func_stack_trace", "0");
211212 write_tracing_option_file("sleep-time", "1");
212213 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");
213217 write_tracing_option_file("irq-info", "0");
214218 }
215219
@@ -425,6 +429,23 @@ static int set_tracing_funcgraph_irqs(struct perf_ftrace *ftrace) · 209 unmodified lines
425429 return 0;
426430 }
427431
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+
428449 static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
429450 {
430451 char *trace_file;
@@ -519,6 +540,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) · 88 unmodified lines
519540 goto out_reset;
520541 }
521542
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+
522548 if (write_tracing_file("current_tracer", ftrace->tracer) < 0) {
523549 pr_err("failed to set current_tracer to %s\n", ftrace->tracer);
524550 goto out_reset;
@@ -700,6 +726,7 @@ static int parse_graph_tracer_opts(const struct option *opt, · 175 unmodified lines
700726 struct sublevel_option graph_tracer_opts[] = {
701727 { .name = "nosleep-time", .value_ptr = &ftrace->graph_nosleep_time },
702728 { .name = "noirqs", .value_ptr = &ftrace->graph_noirqs },
729+ { .name = "verbose", .value_ptr = &ftrace->graph_verbose },
703730 { .name = NULL, }
704731 };
705732
@@ -771,7 +798,7 @@ int cmd_ftrace(int argc, const char **argv) · 65 unmodified lines
771798 OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth,
772799 "Max depth for function graph tracer"),
773800 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",
775802 parse_graph_tracer_opts),
776803 OPT_CALLBACK('m', "buffer-size", &ftrace.percpu_buffer_size, "size",
777804 "size of per cpu buffer", parse_buffer_size),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t