[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170307150851.22304-9-namhyung@kernel.org>
Date: Wed, 8 Mar 2017 00:08:36 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Jiri Olsa <jolsa@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, kernel-team@....com
Subject: [PATCH 08/23] perf evlist: Add -q/--quiet option
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.
Before:
$ perf evlist -i perf.data.kmem
kmem:kmalloc
kmem:kmalloc_node
kmem:kfree
kmem:kmem_cache_alloc
kmem:kmem_cache_alloc_node
kmem:kmem_cache_free
kmem:mm_page_alloc
kmem:mm_page_free
# Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
After:
$ perf evlist -i perf.data.kmem -q
kmem:kmalloc
kmem:kmalloc_node
kmem:kfree
kmem:kmem_cache_alloc
kmem:kmem_cache_alloc_node
kmem:kmem_cache_free
kmem:mm_page_alloc
kmem:mm_page_free
Suggested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/Documentation/perf-evlist.txt | 4 ++++
tools/perf/builtin-evlist.c | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/perf-evlist.txt b/tools/perf/Documentation/perf-evlist.txt
index 6f7200fb85cf..033aac0d4d79 100644
--- a/tools/perf/Documentation/perf-evlist.txt
+++ b/tools/perf/Documentation/perf-evlist.txt
@@ -28,6 +28,10 @@ OPTIONS
--verbose=::
Show all fields.
+-q::
+--quiet::
+ Do not show any message.
+
-g::
--group::
Show event group information.
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c
index e09c4287fe87..37c2cf7d395f 100644
--- a/tools/perf/builtin-evlist.c
+++ b/tools/perf/builtin-evlist.c
@@ -39,7 +39,7 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details
has_tracepoint = true;
}
- if (has_tracepoint && !details->trace_fields)
+ if (has_tracepoint && !details->trace_fields && !quiet)
printf("# Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events\n");
perf_session__delete(session);
@@ -54,6 +54,7 @@ int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('F', "freq", &details.freq, "Show the sample frequency"),
OPT_BOOLEAN('v', "verbose", &details.verbose,
"Show all event attr details"),
+ OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
OPT_BOOLEAN('g', "group", &details.event_group,
"Show event group information"),
OPT_BOOLEAN('f', "force", &details.force, "don't complain, do it"),
@@ -69,6 +70,11 @@ int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
if (argc)
usage_with_options(evlist_usage, options);
+ if (quiet) {
+ perf_quiet_option();
+ details.verbose = false;
+ }
+
if (details.event_group && (details.verbose || details.freq)) {
usage_with_options_msg(evlist_usage, options,
"--group option is not compatible with other options\n");
--
2.11.0
Powered by blists - more mailing lists