Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3409807ybi; Mon, 17 Jun 2019 23:54:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqza/z4i4x3zmxls0GeX8+ZguUU//X4f+LUIRl75HPd4V9nwfC5CDZ271/CN3aq9+KVlcIfe X-Received: by 2002:a63:6c4a:: with SMTP id h71mr1232730pgc.331.1560840897686; Mon, 17 Jun 2019 23:54:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560840897; cv=none; d=google.com; s=arc-20160816; b=eCrQEklx/dAIhAiQDFe/ykuVK8EYK+0/xjlFRGcP7KYidm0rUGBMy3bv8YrLPaI+ny Lrfx5AS71vMek2qE+eNALx2O9euasmdjm7Uc+Ga9ZtOmDMO4rlLEZ9cPNuttc/+BvgdC M7hhF80ectVDqMeNXm/VEJdg6QwHJk7G09wm+doMJssuUQedqdQBb5HFyh5OdzTlI4aS 3zOxiD60UZ4SrmEM6M+nqDI6I3/PpPh1HJJB+Y72GlkBT0jflwpGTSkBHpDrcdJGINBQ ETjNAHtfAXMQsrabZfA2l8/r/zQetbPiehg8Xp9vfIeDTyyrvKXc/R3Hta/brvhW1OyQ goMw== 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:from:date:dkim-signature; bh=F1uNa6FtFexED8BrkdYi+QJ3mxVBvnGOiE6mNV8TMuQ=; b=m0aDsfodwSls/pBP2WX0VmJOxjF7zoarPXmNoqLKsoy42M/libe8FK5cBtDBHy/QOD nmhWiMFAKTgIT1SZqjrn/mmxtV+g9Jt/ziEABUla4yKDI0HMwlcLPlKGyt66/Pamr2BA xgIL6Yn0RIO5DSDolK+3xgxMI3mXBHQDtyNlNwbVWBiz8lmyI8ziHbTrZ/UNH4bJkUqv VHeBMVXJm6A7COX1nP/5096MDcytFrDmJcE4leelgShZNfCy9rvQvMKtgb83BbpZgfVh hBYr6H7r3ydfpr0srTJZZVXLMb9mmsh7Z+xYCzZBAxVy5qniZDA0B5W/rOIt+qYajGWY Ov2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ai3DslE7; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q39si1520601pjc.55.2019.06.17.23.54.42; Mon, 17 Jun 2019 23:54:57 -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=@linaro.org header.s=google header.b=Ai3DslE7; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728565AbfFRGxJ (ORCPT + 99 others); Tue, 18 Jun 2019 02:53:09 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:45308 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726307AbfFRGxJ (ORCPT ); Tue, 18 Jun 2019 02:53:09 -0400 Received: by mail-ot1-f65.google.com with SMTP id x21so12741110otq.12 for ; Mon, 17 Jun 2019 23:53:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=F1uNa6FtFexED8BrkdYi+QJ3mxVBvnGOiE6mNV8TMuQ=; b=Ai3DslE7sIcJd3lwcHv/nfIW3mBphyUfgA4ERiWbp1nKmnX57EUkIBMuGeFXdT7pfG FW+l44ZOS6pT9YQMmmsJBwXjhCDuIbnT+EOSiX2bhs8hcy9G4XTUuePQGu5bCIvclU9N M+Q5UcimomCZHO0VG2aTeQedTT1QWSp5ft8A387fC/cCeZBWRu6+r4n8Z8vmMPVmwT22 gEaGXNF9qds6fOLOwgu/tSpiXP/frXgklI4Ddj4OfJdKCVtItW3YXraLNJuTPqYKdLbu fWogpJYS9Wfejc2Q5oTyxJKmSPjosEPlFfapUcOS7yE1nA0uBHKC3rVMhHJLvqMEZf5I RRRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=F1uNa6FtFexED8BrkdYi+QJ3mxVBvnGOiE6mNV8TMuQ=; b=sallf8DDEmBQzGzzSbh68p86chsTAIV5mOP7R2fPY1MmzSBAd63T0YpPEt4UcBcjGC WgXN7RX7DMCalH/q5SEaGbcz87lz8QItAiM6AbUNYL5c7q6rUYGyp5EIjo5/i9quLAuj B7OApg+n6DchVbtogdoh3h3ziau2BU5M8HDYA8gHQAlAJ34DNZPXUUqQ2UHcIhv13lRV yeyEz9A9RdjUs1svkFija6zXvb+ZaNM+QjV6sNwJiMKMkTb7juKGx7J+vMjcPQODPgLI QIpxfeMHQnoegJZxQOtsev/OCkWzljkJpXMbGsluioID6/kuRiVXsg/wzWueIrMD7ANx Upuw== X-Gm-Message-State: APjAAAXncvIQLUGCr0LSEaXkfyBnM3eWumzGb6UX5xI3HzQembfWBNxj PPkRcrqkHIMCkK0SeN04Lca23g== X-Received: by 2002:a05:6830:1319:: with SMTP id p25mr2977936otq.224.1560839074504; Mon, 17 Jun 2019 23:24:34 -0700 (PDT) Received: from leoy-ThinkPad-X240s (li964-79.members.linode.com. [45.33.10.79]) by smtp.gmail.com with ESMTPSA id k3sm5360435otr.1.2019.06.17.23.24.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Jun 2019 23:24:33 -0700 (PDT) Date: Tue, 18 Jun 2019 14:24:23 +0800 From: Leo Yan To: Arnaldo Carvalho de Melo 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: <20190618062423.GA24549@leoy-ThinkPad-X240s> References: <20190617091140.24372-1-leo.yan@linaro.org> <20190617152412.GJ1402@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190617152412.GJ1402@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 17, 2019 at 12:24:12PM -0300, Arnaldo Carvalho de Melo wrote: > 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' :-) Thanks for pointing out, sorry for noise. Please drop this patch. Thanks, Leo Yan > > 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