linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	kernel-team@lge.com
Subject: [PATCH 1/6] perf utils: Add perf_quiet_option()
Date: Fri, 17 Feb 2017 17:17:37 +0900	[thread overview]
Message-ID: <20170217081742.17417-2-namhyung@kernel.org> (raw)
In-Reply-To: <20170217081742.17417-1-namhyung@kernel.org>

The perf_quiet_option() is to suppress all messages.  It's intended to
be called just after parsing options.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 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 c1838b643108..03eb81f30d0d 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 d242adc3d5a2..98832f5531d3 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 */
-- 
2.11.1

  reply	other threads:[~2017-02-17  8:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17  8:17 [PATCHSET 0/6] perf tools: Add -q/--quiet option to suppress messages (v1) Namhyung Kim
2017-02-17  8:17 ` Namhyung Kim [this message]
2017-02-21  8:15   ` [tip:perf/urgent] perf utils: Add perf_quiet_option() tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 2/6] perf utils: Check verbose flag properly Namhyung Kim
2017-02-20 14:35   ` Arnaldo Carvalho de Melo
2017-02-21  1:38     ` Namhyung Kim
2017-02-21  8:16   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 3/6] perf report: Add -q/--quiet option Namhyung Kim
2017-02-17 11:09   ` Jiri Olsa
2017-02-19  0:21     ` Namhyung Kim
2017-02-20 19:08   ` Arnaldo Carvalho de Melo
2017-02-21  1:40     ` Namhyung Kim
2017-02-21  8:16   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 4/6] perf diff: " Namhyung Kim
2017-02-21  8:17   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 5/6] perf annotate: " Namhyung Kim
2017-02-21  8:17   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 6/6] perf record: Honor quiet option properly Namhyung Kim
2017-02-21  8:18   ` [tip:perf/urgent] perf record: Honor --quiet " tip-bot for Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170217081742.17417-2-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).