From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F701C4167B for ; Tue, 12 Dec 2023 11:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346315AbjLLL21 (ORCPT ); Tue, 12 Dec 2023 06:28:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346266AbjLLL2Z (ORCPT ); Tue, 12 Dec 2023 06:28:25 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85D6CB8; Tue, 12 Dec 2023 03:28:31 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 918C7143D; Tue, 12 Dec 2023 03:29:17 -0800 (PST) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5A0333F762; Tue, 12 Dec 2023 03:28:26 -0800 (PST) Message-ID: <1c5494f7-960e-07e9-eb8c-6c9dd8405004@arm.com> Date: Tue, 12 Dec 2023 11:28:22 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v1 12/14] perf stat: Remove duplicate cpus_map_matched function Content-Language: en-US To: Ian Rogers References: <20231129060211.1890454-1-irogers@google.com> <20231129060211.1890454-13-irogers@google.com> Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Suzuki K Poulose , Mike Leach , 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 From: James Clark In-Reply-To: <20231129060211.1890454-13-irogers@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/2023 06:02, Ian Rogers wrote: > 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 f583027a0639..8e2f90b5c276 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. */