From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751675AbcBNQEy (ORCPT ); Sun, 14 Feb 2016 11:04:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56219 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751528AbcBNQEN (ORCPT ); Sun, 14 Feb 2016 11:04:13 -0500 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra Subject: [PATCH 4/5] perf tools: Initialize libapi debug output Date: Sun, 14 Feb 2016 17:03:45 +0100 Message-Id: <1455465826-8426-5-git-send-email-jolsa@kernel.org> In-Reply-To: <1455465826-8426-1-git-send-email-jolsa@kernel.org> References: <1455465826-8426-1-git-send-email-jolsa@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setting libapi debug output functions to use perf functions. Link: http://lkml.kernel.org/n/tip-apyen6qfzzwkqjhi1tzv72ju@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/perf.c | 2 ++ tools/perf/util/debug.c | 21 +++++++++++++++++++++ tools/perf/util/debug.h | 1 + 3 files changed, 24 insertions(+) diff --git a/tools/perf/perf.c b/tools/perf/perf.c index a929618b8eb6..144047c396f0 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -613,6 +613,8 @@ int main(int argc, const char **argv) */ pthread__block_sigwinch(); + perf_debug_setup(); + while (1) { static int done_help; int was_alias = run_argv(&argc, &argv); diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 86d9c7302598..152c2e32975f 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "cache.h" #include "color.h" @@ -192,3 +193,23 @@ int perf_debug_option(const char *str) free(s); return 0; } + +#define FUNC(__n, __l) \ +static int pr_ ## __n ## _func(const char *fmt, ...) \ +{ \ + va_list args; \ + int ret; \ + \ + va_start(args, fmt); \ + ret = _eprintf(__l, verbose, fmt, args); \ + va_end(args); \ + return ret; \ +} + +FUNC(warning, 0); +FUNC(debug, 1); + +void perf_debug_setup(void) +{ + libapi_set_print(pr_warning_func, pr_warning_func, pr_debug_func); +} diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index 8b9a088c32ab..14bafda79eda 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h @@ -53,5 +53,6 @@ int eprintf_time(int level, int var, u64 t, const char *fmt, ...) __attribute__( int veprintf(int level, int var, const char *fmt, va_list args); int perf_debug_option(const char *str); +void perf_debug_setup(void); #endif /* __PERF_DEBUG_H */ -- 2.4.3