diff options
author | Namhyung Kim <namhyung@kernel.org> | 2017-02-17 03:17:37 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-02-20 09:16:32 -0500 |
commit | 80df1988201ac6648609eba13d48aef9f7974c10 (patch) | |
tree | d0b80371f5ca39192866a30fd22f19369ea8f0d7 /tools/perf/util/debug.c | |
parent | 483635a9d0802d5ffbe402ceac5b93ddb2acb138 (diff) |
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 <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>
Diffstat (limited to 'tools/perf/util/debug.c')
-rw-r--r-- | tools/perf/util/debug.c | 17 |
1 files changed, 17 insertions, 0 deletions
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) | |||
203 | v = (v < 0) || (v > 10) ? 0 : v; | 203 | v = (v < 0) || (v > 10) ? 0 : v; |
204 | } | 204 | } |
205 | 205 | ||
206 | if (quiet) | ||
207 | v = -1; | ||
208 | |||
206 | *var->ptr = v; | 209 | *var->ptr = v; |
207 | free(s); | 210 | free(s); |
208 | return 0; | 211 | return 0; |
209 | } | 212 | } |
210 | 213 | ||
214 | int perf_quiet_option(void) | ||
215 | { | ||
216 | struct debug_variable *var = &debug_variables[0]; | ||
217 | |||
218 | /* disable all debug messages */ | ||
219 | while (var->name) { | ||
220 | *var->ptr = -1; | ||
221 | var++; | ||
222 | } | ||
223 | |||
224 | quiet = true; | ||
225 | return 0; | ||
226 | } | ||
227 | |||
211 | #define DEBUG_WRAPPER(__n, __l) \ | 228 | #define DEBUG_WRAPPER(__n, __l) \ |
212 | static int pr_ ## __n ## _wrapper(const char *fmt, ...) \ | 229 | static int pr_ ## __n ## _wrapper(const char *fmt, ...) \ |
213 | { \ | 230 | { \ |