From patchwork Fri Feb 2 23:40:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13543591 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 38EB3C4828F for ; Fri, 2 Feb 2024 23:41:54 +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:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wj5ycm36IhrCaNwMLTATKvc2eDPbmugPsWHYRprP3Ro=; b=ze498/bSMV60Wy cqfkZ9UcpZFKTw9qQlqKYOMAuj0SAdglyMcFm/RuKISShIEAvv7UlcjlknKHrN829HijgsuG3dx06 vV2IqbR9J20aHXvOhiVh6/YxXbLQDspwEO+Vr33QkhKrHwAhcAshaX1UbupW8dFi3Rn2axyehDN7B SBqC1pxDRedbKMhJKevSh77DFOh5gA/bTKOExWfE5LOplyTcjH2pYj/6a7f2ajjYRGfYQdA5CRTBt 9IM/CnIWsUM80SrKnEEEabln/RKE9OHV16eFRuyvbG2G6e7OapMx6fht5pbecb3Vs2Fz8dBHOJi7d Cyu7ibf6JuUoAp82m8iQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rW3A9-0000000DoiS-0c2Y; Fri, 02 Feb 2024 23:41:37 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rW39y-0000000DoYL-2GLN for linux-arm-kernel@lists.infradead.org; Fri, 02 Feb 2024 23:41:28 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-6041c45ce1cso38538437b3.1 for ; Fri, 02 Feb 2024 15:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706917285; x=1707522085; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=TiTDOvBVexFioWtZi7idM6N1b6RuopqNxCQfkxi6/RE=; b=2tsDj8NIZVgwo3+TuAmj8aG9Lad5aEZU4QzUPuTei4du/ILxY1SmWNEyzjZSA3DGNs KQaboTajQncN31b6c3GgdHx04we/TTxBD/JHB/CcaTlwiMZNI6iRL4BulbpEmjl/L/uy KDgvYVYdu1Pnu+HO/dgh3VhY0eZx41I+D7Uv12nS3nHKqSCcavqZoNMn9CqehDwk4FId QdA2rar3ToVY+DfkhUDiCjoTYffsdOhN933pLPqiN3BcJqMQggbK9dXvgXmC6OV6uSm8 xXBPclkpcpfdg8hD4llxTskbjU1KiNUo13MgwRPSg/SHGbu6+zOKW1676gO57+uA77Fb XeMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706917285; x=1707522085; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TiTDOvBVexFioWtZi7idM6N1b6RuopqNxCQfkxi6/RE=; b=v3r5dS7iMyzeSrA8m2iPWV7M6cUQxGKyIhAjyWJo8k+qxMVwEERvux1p/SarDduFGD JP9bUUdFbTyHatH57GtptfMipmQ4alMHx/87Uy1kdgacV8e/7wfR7atnAIH3PSai2klK Kv3SjHbtOyzZZIpJBKWJ5ALhwv5ssJgYQGXSqqrqcyNolsOnmtCXg4Fbw3CynpdIPq+a 93StkgBFTH8QemsmOnoMtfwxPaluVjCYtTHhgKGIO0ga5XIkuY6VyliaVJ1e5lbX4YC0 UDApXR+7lxuJDJnQ4EOkeZrUeCjqf4DT36hDl/UukFwRJgRY0ABZ1ctAdY+fomw/vuM+ iNeQ== X-Gm-Message-State: AOJu0Yyo9zuLK+XFI5Vi/1aNnvdlpz3XHzIqAWaJ0YWHAWsRFgYZ1Qqx 1QASBCBxbGrnOImkoi37IH4JVp7KVJFh3O4gCcmMzo6dSVLBx77e0y9J7MPorrScuwozp7lCEaM oMrB4zA== X-Google-Smtp-Source: AGHT+IFC29Z279Ff/N0YDvDBynRGWs9YKG/N71yuGRqZ0vDb73/HoBrgLOta7fz6IgJNl/gCwXQX0m26WJMv X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:7732:d863:503:f53d]) (user=irogers job=sendgmr) by 2002:a81:9b4b:0:b0:5ff:6041:c17d with SMTP id s72-20020a819b4b000000b005ff6041c17dmr1156128ywg.2.1706917285199; Fri, 02 Feb 2024 15:41:25 -0800 (PST) Date: Fri, 2 Feb 2024 15:40:56 -0800 In-Reply-To: <20240202234057.2085863-1-irogers@google.com> Message-Id: <20240202234057.2085863-8-irogers@google.com> Mime-Version: 1.0 References: <20240202234057.2085863-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Subject: [PATCH v3 7/8] perf stat: Remove duplicate cpus_map_matched function From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Suzuki K Poulose , Mike Leach , James Clark , Leo Yan , John Garry , Will Deacon , Thomas Gleixner , Darren Hart , Davidlohr Bueso , " =?utf-8?q?Andr=C3=A9_Almeida?= " , Kan Liang , K Prateek Nayak , Sean Christopherson , Paolo Bonzini , Kajol Jain , Athira Rajeev , Andrew Jones , Alexandre Ghiti , Atish Patra , "Steinar H. Gunderson" , Yang Jihong , Yang Li , Changbin Du , Sandipan Das , Ravi Bangoria , Paran Lee , Nick Desaulniers , Huacai Chen , Yanteng Si , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_154126_679943_9D8885FE X-CRM114-Status: GOOD ( 14.93 ) 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 Use libperf's perf_cpu_map__equal that performs the same function. Signed-off-by: Ian Rogers Reviewed-by: James Clark --- tools/perf/builtin-stat.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 280eb0c99d2b..d80bad7c73e4 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -164,26 +164,6 @@ static struct perf_stat_config stat_config = { .iostat_run = false, }; -static bool cpus_map_matched(struct evsel *a, struct evsel *b) -{ - if (!a->core.cpus && !b->core.cpus) - return true; - - if (!a->core.cpus || !b->core.cpus) - return false; - - if (perf_cpu_map__nr(a->core.cpus) != perf_cpu_map__nr(b->core.cpus)) - return false; - - for (int i = 0; i < perf_cpu_map__nr(a->core.cpus); i++) { - if (perf_cpu_map__cpu(a->core.cpus, i).cpu != - perf_cpu_map__cpu(b->core.cpus, i).cpu) - return false; - } - - return true; -} - static void evlist__check_cpu_maps(struct evlist *evlist) { struct evsel *evsel, *warned_leader = NULL; @@ -194,7 +174,7 @@ static void evlist__check_cpu_maps(struct evlist *evlist) /* Check that leader matches cpus with each member. */ if (leader == evsel) continue; - if (cpus_map_matched(leader, evsel)) + if (perf_cpu_map__equal(leader->core.cpus, evsel->core.cpus)) continue; /* If there's mismatch disable the group and warn user. */