diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-02-14 11:03:45 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-02-16 15:12:59 -0500 |
commit | dd629cc0975349c99d5483402bca1ef16313c209 (patch) | |
tree | 8652240e6946032baede64c8679ad7bc408da7b5 /tools/perf/util/debug.c | |
parent | bedbdd4297224efcd7d668198e32fab14b76b98b (diff) |
perf tools: Initialize libapi debug output
Setting libapi debug output functions to use perf functions.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1455465826-8426-5-git-send-email-jolsa@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 | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index d6c8d2b2cd70..ff7e86ad1b06 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <stdarg.h> | 6 | #include <stdarg.h> |
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <api/debug.h> | ||
8 | 9 | ||
9 | #include "cache.h" | 10 | #include "cache.h" |
10 | #include "color.h" | 11 | #include "color.h" |
@@ -187,3 +188,23 @@ int perf_debug_option(const char *str) | |||
187 | free(s); | 188 | free(s); |
188 | return 0; | 189 | return 0; |
189 | } | 190 | } |
191 | |||
192 | #define DEBUG_WRAPPER(__n, __l) \ | ||
193 | static int pr_ ## __n ## _wrapper(const char *fmt, ...) \ | ||
194 | { \ | ||
195 | va_list args; \ | ||
196 | int ret; \ | ||
197 | \ | ||
198 | va_start(args, fmt); \ | ||
199 | ret = veprintf(__l, verbose, fmt, args); \ | ||
200 | va_end(args); \ | ||
201 | return ret; \ | ||
202 | } | ||
203 | |||
204 | DEBUG_WRAPPER(warning, 0); | ||
205 | DEBUG_WRAPPER(debug, 1); | ||
206 | |||
207 | void perf_debug_setup(void) | ||
208 | { | ||
209 | libapi_set_print(pr_warning_wrapper, pr_warning_wrapper, pr_debug_wrapper); | ||
210 | } | ||