From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755861AbdCGPUA (ORCPT ); Tue, 7 Mar 2017 10:20:00 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33514 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755623AbdCGPS1 (ORCPT ); Tue, 7 Mar 2017 10:18:27 -0500 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , kernel-team@lge.com Subject: [PATCH 15/23] perf lock: Add -q/--quiet option Date: Wed, 8 Mar 2017 00:08:43 +0900 Message-Id: <20170307150851.22304-16-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. Also move -f option to parent and link child options. Suggested-by: Arnaldo Carvalho de Melo Signed-off-by: Namhyung Kim --- tools/perf/Documentation/perf-lock.txt | 8 ++++++++ tools/perf/builtin-lock.c | 33 ++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/tools/perf/Documentation/perf-lock.txt b/tools/perf/Documentation/perf-lock.txt index ab25be28c9dc..1c4a548455ee 100644 --- a/tools/perf/Documentation/perf-lock.txt +++ b/tools/perf/Documentation/perf-lock.txt @@ -42,6 +42,14 @@ COMMON OPTIONS --dump-raw-trace:: Dump raw trace in ASCII. +-q:: +--quiet:: + Do not show any message. + +-f:: +--force:: + Don't do ownership validation. + REPORT OPTIONS -------------- diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index ce3bfb48b26f..8197e5672413 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -947,30 +947,26 @@ static int __cmd_record(int argc, const char **argv) int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) { - const struct option info_options[] = { - OPT_BOOLEAN('t', "threads", &info_threads, - "dump thread list in perf.data"), - OPT_BOOLEAN('m', "map", &info_map, - "map of lock instances (address:name table)"), - OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), - OPT_END() - }; const struct option lock_options[] = { OPT_STRING('i', "input", &input_name, "file", "input file name"), OPT_INCR('v', "verbose", &verbose, "be more verbose (show symbol address, etc)"), OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, "dump raw trace in ASCII"), + OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), + OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), OPT_END() }; const struct option report_options[] = { OPT_STRING('k', "key", &sort_key, "acquired", "key for sorting (acquired / contended / avg_wait / wait_total / wait_max / wait_min)"), - OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), /* TODO: type */ - OPT_END() + OPT_PARENT(lock_options) }; - const char * const info_usage[] = { - "perf lock info []", - NULL + const struct option info_options[] = { + OPT_BOOLEAN('t', "threads", &info_threads, + "dump thread list in perf.data"), + OPT_BOOLEAN('m', "map", &info_map, + "map of lock instances (address:name table)"), + OPT_PARENT(lock_options) }; const char *const lock_subcommands[] = { "record", "report", "script", "info", NULL }; @@ -982,6 +978,10 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) "perf lock report []", NULL }; + const char * const info_usage[] = { + "perf lock info []", + NULL + }; unsigned int i; int rc = 0; @@ -993,6 +993,9 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) if (!argc) usage_with_options(lock_usage, lock_options); + if (quiet) + perf_quiet_option(); + if (!strncmp(argv[0], "rec", 3)) { return __cmd_record(argc, argv); } else if (!strncmp(argv[0], "report", 6)) { @@ -1002,6 +1005,8 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) report_options, report_usage, 0); if (argc) usage_with_options(report_usage, report_options); + if (quiet && verbose >= 0) + perf_quiet_option(); } rc = __cmd_report(false); } else if (!strcmp(argv[0], "script")) { @@ -1013,6 +1018,8 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) info_options, info_usage, 0); if (argc) usage_with_options(info_usage, info_options); + if (quiet && verbose >= 0) + perf_quiet_option(); } /* recycling report_lock_ops */ trace_handler = &report_lock_ops; -- 2.11.0