Message ID | 20230327225711.245738-1-namhyung@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1844659vqo; Mon, 27 Mar 2023 16:09:04 -0700 (PDT) X-Google-Smtp-Source: AK7set8bOL9bzumMTJaWLfg4Bf3nIAKe2Q27CWKfm1elUf8krU2H35AfxotUWINy1/94BDb5jC6Q X-Received: by 2002:a05:6a20:7351:b0:d9:ad20:c97d with SMTP id v17-20020a056a20735100b000d9ad20c97dmr17162254pzc.20.1679958544587; Mon, 27 Mar 2023 16:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679958544; cv=none; d=google.com; s=arc-20160816; b=WC1XnYBlFjgCcLUKUMLe8vnw2yyVFSsDGflor0gFlUelupdP3oF6aU28yFS32sdO1/ ylwTXnPPMNHgRJ2l8ZJRigRDyekLOjprAcmhnkTbG1wVjghg5MawaCuAGcEVWQPyezre V6kF5yjsea6XPYGz1228tWSpScLd2QOakxLhqCT/mWKq/5/cxWdp7kj0fB5xQ9Mau1Vv cet1yntY9WYpPa+obW5G9c7+idIp3jm9R4npruy4l3EogWF6vv+ixi0PTKbAu1ZSwDDv KtdvV91leankhDDnC1W1dotlHBzOLH3q/IyzRUZRXb+WSkN4EiMCGmtrcuHzbqMGwTL8 mpCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=pZq/tE3Ime66Eff4zF6BNW0V2oykqPbi7rtW7dsDQrg=; b=qd5mWacxWh3sdKBU92zrK+GbQpOr5/PNq5ypFvCtEmUnfabepVn62sQ6XH/jk+q5Tf 7td8FD5y6I86y3aPvoXBMkhW8emS/WRuWy/nwFRKGhoNXFmpDszKMAKdrdBT3lpklKFr 5dngY3TIgVyqGwLulhvNrObEJXfjJ9Ks9SE8uB646HG3CopyBTW/wMyvfCbaQLCa3cVJ UxcjUK1teOt/s7dLyLnqNVzlBv0ZXDiKoMbWxgm42NqqFfoAVanxoe6gec6eQh2yk4SY epvhvoH6PEfOifE+3pcw/e0uUVozei5KOQdmOISSJixVRTCGVxtj6iDNQOihXJfKndAR 1tjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iuBNExzh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y190-20020a6332c7000000b0051323c287ebsi8546588pgy.724.2023.03.27.16.08.51; Mon, 27 Mar 2023 16:09:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iuBNExzh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbjC0W5Q (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Mon, 27 Mar 2023 18:57:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbjC0W5P (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 27 Mar 2023 18:57:15 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB33D1FF3; Mon, 27 Mar 2023 15:57:14 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id fb38so6763447pfb.7; Mon, 27 Mar 2023 15:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679957834; x=1682549834; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=pZq/tE3Ime66Eff4zF6BNW0V2oykqPbi7rtW7dsDQrg=; b=iuBNExzhq7IYRXi33wGistpI+OsvEZMGpg6DH2srXQHqfJMj3yR/RxiLB/YFktY27O J8dWK438cz1Z6zBSHh4l1T44l3YHOoP8BXB+jaa4b/Slxw8HrmdDX8q65dAzgIcq4EeU ZzBbm3uOn38iyYkwVTfsDWet3ChGkjB1Xg/oJplIkuW1rfBsIotL3OR38WxYIfRZOmr+ RS9epJHDoT6UAlJJ9jUmBl+9yUpGVuwQ6cyP17a75i+5QNfNqeAiIWzTHajzwSnc6n0i S7ghshSVsqJnPJyJoOm3fNm+mH03blpu1QVrHniliELKA7alNGiIQsLFFcXmqnBEfwPQ +oUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679957834; x=1682549834; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pZq/tE3Ime66Eff4zF6BNW0V2oykqPbi7rtW7dsDQrg=; b=Vb2V4Z40U/ImII1lwCA+sYHmn01658r8c4TNr63ALPnKTPJI39TJFRtxwofWcmTTrW d1HTRHExTaVeyrrkECcf67UUG5Ats2TJQpVsPZNIadvJpxKpnItqMK0LlGUT6+hmwv86 +hpfXrBK+8Ym9ENOBIKOumaKUKaSxIuoncV0axhM3C8QTrcJZ4q5OIx+bPAtEsZnFZBA +s6SguisYVV0xzX9ixKvMVH5Xm1vBHvkw6hWszcGInYIPRfXOWVtUDJkSCcaWSIjGrLO pJrk/+CFVSTN4UwKWWWbzkPed0Fi5q5pHTs1aXAbETfxKutWb0WmxyvQw9nexpAQ02Ix iELA== X-Gm-Message-State: AAQBX9c/bsN6HzHvDesnOtzshNyZ3EZPjvPR9+77tp+Zn7UWtxOpQNm/ 5AD/uWlHwrOuSdp9eBDORtY= X-Received: by 2002:a62:1d51:0:b0:622:ece1:35d3 with SMTP id d78-20020a621d51000000b00622ece135d3mr12560546pfd.5.1679957833991; Mon, 27 Mar 2023 15:57:13 -0700 (PDT) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6780:44b0:4cdc:1028:ab64:920d]) by smtp.gmail.com with ESMTPSA id c11-20020aa781cb000000b0062d84986823sm2383579pfn.169.2023.03.27.15.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 15:57:13 -0700 (PDT) Sender: Namhyung Kim <namhyung@gmail.com> From: Namhyung Kim <namhyung@kernel.org> To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org> Cc: Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>, LKML <linux-kernel@vger.kernel.org>, linux-perf-users@vger.kernel.org, Hao Luo <haoluo@google.com>, bpf@vger.kernel.org Subject: [PATCH 1/2] perf lock contention: Fix debug stat if no contention Date: Mon, 27 Mar 2023 15:57:10 -0700 Message-Id: <20230327225711.245738-1-namhyung@kernel.org> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761564210662814477?= X-GMAIL-MSGID: =?utf-8?q?1761564210662814477?= |
Series |
[1/2] perf lock contention: Fix debug stat if no contention
|
|
Commit Message
Namhyung Kim
March 27, 2023, 10:57 p.m. UTC
It should not divide if the total number is 0. Otherwise it'd show
NaN in the bad rate output. Also add a whitespace in the "output
for debug" message.
$ sudo perf lock contention -abv true
Looking at the vmlinux_path (8 entries long)
symsrc__init: cannot get elf header.
Using /proc/kcore for kernel data
Using /proc/kallsyms for symbols
contended total wait max wait avg wait type caller
=== output for debug===
bad: 0, total: 0
bad rate: -nan % <------------------------- (here)
histogram of events caused bad sequence
acquire: 0
acquired: 0
contended: 0
release: 0
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-lock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 3c8a19ebc496..82dd2dfe5692 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1323,10 +1323,10 @@ static void print_bad_events(int bad, int total) for (i = 0; i < BROKEN_MAX; i++) broken += bad_hist[i]; - if (quiet || (broken == 0 && verbose <= 0)) + if (quiet || total == 0 || (broken == 0 && verbose <= 0)) return; - pr_info("\n=== output for debug===\n\n"); + pr_info("\n=== output for debug ===\n\n"); pr_info("bad: %d, total: %d\n", bad, total); pr_info("bad rate: %.2f %%\n", (double)bad / (double)total * 100); pr_info("histogram of events caused bad sequence\n");