[PATCH v3 16/17] perf: ftrace: allow set graph depth by '--graph-opts'

From: Changbin Du
Date: Wed Jul 08 2020 - 12:48:39 EST


This is to have a consistent view of all graph tracer options.
The original option '--graph-depth' is marked as deprecated.

Signed-off-by: Changbin Du <changbin.du@xxxxxxxxx>
---
tools/perf/Documentation/perf-ftrace.txt | 4 +++-
tools/perf/builtin-ftrace.c | 5 +++--
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Documentation/perf-ftrace.txt b/tools/perf/Documentation/perf-ftrace.txt
index bcb1504892ef..fa99ec1ef58a 100644
--- a/tools/perf/Documentation/perf-ftrace.txt
+++ b/tools/perf/Documentation/perf-ftrace.txt
@@ -105,7 +105,8 @@ OPTIONS

-D::
--graph-depth=::
- Set max depth for function graph tracer to follow
+ Set max depth for function graph tracer to follow. This option is
+ deprecated, use '--graph-opts depth=<n>' instead.

--graph-opts::
List of options allowed to set:
@@ -113,6 +114,7 @@ OPTIONS
noirqs - Ignore functions that happen inside interrupt.
verbose - Show process names, PIDs, timestamps, etc.
thresh=<n> - Setup trace duration threshold in microseconds.
+ depth=<n> - Set max depth for function graph tracer to follow.

SEE ALSO
--------
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 21d6d6791dc3..a20187b1556a 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -758,6 +758,7 @@ static int parse_graph_tracer_opts(const struct option *opt,
{ .name = "noirqs", .value_ptr = &ftrace->graph_noirqs },
{ .name = "verbose", .value_ptr = &ftrace->graph_verbose },
{ .name = "thresh", .value_ptr = &ftrace->graph_thresh },
+ { .name = "depth", .value_ptr = &ftrace->graph_depth },
{ .name = NULL, }
};

@@ -812,9 +813,9 @@ int cmd_ftrace(int argc, const char **argv)
OPT_CALLBACK('g', "nograph-funcs", &ftrace.nograph_funcs, "func",
"Set nograph filter on given functions", parse_filter_func),
OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth,
- "Max depth for function graph tracer"),
+ "Max depth for function graph tracer (This option is deprecated)"),
OPT_CALLBACK(0, "graph-opts", &ftrace, "options",
- "graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=<n>",
+ "graph tracer options, available options: nosleep-time,noirqs,verbose,thresh=<n>,depth=<n>",
parse_graph_tracer_opts),
OPT_UINTEGER('d', "delay", &ftrace.initial_delay,
"ms to wait before starting tracing after program start"),
--
2.25.1