[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170307150851.22304-15-namhyung@kernel.org>
Date: Wed, 8 Mar 2017 00:08:42 +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 14/23] perf list: 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.
Suggested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/Documentation/perf-list.txt | 9 ++++++++-
tools/perf/builtin-list.c | 9 +++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
index 41857cce5e86..7964d0e9dc8a 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -8,7 +8,7 @@ perf-list - List all symbolic event types
SYNOPSIS
--------
[verse]
-'perf list' [--no-desc] [--long-desc] [hw|sw|cache|tracepoint|pmu|event_glob]
+'perf list' <options> [hw|sw|cache|tracepoint|pmu|event_glob]
DESCRIPTION
-----------
@@ -24,6 +24,13 @@ Don't print descriptions.
--long-desc::
Print longer event descriptions.
+-q::
+--quiet::
+ Do not show any message.
+
+--debug::
+ Enable debugging output.
+
[[EVENT_MODIFIERS]]
EVENT MODIFIERS
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 3b9d98b5feef..b53b3597ee0f 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -32,6 +32,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
"Print longer event descriptions."),
OPT_INCR(0, "debug", &verbose,
"Enable debugging output"),
+ OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
OPT_END()
};
const char * const list_usage[] = {
@@ -44,9 +45,12 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
argc = parse_options(argc, argv, list_options, list_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
+ if (quiet)
+ perf_quiet_option();
+
setup_pager();
- if (!raw_dump && pager_in_use())
+ if (!raw_dump && pager_in_use() && !quiet)
printf("\nList of pre-defined events (to be used in -e):\n\n");
if (argc == 0) {
@@ -94,7 +98,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
free(s);
} else {
if (asprintf(&s, "*%s*", argv[i]) < 0) {
- printf("Critical: Not enough memory! Trying to continue...\n");
+ if (!quiet)
+ printf("Critical: Not enough memory! Trying to continue...\n");
continue;
}
print_symbol_events(s, PERF_TYPE_HARDWARE,
--
2.11.0
Powered by blists - more mailing lists