[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190617152412.GJ1402@kernel.org>
Date: Mon, 17 Jun 2019 12:24:12 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Leo Yan <leo.yan@...aro.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org
Subject: Re: [PATCH 1/2] perf trace: Use pr_debug() instead of fprintf() for
logging
Em Mon, Jun 17, 2019 at 05:11:39PM +0800, Leo Yan escreveu:
> In the function trace__syscall_info(), it explicitly checks verbose
> level and print out log with fprintf(). Actually, we can use
> pr_debug() to do the same thing for debug logging.
>
> This patch uses pr_debug() instead of fprintf() for debug logging; it
> includes a minor fixing for 'space before tab in indent', which
> dismisses git warning when apply it.
But those are not fprintf(stdout,), they explicitely redirect to the
output file that the user may have specified using 'perf trace --output
filename.trace' :-)
- Arnaldo
> Signed-off-by: Leo Yan <leo.yan@...aro.org>
> ---
> tools/perf/builtin-trace.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index bd1f00e7a2eb..5cd74651db4c 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -1760,12 +1760,11 @@ static struct syscall *trace__syscall_info(struct trace *trace,
> * grep "NR -1 " /t/trace_pipe
> *
> * After generating some load on the machine.
> - */
> - if (verbose > 1) {
> - static u64 n;
> - fprintf(trace->output, "Invalid syscall %d id, skipping (%s, %" PRIu64 ") ...\n",
> - id, perf_evsel__name(evsel), ++n);
> - }
> + */
> + static u64 n;
> +
> + pr_debug("Invalid syscall %d id, skipping (%s, %" PRIu64 ")\n",
> + id, perf_evsel__name(evsel), ++n);
> return NULL;
> }
>
> @@ -1779,12 +1778,10 @@ static struct syscall *trace__syscall_info(struct trace *trace,
> return &trace->syscalls.table[id];
>
> out_cant_read:
> - if (verbose > 0) {
> - fprintf(trace->output, "Problems reading syscall %d", id);
> - if (id <= trace->syscalls.max && trace->syscalls.table[id].name != NULL)
> - fprintf(trace->output, "(%s)", trace->syscalls.table[id].name);
> - fputs(" information\n", trace->output);
> - }
> + pr_debug("Problems reading syscall %d", id);
> + if (id <= trace->syscalls.max && trace->syscalls.table[id].name != NULL)
> + pr_debug("(%s)", trace->syscalls.table[id].name);
> + pr_debug(" information\n");
> return NULL;
> }
>
> --
> 2.17.1
--
- Arnaldo
Powered by blists - more mailing lists