Skip to content

Commit c81fc34

Browse files
changbinduacmel
authored andcommitted
perf ftrace: Add support for tracing option 'irq-info'
This adds support to display irq context info for function tracer. To do this, just specify a '--func-opts irq-info' option. 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 d1bcf17 commit c81fc34

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
@@ -79,6 +79,7 @@ OPTIONS
7979
--func-opts::
8080
List of options allowed to set:
8181
call-graph - Display kernel stack trace for function tracer.
82+
irq-info - Display irq context info for function tracer.
8283

8384
-G::
8485
--graph-funcs=::

tools/perf/builtin-ftrace.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct perf_ftrace {
4444
unsigned long percpu_buffer_size;
4545
bool inherit;
4646
int func_stack_trace;
47+
int func_irq_info;
4748
int graph_nosleep_time;
4849
int graph_noirqs;
4950
};
@@ -209,6 +210,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused)
209210
write_tracing_option_file("func_stack_trace", "0");
210211
write_tracing_option_file("sleep-time", "1");
211212
write_tracing_option_file("funcgraph-irqs", "1");
213+
write_tracing_option_file("irq-info", "0");
212214
}
213215

214216
static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused)
@@ -296,6 +298,17 @@ static int set_tracing_func_stack_trace(struct perf_ftrace *ftrace)
296298
return 0;
297299
}
298300

301+
static int set_tracing_func_irqinfo(struct perf_ftrace *ftrace)
302+
{
303+
if (!ftrace->func_irq_info)
304+
return 0;
305+
306+
if (write_tracing_option_file("irq-info", "1") < 0)
307+
return -1;
308+
309+
return 0;
310+
}
311+
299312
static int reset_tracing_cpu(void)
300313
{
301314
struct perf_cpu_map *cpumap = perf_cpu_map__new(NULL);
@@ -471,6 +484,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
471484
goto out_reset;
472485
}
473486

487+
if (set_tracing_func_irqinfo(ftrace) < 0) {
488+
pr_err("failed to set tracing option irq-info\n");
489+
goto out_reset;
490+
}
491+
474492
if (set_tracing_filters(ftrace) < 0) {
475493
pr_err("failed to set tracing filters\n");
476494
goto out_reset;
@@ -660,6 +678,7 @@ static int parse_func_tracer_opts(const struct option *opt,
660678
struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value;
661679
struct sublevel_option func_tracer_opts[] = {
662680
{ .name = "call-graph", .value_ptr = &ftrace->func_stack_trace },
681+
{ .name = "irq-info", .value_ptr = &ftrace->func_irq_info },
663682
{ .name = NULL, }
664683
};
665684

@@ -742,7 +761,7 @@ int cmd_ftrace(int argc, const char **argv)
742761
OPT_CALLBACK('N', "notrace-funcs", &ftrace.notrace, "func",
743762
"do not trace given functions", parse_filter_func),
744763
OPT_CALLBACK(0, "func-opts", &ftrace, "options",
745-
"function tracer options, available options: call-graph",
764+
"function tracer options, available options: call-graph,irq-info",
746765
parse_func_tracer_opts),
747766
OPT_CALLBACK('G', "graph-funcs", &ftrace.graph_funcs, "func",
748767
"trace given functions using function_graph tracer",

0 commit comments

Comments
 (0)