]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
perf utils: Add perf_quiet_option()
authorNamhyung Kim <namhyung@kernel.org>
Fri, 17 Feb 2017 08:17:37 +0000 (17:17 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 20 Feb 2017 14:16:32 +0000 (11:16 -0300)
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
tools/perf/util/debug.h

index c1838b643108bda4d6fc536ae232f20e643a9ce2..03eb81f30d0d0d471fdff09e8779ed02fd73eb36 100644 (file)
@@ -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, ...)        \
 {                                                      \
index d242adc3d5a2ac7217879a37d0f5ed26b344351a..98832f5531d3d0931b8a21560e56330bf1db5cdc 100644 (file)
@@ -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 */