Messages in this thread Patch in this message | | | From | Changbin Du <> | Subject | [PATCH 07/19] perf ftrace: add support for trace option funcgraph-irqs | Date | Sun, 10 May 2020 23:06:16 +0800 |
| |
This adds an option '--nofuncgraph-irqs' to filter out functions executed in irq context.
Signed-off-by: Changbin Du <changbin.du@gmail.com> --- tools/perf/builtin-ftrace.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index d3fcf3b0b792..b16600a16efa 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -41,6 +41,7 @@ struct perf_ftrace { int graph_depth; bool func_stack_trace; bool nosleep_time; + bool nofuncgraph_irqs; }; struct filter_entry { @@ -188,6 +189,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) { write_tracing_option_file("func_stack_trace", "0"); write_tracing_option_file("sleep-time", "1"); + write_tracing_option_file("funcgraph-irqs", "1"); } static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused) @@ -358,6 +360,17 @@ static int set_tracing_sleep_time(struct perf_ftrace *ftrace) return 0; } +static int set_tracing_funcgraph_irqs(struct perf_ftrace *ftrace) +{ + if (!ftrace->nofuncgraph_irqs) + return 0; + + if (write_tracing_option_file("funcgraph-irqs", "0") < 0) + return -1; + + return 0; +} + static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) { char *trace_file; @@ -431,6 +444,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) goto out_reset; } + if (set_tracing_funcgraph_irqs(ftrace) < 0) { + pr_err("failed to set tracing option funcgraph-irqs\n"); + goto out_reset; + } + if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { pr_err("failed to set current_tracer to %s\n", ftrace->tracer); goto out_reset; @@ -568,6 +586,8 @@ int cmd_ftrace(int argc, const char **argv) "Max depth for function graph tracer"), OPT_BOOLEAN(0, "nosleep-time", &ftrace.nosleep_time, "Measure on-CPU time only (function_graph only)"), + OPT_BOOLEAN(0, "nofuncgraph-irqs", &ftrace.nofuncgraph_irqs, + "Ignore functions that happen inside interrupt (function_graph only)"), OPT_END() }; -- 2.25.1
| |