Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2656975ybi; Mon, 17 Jun 2019 08:24:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUsZy4SKze5aOY83tv0dtghHNNuHY3nNvmECLk1dZaRpBGZpdeY1fzEJhq0qfV9wTUYiXS X-Received: by 2002:a17:90a:26ef:: with SMTP id m102mr26184723pje.50.1560785090033; Mon, 17 Jun 2019 08:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560785090; cv=none; d=google.com; s=arc-20160816; b=NQ4aZNRHJUgOwtiGoXyfTLi8z+NlpzGA7hWrHHGapqkWVMGK30AVzk4uRNll3lzmC5 aFRGZ+8PID/AvtHi4LmkWLrh53cLQcVanvhTZWhzWzLPw47yj/44HiLLx4oBkqMDy7Ao ZD8L3grM37EIoXPfINUxoC73ivO1zABvkoTJTwFuBmsl/KPlfvzKxYrEAwi8ixNM7cbK IZogJ0hDjFblOrrMlKIMBxMYQpQa3+3NzOoZd4Seas9de3Plilp0jopWXIGqMD4vLKQi DAf/RNkHXdEFQ6Zm+/3OhnnmBFnZfus25fJst8P/FzENbtls13IdXRCmdc/qpTFwqQIx PF9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=dvejiB9VUdnTPtOXDs7aVYV8twbZKoZz54ycXSwgD5I=; b=Idi+fghKAVTHC7ObRIBaX42bogVVGVO/zsGECjcNYXOuF+20tdtyS1QWaJEqZI4rTt dD2QLYqAvmOw5uPrXNEdaTW3H8WgwHu7sploATnAHlmUPre7Bsh0flv/Xs5uIHcIcfzz xXr7t2GiDpSGJOmvu+plQ0YLn5ld70VPToQ7sRp06lMW/liAuJzH5hPJOPHcTm4JoCeU oW3OHJ94utbZcyEmlQdy2awZT2h64q7ADU3ehhs5FTLk85sno3YCNLwEW7/LYpCp1GcI 3JZiDKMXx6wmAoB+3O3ypmaWKSaQVTVrZqXQ32ODsb6QDVVZ63azvLCGNGVYuC23s6wW XnJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cOMCwmFM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si10796776pgq.298.2019.06.17.08.24.34; Mon, 17 Jun 2019 08:24:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cOMCwmFM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728477AbfFQPYS (ORCPT + 99 others); Mon, 17 Jun 2019 11:24:18 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:34335 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726215AbfFQPYR (ORCPT ); Mon, 17 Jun 2019 11:24:17 -0400 Received: by mail-qt1-f194.google.com with SMTP id m29so11192252qtu.1; Mon, 17 Jun 2019 08:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dvejiB9VUdnTPtOXDs7aVYV8twbZKoZz54ycXSwgD5I=; b=cOMCwmFMd9laWcGZmZ5ox6a0vfIC+J1AndUclQ2kSdRc/Rai0dAolxRHWiJC2s2VRx rHPSmWvlAQ2gBbZ0B1nzqN3kagB9mCSHkHpw2vFVi0MvhyKJyYYytUyeJ1bRIk83KzbA SL7FmHj0leQ3yjHL18/k/NLyd+3yh9TaqdhSwgwq7Nq5Qx1TtLwWAnxsGoWj5rTKpun8 J4qOAiYXhOv1lWm6vhdM+C/A/FSemKEHwCDmLSTTkh6xQamoz01bwyqRMDziow0gzpv5 sNw8Sn1TITucv1a5SYlvCMRHNs5RHk5d03ub9UKQeflOGObgj3SVoGGOGBR+ndmgNVh9 +7Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dvejiB9VUdnTPtOXDs7aVYV8twbZKoZz54ycXSwgD5I=; b=S3kmg/QTmp9FI/+B4vBU+ms/2qC7AGI7ZxlKSHPtjAcoxe8Dfh5CA1ILONiSV2vgXZ M3T5pTblDUwETzlOEEcrTDVfBzuMen+dVr9XQrptK5UKceyRhrboC3ohFHdMLtTYpGCO gewBafp3+ydhEczRDPQbog4EFAOrI1Gjvh+JfnwZIFMqhs+RMoH663GEtTAYmHLOEpnI h6QSroUxm4V0Ah8Zbl76Od+sHWrHhXAcuj1t/7XSxRqfPLzQy9BRCTR7wmwbnX6ihra8 kSvH1rxED/h8Q3dIuah7BW6ueliYyRVupo1YKfASA1OixhgTHMkEthsIfLGue8skY/Sa ZHDA== X-Gm-Message-State: APjAAAWwwj7ZdCAa9RcCqeFEmaYNiz/xXdBlXtetUsCZ5/UxOZeZ3C8V PBbzzKjTy5unCVxlt2xvzYfe7IuX X-Received: by 2002:a0c:d237:: with SMTP id m52mr21151256qvh.160.1560785056738; Mon, 17 Jun 2019 08:24:16 -0700 (PDT) Received: from quaco.ghostprotocols.net (179-240-145-61.3g.claro.net.br. [179.240.145.61]) by smtp.gmail.com with ESMTPSA id p64sm7018987qkf.60.2019.06.17.08.24.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 08:24:16 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C555C41149; Mon, 17 Jun 2019 12:24:12 -0300 (-03) Date: Mon, 17 Jun 2019 12:24:12 -0300 To: Leo Yan Cc: Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH 1/2] perf trace: Use pr_debug() instead of fprintf() for logging Message-ID: <20190617152412.GJ1402@kernel.org> References: <20190617091140.24372-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190617091140.24372-1-leo.yan@linaro.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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