From patchwork Mon Jun 17 09:11:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 166979 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2605388ilk; Mon, 17 Jun 2019 02:12:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYEXYlR27o08DF8+aYK+Ym11Y0V0yHQzLCrMQGO+6OL0IWcKfby7mEiRIBtoJGCUnDICrN X-Received: by 2002:a17:902:7083:: with SMTP id z3mr42287794plk.205.1560762728894; Mon, 17 Jun 2019 02:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560762728; cv=none; d=google.com; s=arc-20160816; b=RJnl1xseD8vCaPao4GLW3UugWNrrixLtwjaPCH6GbUw5sbatWVZ0vb34kR8t+LOKS3 wjwjzxYotXV6RREZtqEec0MSF7gw5+Vn1PeXHfm7o55hh21eLkZZ+c6VuDhpw475FXoR 9LIirAIKZdal1IIiy4WCuPf9ytOIkETjUBfiS+b1mJvPDof/nyTCLO3FAyWoTCbzYbXu uaUh/SK4vKSOfQwlIqnkRqZp4hi5OEpeBt58EkaiJPOcaLc8dMzX8l3WflK25AWiQVbK XC1OyysH8srYbCVcDa11NqvMrG/zqa8DVvGrz6+UdR7thZee+8fWFnDN5gbsCbWw+IoD 9b8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=oZAaOCoJj5x4sDBNqZQb5CRUWvcKQL64QGOvdU8EjU4=; b=Fe0VUSofqwKXEqxwzAYR7LXNaycwNXm9UYNRw/5TWKrepcnIEiWr0fbfcng48dPMXo uiu+sQ4HpXjWZIQF3uS385Rv16PbMP3kWsXefCJr244awTyS0MEraMw1e30JxM2SfiaU GrsnYFrqcmRbo78lHGKX7U02r2L3wTLD6NZmD8wTxZnFRX2XfIofTfyzQwgEQL/gULhZ fphh3a9per07ZzNqqdyhEqryWN/1ynIkP541EtdVRU+SEEVwJ4bjB4BhoJHga+aPUZI9 2w4R/kWCeNeoklyJMSR0V6DsrpdqVqvvin9sJC0QYymr18FOWj1l06XTXiFQkRS7sov+ TSfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QR/zCNgV"; 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 i1si10671181pgn.193.2019.06.17.02.12.08; Mon, 17 Jun 2019 02:12:08 -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="QR/zCNgV"; 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 S1728043AbfFQJMH (ORCPT + 26 others); Mon, 17 Jun 2019 05:12:07 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:36092 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727952AbfFQJMG (ORCPT ); Mon, 17 Jun 2019 05:12:06 -0400 Received: by mail-oi1-f194.google.com with SMTP id w7so6492707oic.3 for ; Mon, 17 Jun 2019 02:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=oZAaOCoJj5x4sDBNqZQb5CRUWvcKQL64QGOvdU8EjU4=; b=QR/zCNgVHHN5LeDILxIyEF49A0+54vewuBaVy2cgPGVk8oEINFWT7v77TpCagykcA9 sZtuMn2DGpqTyvZ4T46gz41Zqq9tSi0sR0XX/jm0xoLs6BlL8yS83yr5bwTUP/ZhXFFe APrXumCbSdT91yp1/Be6n4CnzCRDmCo5Mn6FSe/9mZb91Xur++zomVFwRzDqewFAqKxj YPyNnS2f6z5mV+A7dVWTEMCm82AJiM/GK0uCt8RMX6ekyDVhr+OB78o/BwVy7y656DY/ YYI/DJvQ5lf4RZfQnDL+tbi3h+tvy+3/pY9ZEhcuHpoJzG0vTEumIjPZbIPMzjPBpn3B 88iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oZAaOCoJj5x4sDBNqZQb5CRUWvcKQL64QGOvdU8EjU4=; b=r+/DNTsYm1qBPf3kJIL9KWjuLPDHVBuxfVns3KqtmhBmUlhF4O93xeq/ylt7Y7fw0n 95m97Xf7xB36dRrNaJWvA2DPKuQKmV2XnZ+mDcNr1xTwHyCKNwYqG5rMkbnRvFXodatw U1ZyMaCBRZMnwnkXGsAX9XFgzBjWhnPVuFxsf+Qi/O5mwKMaKrA3IiJI5/SStFmHyg1q D1nArwwsugaL/hWEqNrbw3xs413nTl8BRTERsU5yCD7wYjPofYxxzlxMmZnfYCCG1F0Z +JnFQXCXsZlio//HfqaVA8yqURI9Vtq/TBkSiYb1FhlWmZ3zqzVTQNwACyVfCAtBgGNC +GpQ== X-Gm-Message-State: APjAAAXtqQABI2UBwnd0Y/2KMJQfOUZQZJf3XiAE86Ke7XzxM4MaAawM EHsLoLtI5VT95zhPxRwR0RTclw== X-Received: by 2002:aca:aa95:: with SMTP id t143mr10189295oie.22.1560762725883; Mon, 17 Jun 2019 02:12:05 -0700 (PDT) Received: from localhost.localdomain (li964-79.members.linode.com. [45.33.10.79]) by smtp.gmail.com with ESMTPSA id l145sm4418324oib.6.2019.06.17.02.12.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2019 02:12:05 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , 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 Cc: Leo Yan Subject: [PATCH 1/2] perf trace: Use pr_debug() instead of fprintf() for logging Date: Mon, 17 Jun 2019 17:11:39 +0800 Message-Id: <20190617091140.24372-1-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Leo Yan --- tools/perf/builtin-trace.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) -- 2.17.1 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; }