From patchwork Wed Jun 28 10:29:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13295539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8C64EB64DC for ; Wed, 28 Jun 2023 10:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oYtj0oeM/r8kY+0oU2ik7reQ38h66SgKLOmR9/tFv7Q=; b=iuZ7Dv7k1OxBDi Lok0TElPChK0g0Ho1utzZkCmUMihEfbChlq55rKBcJflPSaoIMqboYeW1p8XXzkiNrfgDis0vLihI Am5W6mweVhwiCxBGgCfEHym6dFLT/Xruozmh2L1KD3erYROKiVbYytOX2RIs2oaTBZx7enxXJ6JTx jHJmBKlPWE/LK1t4dPI6pfqJlBMiux8/Buaie5gH+DHBAmIGF0pdnPG6lGUjiUPbZlxxgi/3kycHF rLQO27qyHk+rv4tWJ68CBSjxuidjG/iZFt0haP9Ldg5aW5TzVObyLQVuYfXKHu7k8Stri3lCrXBs0 G/N5l2RfSpEooG5znl3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qESSo-00FMc9-1g; Wed, 28 Jun 2023 10:31:54 +0000 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qESSO-00FMJV-2c for linux-arm-kernel@lists.infradead.org; Wed, 28 Jun 2023 10:31:30 +0000 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S8xoRh021934; Wed, 28 Jun 2023 10:30:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=I8X0xtui01ztzPFpCBdcLmFRSBjJ2ZtxODRIixykgeY=; b=D+mJCgRaO1OsHD7Orh0LIwY+EA8wZwxfgyDNfXn5iP/fracIzr9qDqnBAcAJHLdSjlTd Sv2k8oODW2nRvD3poIiwb1YLKe2PuHjTDJirvokAfqIxwFgUTT/9dzk7YVN0LT/DmfrC vP81h6BLSQ0XwqLKlZvfWv8tu2M14oOAoPu8ePSsA6e/mc42NoeSQJJ/aJeTxpVjeY5A r+acVUTaI74JN3ciHto9wbTn2FoZCXNY9lORoiuAQm2a1ow4OgPK7efgdW5wEYraVEIK b8sBx4oJ820EjsyDusqzoSkqGr3l0NdjtnwXTw8KaJJg4G0xrbe4ishMpwzQFnW/aiSl oQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rdq9376f0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:17 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35S94uSQ038175; Wed, 28 Jun 2023 10:30:16 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpxcaxmt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:30:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bsL7q4BdzieD9vee7kwtF2QGlcj8n3qL1KzmdLbwm8I0RBPWVd6ouN7DcHAkl0PY13fQjrdJdf4IPobXE1vNmYsfgyAFO+E+m4WjdWXwvrVPTvcnsgm8prUUxNExSgtLFOz1j6MoUNrxC59v3aMM8s4QOk4aDdjdQFf3JjRv2p+KnifKGbcpOpd8P5P/Bnyuaccyz+R13x1S86VuaK5SN9KjeIo/62J0XXTGJPZt1AaaDW90RPhvrZ4wlbkS5xVlmVZcPK6C3RhK+Of0krWPCWsxjvvom7aMDvpow5Shin5ZGh8jePZ4SviVFOwASkS4WRFuVCT/nMF5qVCiJ+ceww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I8X0xtui01ztzPFpCBdcLmFRSBjJ2ZtxODRIixykgeY=; b=HxfBoMBMgk5gIrtR3gMNHRksSg3hMvoO6iXZnIs0sX0bK+1ol1nOxHgvxNVrTyNXvzAl2u8Nx4kTp4Q1REDwY3u4mpplun6juoXuqAVk8FtrCv3avEv69IJf4+K8dRq3v0sG7eBZ7Rv1p7bZ9sIPgjbqK3bmmkTjLAale5vmauiN6ZO8+Du9ZcjDadiryaQEEW/cWiiZA9NgJbLGsrXFJTPOsskmHUdBudahw0nm6o95WGiqM/OYaawpnvKblDu9FMMcScozPjzK0wwTgZKLQYrzspa6Q81VWiPY8FmjbrB0NI3wTVaMlvK9gY+f+3Jr/jc4/RWPJVOG9EB+ECt52g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I8X0xtui01ztzPFpCBdcLmFRSBjJ2ZtxODRIixykgeY=; b=zwgIv0B4gj35ayTmbyD4OlEUXmimqk7jnlMyc9A2naTNs9STRbVEtLg7zz92Ds73VH4Yon2uUjpjAXZOE1dGG4WR1h8+QNtDHEwgkvgo9xgjXlqDMrmqQfACIOv/vxEjBwD9ecWufPppQK7x57UGBfm05bpkEOkQdCNBKF3GjFo= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by SA2PR10MB4715.namprd10.prod.outlook.com (2603:10b6:806:fb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 10:30:13 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::e38:5b81:b87f:c1eb%7]) with mapi id 15.20.6521.023; Wed, 28 Jun 2023 10:30:13 +0000 From: John Garry To: acme@kernel.org, irogers@google.com, namhyung@kernel.org, jolsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, renyu.zj@linux.alibaba.com, shangxiaojing@huawei.com, zhangshaokun@hisilicon.com, qiangqing.zhang@nxp.com, kjain@linux.ibm.com, kan.liang@linux.intel.com, John Garry Subject: [PATCH RFC 2/9] perf metrics: Don't iter sys metrics if we already found a CPU match Date: Wed, 28 Jun 2023 10:29:42 +0000 Message-Id: <20230628102949.2598096-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230628102949.2598096-1-john.g.garry@oracle.com> References: <20230628102949.2598096-1-john.g.garry@oracle.com> X-ClientProxiedBy: BY5PR16CA0029.namprd16.prod.outlook.com (2603:10b6:a03:1a0::42) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|SA2PR10MB4715:EE_ X-MS-Office365-Filtering-Correlation-Id: 6048d41f-99e0-40f3-ddd9-08db77c2a878 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NN1HADR2VeVXUZQaDLFJ6ajN6mSPNa9wuEP0EO4ncyjPiCC4iXHMVauNOIwZ029tRifI1kSdjISnXvXzqZlk1zDDwbpA/StoaQE32RWi5WNk5d9wUCaHeUCOgRIy+l/ZTnEuLn6VTz1fhUfNiD46Tiz/FmX57pIOa8OJi2HZVLCxQhJvjvm/AGXcEXBw5wLWmfCqn+SWKcM5w08gGXi32qlGunu5SIyB3FptVQr7ehiJbo3QfvRQBCqR6tC3ny3JEaSOP4JJ/RSS7oPSh//ZTSeUD6cMzVlKpiDU1BOehkGxEeiqLHXD/ClJE8wV1tbbGU6xwDarFa2a6nS60JWsOIpGSzmdc/ORoLErpgG0K/hknMgSxprxgWPHmbcXDMAFJKSoYGJhrhFDk5xdXb2wNtmaJo0e0mtMUAEPxAuvjGefaP5tyUKzRlK3kHk1CcdzBBOLL1AhN2yyg+XlXW1/WFXZLVymxjxrwdo2g3sOwTyH4LW1KDRqvWQCPgYPJICWOmv3ltfryGI92OI5zcHhAI3Wx+jOKVHZOITEF1T2hCPao2MvUEbWlZhHfODXLNfF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(38100700002)(103116003)(36756003)(86362001)(478600001)(4744005)(6666004)(6486002)(2616005)(8936002)(316002)(66946007)(8676002)(41300700001)(66556008)(4326008)(66476007)(107886003)(1076003)(6512007)(6506007)(26005)(186003)(7416002)(5660300002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iBwpMwPirNZHYX21wuZGMhUFcpHDjbiaUro6qlwgD8DZFK6DnRFbbPefaYlH6LjfOQz8tbJNzV1PYgPGbd1ylarZzO4NKfZimooYx4kgjU4mEAt4Lpkei/igOxcBL7od36+EhgQiWWPN15Vxud0ygaeyxSGINocQoTpj0VxDQCrTdjs7khUQ2fFLEEEs3rs7K7aHriEgunD9NK18Z6/PciDrAKBLP8t6JxiwyDwXMPXEejRpKjHpvNjpVpk1ZyMeA2HH0wCgC7nyNjzQ/7KdIPCPiAFmeKFwbHv2FkjCCTzKUWO/jT2Dq87bzZBRYss908sctuGz/AfNXy+zsxTSxV9kA29SOz8VEiBfeLYcCX+5Rjj9qQtW6rBJcKJMF+xZKMcCccz8mW1UZWm9Grn8kFE2oXdiBjrJLBhNkldu8f9qPnAlI6h+FEiqhczgyLZH4SMoSMdz29/QItGgGKtWKqPJ3tq2b2cjrEQhPeSeblIhkSSFNUM4+ZEmAxDh16+YK6HwE/CCmzRsgm/aN7EvmDDDThGdRtZbmCo9X8KJFzPRemAds32UUM/W0NovLHpTR256ZX1vni1O2x3l+EyPH5jg3MhrlqMKbQO0sCQoOompIwx//pQSzZMHJS0EAhr19BgA3zmz9BstYqq8OSCNObXkyK4gWdEVmWM0Vml+p6kFQmDXhUcn1XH+z32ZurzX1L1dY68VaTFzkv2OF5JcR3E9PyqKyjvOyTlpKpTxt185jGlTAtD0MFiF3MlWKmO6bBiJNMxKxeY/OchE48lQxDH8p2NobsEYX6ZnthsI/lhAxJywrxD604jivVRk6OelLsIsB3BKL/+QiOA9WF/b3wBycCdVd1ijikqBN6rguzZpgWugIV29AMkev/KYWYA6HUzVi878BaGDdjRrF8wyINyisLGaDgkXwfaClO1HYn4E/XNpz8jU9gINt4nq0SFWCykHjrlxZKoHE011/VWLXfzBTvfsemwweybGf5dr/oT3N74rMsUGbDaaXZ80KLmNmWXv0V+znhe7GNE36WDK/CLT0rMO8YF2m0DD/is8c1ixBJdQGpHpF412ediA94N2rQd1X4EVRQh5YyhpQ1VPoK6qoeDRLYdaF63csdvn9YrFIxghJXVhUX/nNaKfHZb5BgytB/lNJZzlbDcKezojKCHrfyswso2egz35tEO59bgcbIzJddpLhJtwLv5ST16OBZ67fGSJQlcMTuQ91P8CvLlfo8ElzDRvYoyQ/ekh+6nMEB185Le/o1Q6UEveVQzmscvBOyZop8fTRcRFlXK02Z7b7IDve/4UGD0JpcdNHZuYBiJj5tNn8HHy2At2sxsss44f5fWoAZK3c011z2TgHSMR7QOph0lg1LO+oRqqFDViQA/E+GHFgO33UVb3OAEY1evialqv4V5boo/O1XNYlTWg9aicS4u9goPb8LtuA1xg9lI6bBVLiDtM/mEJb+E/DlusoWyxIMfNgJc9wH/HmZq7o6pWSDaCC8wPWRwqzXlo3+42qO/NmahZ8JEq2nPRZQ0+TRMSk5n/HMJs8XcrPj7JwHehoYiK0KaugIat74VAXlaRQS2y0ejCJlF11SxB7SJq4TB+yZm/phlH4uojBQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: JZjIas21fSTfSgi3HVCx/FPR6eMihTx7gDO6TamU9MtmcYr3VBUPWDNhGZluz4MZrZbcZCA9X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MS-Exchange-CrossTenant-Network-Message-Id: 6048d41f-99e0-40f3-ddd9-08db77c2a878 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2023 10:30:13.8111 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hYSPcY0AcSWNLwmlKg9F5lKScU8zKa1h+ol5yLmBxZuoMzn1HF335/wpucJw+tx/DPivzHUoRQnOdCvjKx9bbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4715 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280092 X-Proofpoint-ORIG-GUID: Ei7PYWfq2AY0PM-jEmehI1gadyAzAQia X-Proofpoint-GUID: Ei7PYWfq2AY0PM-jEmehI1gadyAzAQia X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230628_033128_968716_7E06E688 X-CRM114-Status: GOOD ( 18.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In metricgroup__add_metric() we still iter the sys metrics if we already found a match from the CPU table, which is pretty pointless, so don't bother. Signed-off-by: John Garry --- tools/perf/util/metricgroup.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 4389ccd29fe7..8d2ac2513530 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -1261,6 +1261,12 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con has_match = data.has_match; } + + if (has_match) { + ret = 0; + goto out; + } + { struct metricgroup_iter_data data = { .fn = metricgroup__add_metric_sys_event_iter, @@ -1279,6 +1285,7 @@ static int metricgroup__add_metric(const char *pmu, const char *metric_name, con pmu_for_each_sys_metric(metricgroup__sys_event_iter, &data); } + /* End of pmu events. */ if (!has_match) ret = -EINVAL;