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: 196088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp759654dyc; Fri, 2 Feb 2024 15:43:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtREpzE+TYdSfzuZOM3iQo7nqo3R86ntqfganr4dvUKTMgtI+ieoC3kpOD56XnWpe8GnfN X-Received: by 2002:a05:620a:4d3:b0:784:5e49:e15 with SMTP id 19-20020a05620a04d300b007845e490e15mr8555936qks.19.1706917419623; Fri, 02 Feb 2024 15:43:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706917419; cv=pass; d=google.com; s=arc-20160816; b=OgQnNmnajrF8wda/qIOk5aM4sh3VV2U9SSj23AiEUt8hTzKrr5iXEAEsJYtyYHG1Pj s8WrDVYT/PGrm0rwRumzXg3HyDXtYSZM5TT4mtYfh1hrtOB8a2LE4G6XZGqpM7HiNPCk OfurabjzPA4tXvdB8W1sOH8CdoMQGwHWltMskFmB0zcf5Ti4AOL3euBoopM9FjCitOAg b1xh1iHEI7KXrera0hXCJ6gmJIK4tqHUl9ym7e2SBYhWwmiEgbXTx7NOZz7ngGLreYIO YyxsXapf/gqrKt/YTS4wDJaHxEq346SgLZ99MVIRgXvrGh0EOVMPv2X3niwSQZ1U00cf QMrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=TiTDOvBVexFioWtZi7idM6N1b6RuopqNxCQfkxi6/RE=; fh=ND3/ZuXlr/OXajIRTTNZO38R8SvCsBDvQpmLLY6ycGE=; b=rXA0P47o6/zzhuXIoqiaZU1UkZW2uZva87RHXF0l6df+R2IDlcjoqyxMe7ruI4nVaH TMvPTKDsDynndC8caOblYCDF/F60dhT80xANY+3AfjsgWKSPXlE6sxLI7ACD56IRt/Zm Oy51745FZ5gSrSS/XODatx/GlWJ4phXaNDgUd66GpyCuDfpAoUmFgkfNRqlufO+CkFwc nlcvSq46nW2QPh/1CGVijN0zzdw0p2fAJ7p8H+XkmdSaEHq8pQhYT+070r+qwam73Url jwOAzByxlCT1XfZSu3W53nekbcznJZ7WfuQvJQj3+VRX1zuv/n10E7W11sbYRtz9b8cL V8MA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rs1AoA1s; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-50726-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50726-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCWDcpBcE5MRnkxFiPD9WGKkvMq856PZ+kuSzHYuDc0tm+dm8kfylehB24fpB8uahBOGMRHGGSHLb4TQ/csc5jnPReri0g== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v13-20020ae9e30d000000b00783fee83570si3082653qkf.137.2024.02.02.15.43.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 15:43:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50726-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rs1AoA1s; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-50726-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50726-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 686A81C219E5 for ; Fri, 2 Feb 2024 23:43:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3618134CEA; Fri, 2 Feb 2024 23:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rs1AoA1s" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FE4A13329F for ; Fri, 2 Feb 2024 23:41:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706917287; cv=none; b=u1MK03Mp4v+Ht6Qo3BWw71NxM9RAOFVa5wHAEowuTm+RiFE+6RIshpYdYj9FD8W/tn7ERsvWZ+ueQayUe7jP4Upb2Lg9+AulM7Gn4ke/tgKv2s0dcLE+KJDeb1fqaY0bRr4kmg5jmKWoIHKnEPtGPgx+baY2J9jiqfV2Iavr7Ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706917287; c=relaxed/simple; bh=ML8a9VBGcxJuZQepK7vQffZ+xRnwx4f8S25ZVo2Pqug=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=g62YuHiUO8hVo1BUpCe+9fV2ZDyT4PLT7znVbKLtS19lvOTwfwuNRiOLTsojJx1iFjZSVVK5w5miAZ8UE0Wshad/1aqyw8V+0TPZFAWevgoNplnWUCmEoQvfpgbryHl37FjSddCy3Shbrq21rf9z4Idi+IgAyjLRxh7coV9xFYI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rs1AoA1s; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-603c0e020a6so39111077b3.0 for ; Fri, 02 Feb 2024 15:41:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706917285; x=1707522085; darn=vger.kernel.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=rs1AoA1sMgUgRfo019U4kngZCVdoq/iho4cU6+aGabvBnBWzaZCvru9y4Sg20/ISzP TnyyjgvBkfR5OdtjfFX4pyHoOJKdhORc9lK7iXe1lCr3YyXBEuGxGp3F4tbonGoN5cAA NVdq4J73jzcpbC9VzgYZ5sluqWEdZWO5HfVB8aDzjPiBd5uF2+nFYSaABd1ZgCyvFdVD 42b4EDJW3JKSDfPanU1ZjL6KbjC7hasxHnCKG3elkFUiOkRvhMW60N+Ta4iRJhO9y8fc 5aGTAlW2H5+469+wYepYDM4j+C+cI6mK3lM5bMH14TXqL4tDITzytRDODjcJFmjs2has M3Aw== 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=kB14sIwASZuD5XeGbWBQKcWhHNkwmLT5Kx5GscNSkgdaQY77OOixr9STTt37YyFP1k UjH9jwqUNJKwA5jJNyH4lA/zOeTA+k7rh67tHDkmH5nhropfyAClncUyLHZDFRVI3GTH MjfSaz+4b5yP8TH/ufrM6NBr92sIvsHK91HtoUM5CyfX+fBGKEw5nhfuEUtP6mQYq6pa xfO0nKWivBkZo89zmh52jseDp09YlABI8lJAMGYcNWA22jGF9d8LD/esh17zPjzbar5S MfUqbjzZH+Ux676CO55x3WdEVV5YJwOgva6PVNH2pQVf/l5cO62Fa4inuOdxOMEXYCkC YvEg== X-Gm-Message-State: AOJu0Yzeh82uyLVxRRXAoglML0PTZxOzcESomX/uiQPSpekPz5nasuJ2 Is9WnzKjypHRkVUnGq9JtSRwGntFsOzbNI9QtyS2G4Z6CXOKjG7vEh66nhJJd6l7HxHSK+Z28V1 vFnTOzQ== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789832640122856635 X-GMAIL-MSGID: 1789832640122856635 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. */