Skip to content

Commit d1bcf17

Browse files
changbinduacmel
authored andcommitted
perf ftrace: Add support for trace option funcgraph-irqs
This adds an option '--graph-opts noirqs' to filter out functions executed in irq context. Signed-off-by: Changbin Du <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 38988f2 commit d1bcf17

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

tools/perf/Documentation/perf-ftrace.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ OPTIONS
104104
--graph-opts::
105105
List of options allowed to set:
106106
nosleep-time - Measure on-CPU time only for function_graph tracer.
107+
noirqs - Ignore functions that happen inside interrupt.
107108

108109
SEE ALSO
109110
--------

tools/perf/builtin-ftrace.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ struct perf_ftrace {
4545
bool inherit;
4646
int func_stack_trace;
4747
int graph_nosleep_time;
48+
int graph_noirqs;
4849
};
4950

5051
struct filter_entry {
@@ -207,6 +208,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused)
207208
write_tracing_option_file("function-fork", "0");
208209
write_tracing_option_file("func_stack_trace", "0");
209210
write_tracing_option_file("sleep-time", "1");
211+
write_tracing_option_file("funcgraph-irqs", "1");
210212
}
211213

212214
static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused)
@@ -399,6 +401,17 @@ static int set_tracing_sleep_time(struct perf_ftrace *ftrace)
399401
return 0;
400402
}
401403

404+
static int set_tracing_funcgraph_irqs(struct perf_ftrace *ftrace)
405+
{
406+
if (!ftrace->graph_noirqs)
407+
return 0;
408+
409+
if (write_tracing_option_file("funcgraph-irqs", "0") < 0)
410+
return -1;
411+
412+
return 0;
413+
}
414+
402415
static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
403416
{
404417
char *trace_file;
@@ -483,6 +496,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
483496
goto out_reset;
484497
}
485498

499+
if (set_tracing_funcgraph_irqs(ftrace) < 0) {
500+
pr_err("failed to set tracing option funcgraph-irqs\n");
501+
goto out_reset;
502+
}
503+
486504
if (write_tracing_file("current_tracer", ftrace->tracer) < 0) {
487505
pr_err("failed to set current_tracer to %s\n", ftrace->tracer);
488506
goto out_reset;
@@ -662,6 +680,7 @@ static int parse_graph_tracer_opts(const struct option *opt,
662680
struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value;
663681
struct sublevel_option graph_tracer_opts[] = {
664682
{ .name = "nosleep-time", .value_ptr = &ftrace->graph_nosleep_time },
683+
{ .name = "noirqs", .value_ptr = &ftrace->graph_noirqs },
665684
{ .name = NULL, }
666685
};
667686

@@ -733,7 +752,7 @@ int cmd_ftrace(int argc, const char **argv)
733752
OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth,
734753
"Max depth for function graph tracer"),
735754
OPT_CALLBACK(0, "graph-opts", &ftrace, "options",
736-
"graph tracer options, available options: nosleep-time",
755+
"graph tracer options, available options: nosleep-time,noirqs",
737756
parse_graph_tracer_opts),
738757
OPT_CALLBACK('m', "buffer-size", &ftrace.percpu_buffer_size, "size",
739758
"size of per cpu buffer", parse_buffer_size),

0 commit comments

Comments
 (0)