Re: [PATCH] perf: add support for logging debug messages to file

From: Jiri Olsa
Date: Fri Sep 20 2019 - 16:54:01 EST


On Sun, Sep 15, 2019 at 06:27:40PM +0800, Changbin Du wrote:
> When in TUI mode, it is impossible to show all the debug messages to
> console. This make it hard to debug perf issues using debug messages.
> This patch adds support for logging debug messages to file to resolve
> this problem.
>
> The usage is:
> perf -debug verbose=2 --debug file=1 COMMAND
>
> And the path of log file is '~/perf.log'.
>
> Signed-off-by: Changbin Du <changbin.du@xxxxxxxxx>
> ---
> tools/perf/Documentation/perf.txt | 4 +++-
> tools/perf/util/debug.c | 20 ++++++++++++++++++++
> 2 files changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/Documentation/perf.txt b/tools/perf/Documentation/perf.txt
> index 401f0ed67439..45db7b22d1a5 100644
> --- a/tools/perf/Documentation/perf.txt
> +++ b/tools/perf/Documentation/perf.txt
> @@ -16,7 +16,8 @@ OPTIONS
> Setup debug variable (see list below) in value
> range (0, 10). Use like:
> --debug verbose # sets verbose = 1
> - --debug verbose=2 # sets verbose = 2
> + --debug verbose=2 --debug file=1
> + # sets verbose = 2 and save log to file

it's variable already, why not allow to pass the path directly like:

--debug file=~/perf.log

would be great if we won't need to use --debug twice and allow:

--debug verbose=2,file=perf.log

jirka