Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1583188

[PATCH 1/6] perf utils: Add perf_quiet_option()

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 1/6] perf utils: Add perf_quiet_option()
Date 2017-02-17 09:20 +0100
Message-ID <tbLVM-1GO-19@gated-at.bofh.it> (permalink)
References <tbLVL-1GO-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHSET 0/6] perf tools: Add -q/--quiet option to suppress messages (v1) Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
  [PATCH 1/6] perf utils: Add perf_quiet_option() Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
    [tip:perf/urgent] perf utils: Add perf_quiet_option() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-02-21 09:20 +0100
  [PATCH 4/6] perf diff: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
    [tip:perf/urgent] perf diff: Add -q/--quiet option tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-02-21 09:20 +0100
  [PATCH 3/6] perf report: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
    Re: [PATCH 3/6] perf report: Add -q/--quiet option Jiri Olsa <jolsa@redhat.com> - 2017-02-17 12:20 +0100
      Re: [PATCH 3/6] perf report: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-02-19 01:40 +0100
    Re: [PATCH 3/6] perf report: Add -q/--quiet option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-20 20:10 +0100
      Re: [PATCH 3/6] perf report: Add -q/--quiet option Namhyung Kim <namhyung@kernel.org> - 2017-02-21 02:50 +0100
    [tip:perf/urgent] perf report: Add -q/--quiet option tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-02-21 09:20 +0100
  [PATCH 6/6] perf record: Honor quiet option properly Namhyung Kim <namhyung@kernel.org> - 2017-02-17 09:20 +0100
    [tip:perf/urgent] perf record: Honor --quiet option properly tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-02-21 09:20 +0100

csiph-web