Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3468824pxu; Tue, 15 Dec 2020 07:44:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxG9r1irVuZ429gpJ6TXpnM3cGKKjXL+4UkS5nU69Ua0CuLvZt9JlgYT3YkWBt8MTlWQ6LK X-Received: by 2002:a50:d888:: with SMTP id p8mr30456823edj.147.1608047069100; Tue, 15 Dec 2020 07:44:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608047069; cv=none; d=google.com; s=arc-20160816; b=kG5cGkcM9Nyv7Wxbust8+4bwdVnkLcRPmWaB0D1fy5laH3ldbWFVOrKzx4tLWd8dpi 7239JwsKofLZd/qOknf+jaDHdWiOJirmfbzAC4/mgyZGdO/dCrBvh/CeR78MAOwWWjQi YEtXNSOP+wCEWFzQsKHwf/8cOv+MXJWw+MPmwfRPlhQWn++rdQ4belzzccGBqm004pyI mZKgsgK1W73MGMHxpWkGyqnzUl+P0IT8B1tiKTsK55jQUoA8ipL3/Kf998dfytY4gCLk ZyafKMIpvhh9ClPDmVs/bq4S0hzSY0y8km3D1d71pm79BbBfBzJ/NhEJwGclONWZrbhU yOoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=oOtIKm9efWSZgLIyfrcLBhm6z16NILEzTX9IPPzZ/Qo=; b=O5iKOnp+pdim8Z9RpQwn6lPLhtepUHF4AJV6seoppYowiTk9CD/CHLFyEd9N7MGAp2 Hv9DtfVnnRoc0jhC3L6BgZUgKmrQGdrIM4IMy0L5iKmDuzOSyyFsCR8JtScx4gI4oOEl z5BCDjZhJfmHBTRbIRwpmwsGq/FDa6ghREnfz/OGEYZaK82glhy3jv2hb6aRpnyjLzHl YeWcPxft50HSzCKSUxkjOVyahAywj7Oub4wper6IsRC6utyUN1n164oRt7wfiKyNPria JBefnDR33Osqz9fWil9eXpccNExT/PnbyvUy6tWsmfcXgIXdke38nm1W66dn6AdX/LOa OGDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mg2Ww3A2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt24si1068893ejb.248.2020.12.15.07.44.03; Tue, 15 Dec 2020 07:44:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mg2Ww3A2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729584AbgLOPhv (ORCPT + 99 others); Tue, 15 Dec 2020 10:37:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:36622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726844AbgLOPhg (ORCPT ); Tue, 15 Dec 2020 10:37:36 -0500 Date: Tue, 15 Dec 2020 12:37:09 -0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608046616; bh=7jnet3HiVLkL1dD6qE8KR9Mnt/sCfMpAcCbfi62dzZc=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=Mg2Ww3A2733ahgNw7xonKUbod9rq/rQTfNxEQxEmqZU1zVPxcl2rCR8oyZNm7/ZZQ 8mmEimdmwSCXfwBpAAqYoJAWamNMpTT5WM18Flmjq2AoJEKbWIAQbZQ+yYmaIJsZ9C uThNklNXUm3VwfGIpjs4W6uKXvK8QhsyisosBX/TuV+C/y57/nCY9rkkDOGWeehCUF R3mkQJF3j7mdC87nO0xFiBM5YMlnY48fBd1iA3Nt8eZrqMI7OIyZCeij23MXqkFNFb xdL8R0bUv0q3LL0Ye9jiC0j9o6wGCi0H19n1hOcanri0qDiTp0FKLsqN8FuPKdtwsx UTzksTxdhGTAw== From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian , Alexei Budankov Subject: Re: [PATCH 1/8] perf tools: Add debug_set_file function Message-ID: <20201215153709.GB258566@kernel.org> References: <20201212104358.412065-1-jolsa@kernel.org> <20201212104358.412065-2-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201212104358.412065-2-jolsa@kernel.org> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Dec 12, 2020 at 11:43:51AM +0100, Jiri Olsa escreveu: > Allow to set debug output file via new debug_set_file function. > > It's called during perf startup in perf_debug_setup to set stderr > file as default and any perf command can set it later to different > file. > > It will be used in perf daemon command to get verbose output into > log file. Thanks, applied. - Arnaldo > Signed-off-by: Jiri Olsa > --- > tools/perf/util/debug.c | 9 ++++++++- > tools/perf/util/debug.h | 2 ++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c > index 5cda5565777a..50fd6a4be4e0 100644 > --- a/tools/perf/util/debug.c > +++ b/tools/perf/util/debug.c > @@ -30,6 +30,12 @@ bool dump_trace = false, quiet = false; > int debug_ordered_events; > static int redirect_to_stderr; > int debug_data_convert; > +static FILE *debug_file; > + > +void debug_set_file(FILE *file) > +{ > + debug_file = file; > +} > > int veprintf(int level, int var, const char *fmt, va_list args) > { > @@ -39,7 +45,7 @@ int veprintf(int level, int var, const char *fmt, va_list args) > if (use_browser >= 1 && !redirect_to_stderr) > ui_helpline__vshow(fmt, args); > else > - ret = vfprintf(stderr, fmt, args); > + ret = vfprintf(debug_file, fmt, args); > } > > return ret; > @@ -227,6 +233,7 @@ DEBUG_WRAPPER(debug, 1); > > void perf_debug_setup(void) > { > + debug_set_file(stderr); > libapi_set_print(pr_warning_wrapper, pr_warning_wrapper, pr_debug_wrapper); > } > > diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h > index f1734abd98dd..43f712295645 100644 > --- a/tools/perf/util/debug.h > +++ b/tools/perf/util/debug.h > @@ -5,6 +5,7 @@ > > #include > #include > +#include > #include > > extern int verbose; > @@ -62,6 +63,7 @@ int eprintf_time(int level, int var, u64 t, const char *fmt, ...) __printf(4, 5) > int veprintf(int level, int var, const char *fmt, va_list args); > > int perf_debug_option(const char *str); > +void debug_set_file(FILE *file); > void perf_debug_setup(void); > int perf_quiet_option(void); > > -- > 2.26.2 > -- - Arnaldo