From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751627AbdBUIQM (ORCPT ); Tue, 21 Feb 2017 03:16:12 -0500 Received: from terminus.zytor.com ([65.50.211.136]:56304 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951AbdBUIQE (ORCPT ); Tue, 21 Feb 2017 03:16:04 -0500 Date: Tue, 21 Feb 2017 00:15:49 -0800 From: tip-bot for Namhyung Kim Message-ID: Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, tglx@linutronix.de, hpa@zytor.com, namhyung@kernel.org, acme@redhat.com, mingo@kernel.org Reply-To: acme@redhat.com, namhyung@kernel.org, hpa@zytor.com, mingo@kernel.org, jolsa@kernel.org, tglx@linutronix.de, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org In-Reply-To: <20170217081742.17417-2-namhyung@kernel.org> References: <20170217081742.17417-2-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf utils: Add perf_quiet_option() Git-Commit-ID: 80df1988201ac6648609eba13d48aef9f7974c10 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 80df1988201ac6648609eba13d48aef9f7974c10 Gitweb: http://git.kernel.org/tip/80df1988201ac6648609eba13d48aef9f7974c10 Author: Namhyung Kim AuthorDate: Fri, 17 Feb 2017 17:17:37 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 20 Feb 2017 11:16:32 -0300 perf utils: Add perf_quiet_option() The perf_quiet_option() is to suppress all messages. It's intended to be called just after parsing options. Signed-off-by: Namhyung Kim Cc: Jiri Olsa Cc: Peter Zijlstra Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170217081742.17417-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/debug.c | 17 +++++++++++++++++ tools/perf/util/debug.h | 1 + 2 files changed, 18 insertions(+) diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index c1838b6..03eb81f 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -203,11 +203,28 @@ int perf_debug_option(const char *str) v = (v < 0) || (v > 10) ? 0 : v; } + if (quiet) + v = -1; + *var->ptr = v; free(s); return 0; } +int perf_quiet_option(void) +{ + struct debug_variable *var = &debug_variables[0]; + + /* disable all debug messages */ + while (var->name) { + *var->ptr = -1; + var++; + } + + quiet = true; + return 0; +} + #define DEBUG_WRAPPER(__n, __l) \ static int pr_ ## __n ## _wrapper(const char *fmt, ...) \ { \ diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index d242adc..98832f5 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h @@ -54,5 +54,6 @@ int veprintf(int level, int var, const char *fmt, va_list args); int perf_debug_option(const char *str); void perf_debug_setup(void); +int perf_quiet_option(void); #endif /* __PERF_DEBUG_H */