Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1594346

[PATCH 22/23] perf top: Add -q/--quiet option

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 22/23] perf top: Add -q/--quiet option
Date 2017-03-07 16:30 +0100
Message-ID <tipdM-11m-19@gated-at.bofh.it> (permalink)
References <tip46-X4-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Documentation/perf-top.txt | 4 ++++
 tools/perf/builtin-top.c              | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index e71d63843f45..eda5b58b1cd4 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -109,6 +109,10 @@ Default is to monitor all CPUS.
 --verbose::
 	Be more verbose (show counter open errors, etc).
 
+-q::
+--quiet::
+	Do not show any message.  (Suppress -v)
+
 -z::
 --zero::
 	Zero history across display updates.
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ab9077915763..18b68c8495d6 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -372,7 +372,7 @@ static void perf_top__prompt_symbol(struct perf_top *top, const char *msg)
 	}
 
 	if (!found) {
-		fprintf(stderr, "Sorry, %s is not active.\n", buf);
+		pr_err("Sorry, %s is not active.\n", buf);
 		sleep(1);
 	} else
 		perf_top__parse_source(top, found);
@@ -1142,6 +1142,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_BOOLEAN(0, "stdio", &top.use_stdio, "Use the stdio interface"),
 	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
+	OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
 	OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
 		   "sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..."
 		   " Please refer the man page for the complete list."),
@@ -1224,6 +1225,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (argc)
 		usage_with_options(top_usage, options);
 
+	if (quiet)
+		perf_quiet_option();
+
 	if (!top.evlist->nr_entries &&
 	    perf_evlist__add_default(top.evlist) < 0) {
 		pr_err("Not enough memory for event selector list\n");
-- 
2.11.0

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 22/23] perf top: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-03-07 16:30 +0100

csiph-web