From patchwork Thu Dec 23 07:45:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12698020 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 22CFEC433EF for ; Thu, 23 Dec 2021 08:17:42 +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:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=kJOZeL0weVx41Zwuqwwep0uj0nM3IXqGC6Ea5TFEPmg=; b=1F0YpXt6hMk/KsmYGwPPaloyIN hXUCn/td4w7a9Jq9vkT9uUmsSZ/LjBlIg9fBOOiX/a0MROZr9OklgAbLJFtZDsYbxabZhy7tz3mkn jIv0Mf8eYQWAS4lgMLhxR4Wn2WpjIlQyqflDu/o6OM53NPWU8yHetQ8Kuj/sT9Mg2ESkw1RHzrGfT Q9ZOO1TEZNcYJz+Nh8Y2lnccoiuLP2l2jN7Ddc6bk804QtFhQo/6QXa05nNxF6vRitQNRF6X+NaY+ rD6zH+iyRiFLr2iZIA3DuYO+eKsEO8yM3OSirc1YQilWCWbr5kWfkxKL6M1T4LLw0KhorHZ5qAfCn B7owvrnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0JGh-00CAd5-2I; Thu, 23 Dec 2021 08:16:08 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0IpD-00C07Z-QL for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 07:47:45 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id l145-20020a25cc97000000b005c5d04a1d52so8601269ybf.23 for ; Wed, 22 Dec 2021 23:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Psj3VZxbAwFP1vAQTBNCyzZPof5d8rm7KZTKeBB5bD8=; b=XnaIT5sMNMofcBzh0eJYLWvadrz18KX/BFz9jUe2q1NXS2VPiNFBVEld/VzCGjO5AJ FesCgPT1eXtNtqbcNCKMNf9LycfaTJBJOlrce26GDAyFz6z4MXPt4bvKw/+SPq+6t1QL LZeUpr+1TVP1sNbr9rQ2lSQ8f3/oxHPpvg2nZQdb+I+3iT/KirMJfA5gx7uFjbvpZmK9 0HfScruNAfRInokHPquRdRA7NlAKidAy4qpV7sD+jjGQP+aJEMbVJdPl3+UugILUOItq gdi9DnUHlx2K25ForCOERAX8Wo862UxrmXTHY42z5pCCMvsP4Amu8/YnLwOsebhY8Uqw f70Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Psj3VZxbAwFP1vAQTBNCyzZPof5d8rm7KZTKeBB5bD8=; b=gYuJWd9DxNDa1hYYvT6ILKIv6xqjR9AnpdxJJSV/dchMrYgKt8cI7CTV0hSUGjYnok E7qHCGoVktdNUzuALMj1zZWXfO/wLZYxSW9w85qLU26hZLx0MwmCrhzLEfoyvEqui72b wYkByEEtqgPhN3UfojE7p2WAK/FDGCv7k6CykprvI/Bb4tKuqcnf7lngpVg+wCdJBJ0P 7YlTSLihL+mohsF8LZloocZIA9e3V8qb/BunC3RRKrdc3fhXrRuRpR+jsAaQwUPpolMO TZvVPNuN1TRux4o/n92PMKQuBV4L3KKbNVT471cF8QVNTm4qq39fP3TZBRjoFzVOoJeG gH9Q== X-Gm-Message-State: AOAM532rYx8JI/NGABesXjjHzyiJ5/q5M3PjVszee6Bclk8a6+ETZ6He 9P1R+8+yqUnY5jekCRihreAXoCpP7y72 X-Google-Smtp-Source: ABdhPJzKXlgj+iaoDTmwl/snbfmWy/Imp/moMR6bS6PHjM3kYqJPPGlIKA4xq/Wbw+nE4uQY8vBCaZBQhOJt X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:4fef:90ff:589d:24ca]) (user=irogers job=sendgmr) by 2002:a25:b5c7:: with SMTP id d7mr1660547ybg.741.1640245662171; Wed, 22 Dec 2021 23:47:42 -0800 (PST) Date: Wed, 22 Dec 2021 23:45:30 -0800 In-Reply-To: <20211223074541.3318938-1-irogers@google.com> Message-Id: <20211223074541.3318938-38-irogers@google.com> Mime-Version: 1.0 References: <20211223074541.3318938-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.307.g9b7440fafd-goog Subject: [PATCH v2 37/48] perf evsel: Rename CPU around get_group_fd From: Ian Rogers To: Andi Kleen , Jiri Olsa , Namhyung Kim , John Garry , Kajol Jain , "Paul A . Clarke" , Arnaldo Carvalho de Melo , Riccardo Mancini , Kan Liang , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Vineet Singh , James Clark , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Cc: eranian@google.com, Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_234743_917211_E4929535 X-CRM114-Status: GOOD ( 14.48 ) 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 CPU is really a cpu map index, change names to make code more intention revealing. Signed-off-by: Ian Rogers --- tools/perf/util/evsel.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index b4a2c5034cfe..4b3ba4408af2 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1591,27 +1591,27 @@ int __evsel__read_on_cpu(struct evsel *evsel, int cpu_map_idx, int thread, bool } static int evsel__match_other_cpu(struct evsel *evsel, struct evsel *other, - int cpu) + int cpu_map_idx) { - int cpuid; + int cpu; - cpuid = perf_cpu_map__cpu(evsel->core.cpus, cpu); - return perf_cpu_map__idx(other->core.cpus, cpuid); + cpu = perf_cpu_map__cpu(evsel->core.cpus, cpu_map_idx); + return perf_cpu_map__idx(other->core.cpus, cpu); } -static int evsel__hybrid_group_cpu(struct evsel *evsel, int cpu) +static int evsel__hybrid_group_cpu_map_idx(struct evsel *evsel, int cpu_map_idx) { struct evsel *leader = evsel__leader(evsel); if ((evsel__is_hybrid(evsel) && !evsel__is_hybrid(leader)) || (!evsel__is_hybrid(evsel) && evsel__is_hybrid(leader))) { - return evsel__match_other_cpu(evsel, leader, cpu); + return evsel__match_other_cpu(evsel, leader, cpu_map_idx); } - return cpu; + return cpu_map_idx; } -static int get_group_fd(struct evsel *evsel, int cpu, int thread) +static int get_group_fd(struct evsel *evsel, int cpu_map_idx, int thread) { struct evsel *leader = evsel__leader(evsel); int fd; @@ -1625,11 +1625,11 @@ static int get_group_fd(struct evsel *evsel, int cpu, int thread) */ BUG_ON(!leader->core.fd); - cpu = evsel__hybrid_group_cpu(evsel, cpu); - if (cpu == -1) + cpu_map_idx = evsel__hybrid_group_cpu_map_idx(evsel, cpu_map_idx); + if (cpu_map_idx == -1) return -1; - fd = FD(leader, cpu, thread); + fd = FD(leader, cpu_map_idx, thread); BUG_ON(fd == -1); return fd;