[PATCH 09/23] perf ftrace: Add -q/--quiet option

From: Namhyung Kim
Date: Tue Mar 07 2017 - 14:39:49 EST


The -q/--quiet option is to suppress any message. Sometimes users just
want to run the command and it can be used for that case.

Suggested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/Documentation/perf-ftrace.txt | 4 ++++
tools/perf/builtin-ftrace.c | 7 +++++--
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-ftrace.txt b/tools/perf/Documentation/perf-ftrace.txt
index 6e6a8b22c859..361836114268 100644
--- a/tools/perf/Documentation/perf-ftrace.txt
+++ b/tools/perf/Documentation/perf-ftrace.txt
@@ -30,6 +30,10 @@ OPTIONS
--verbose=::
Verbosity level.

+-q::
+--quiet::
+ Do not show any message.
+
-p::
--pid=::
Trace on existing process id (comma separated list).
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 6087295f8827..2d8e8924cfe6 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -321,8 +321,8 @@ int cmd_ftrace(int argc, const char **argv, const char *prefix __maybe_unused)
"tracer to use: function_graph(default) or function"),
OPT_STRING('p', "pid", &ftrace.target.pid, "pid",
"trace on existing process id"),
- OPT_INCR('v', "verbose", &verbose,
- "be more verbose"),
+ OPT_INCR('v', "verbose", &verbose, "be more verbose"),
+ OPT_BOOLEAN('q', "quiet", &quiet, "do not show any message"),
OPT_BOOLEAN('a', "all-cpus", &ftrace.target.system_wide,
"system-wide collection from all CPUs"),
OPT_STRING('C', "cpu", &ftrace.target.cpu_list, "cpu",
@@ -339,6 +339,9 @@ int cmd_ftrace(int argc, const char **argv, const char *prefix __maybe_unused)
if (!argc && target__none(&ftrace.target))
usage_with_options(ftrace_usage, ftrace_options);

+ if (quiet)
+ perf_quiet_option();
+
ret = target__validate(&ftrace.target);
if (ret) {
char errbuf[512];
--
2.11.0