From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932792AbdCGPVe (ORCPT ); Tue, 7 Mar 2017 10:21:34 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33978 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753429AbdCGPTT (ORCPT ); Tue, 7 Mar 2017 10:19:19 -0500 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , kernel-team@lge.com Subject: [PATCH 22/23] perf top: Add -q/--quiet option Date: Wed, 8 Mar 2017 00:08:50 +0900 Message-Id: <20170307150851.22304-23-namhyung@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170307150851.22304-1-namhyung@kernel.org> References: <20170307150851.22304-1-namhyung@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Namhyung Kim --- 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