diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 414444d0e919..c3e643666c72 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -17,6 +17,7 @@ #include "evlist.h" #include "target.h" #include "thread_map.h" +#include "util/config.h" #define DEFAULT_TRACER "function_graph" @@ -198,6 +199,26 @@ out: return done ? 0 : -1; } +static int perf_ftrace_config(const char *var, const char *value, void *cb) +{ + struct perf_ftrace *ftrace = cb; + + if (prefixcmp(var, "ftrace.")) + return 0; + + if (strcmp(var, "ftrace.tracer")) + return -1; + + if (!strcmp(value, "function_graph") || + !strcmp(value, "function")) { + ftrace->tracer = value; + return 0; + } + + pr_err("Please select \"function_graph\" (default) or \"function\"\n"); + return -1; +} + int cmd_ftrace(int argc, const char **argv, const char *prefix __maybe_unused) { int ret; @@ -218,6 +239,10 @@ int cmd_ftrace(int argc, const char **argv, const char *prefix __maybe_unused) OPT_END() }; + ret = perf_config(perf_ftrace_config, &ftrace); + if (ret < 0) + return -1; + argc = parse_options(argc, argv, ftrace_options, ftrace_usage, PARSE_OPT_STOP_AT_NON_OPTION); if (!argc)