[PATCH 19/23] perf script: Add -q/--quiet option

From: Namhyung Kim
Date: Tue Mar 07 2017 - 10:23:02 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-script.txt | 8 ++++++++
tools/perf/builtin-script.c | 4 ++++
2 files changed, 12 insertions(+)

diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index 4ed5f239ba7d..24f7e36a4fe8 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -75,6 +75,14 @@ OPTIONS
<command>...::
Any command you can specify in a shell.

+-v::
+--verbose::
+ Be more verbose. (show debug messages, etc)
+
+-q::
+--quiet::
+ Do not show any message. (Suppress -v)
+
-D::
--dump-raw-trace=::
Display verbose dump of the trace data.
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d1c95f0b8a0f..f46498f2e73a 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2122,6 +2122,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
"dump raw trace in ASCII"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show symbol address, etc)"),
+ OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
OPT_BOOLEAN('L', "Latency", &latency_format,
"show latency attributes (irqs/preemption disabled, etc)"),
OPT_CALLBACK_NOOPT('l', "list", NULL, NULL, "list available scripts",
@@ -2210,6 +2211,9 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
argc = parse_options_subcommand(argc, argv, options, script_subcommands, script_usage,
PARSE_OPT_STOP_AT_NON_OPTION);

+ if (quiet)
+ perf_quiet_option();
+
file.path = input_name;
file.force = symbol_conf.force;

--
2.11.0