All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	kernel-team@lge.com, Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 13/18] perf utils: Add perf_quiet_option()
Date: Mon, 20 Feb 2017 16:08:34 -0300	[thread overview]
Message-ID: <20170220190839.3928-14-acme@kernel.org> (raw)
In-Reply-To: <20170220190839.3928-1-acme@kernel.org>

From: Namhyung Kim <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>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170217081742.17417-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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.9.3

  parent reply	other threads:[~2017-02-20 19:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20 19:08 [GIT PULL 00/18] perf/core improvements and fixes Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 01/18] tools perf scripting python: clang doesn't have -spec, remove it Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 02/18] perf python: Filter out -specs=/a/b/c from the python binding cc options Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 03/18] tools lib traceevent: It's preempt not prempt Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 04/18] perf session: Fix DEBUG=1 build with clang Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 05/18] perf cpumap: Add cpu__max_present_cpu() Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 06/18] perf header: Make build_cpu_topology skip offline/absent CPUs Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 07/18] perf tools: Replace _SC_NPROCESSORS_CONF with max_present_cpu in cpu_topology_map Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 08/18] perf build: Add special fixdep cleaning rule Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 09/18] perf tools: Move new_term arguments into struct parse_events_term template Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 10/18] perf tools: Fail on using multiple bits long terms without value Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 11/18] perf stat: Add -a as default target Arnaldo Carvalho de Melo
2017-02-20 19:15   ` Borislav Petkov
2017-02-20 19:55     ` Arnaldo Carvalho de Melo
2017-02-20 19:59       ` Borislav Petkov
2017-02-21  7:49         ` Jiri Olsa
2017-02-20 19:08 ` [PATCH 12/18] perf record: " Arnaldo Carvalho de Melo
2017-02-20 19:08 ` Arnaldo Carvalho de Melo [this message]
2017-02-20 19:08 ` [PATCH 14/18] perf utils: Check verbose flag properly Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 15/18] perf report: Add -q/--quiet option Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 16/18] perf diff: " Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 17/18] perf annotate: " Arnaldo Carvalho de Melo
2017-02-20 19:08 ` [PATCH 18/18] perf record: Honor --quiet option properly Arnaldo Carvalho de Melo
2017-02-21  8:08 ` [GIT PULL 00/18] perf/core improvements and fixes Ingo Molnar

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=20170220190839.3928-14-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.