From patchwork Thu Dec 23 07:45:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12698011 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 DA271C433EF for ; Thu, 23 Dec 2021 08:11: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=gdKpFIdza5ro4LnaD9gn2jsrtsKHH/9swm8r/xCJiyI=; b=bnvjsAiMDb8CJDDslzMLABN6Sj 2acksTbf3MXgsg0PqprConptM21IMHDmPpvwDvvpCwv0HovzMpqNtUar3m455sh7DD8gCFUiXz8v0 gi6Y9w4/QBSGHPKsyi9q8mk6e0A4G1i3HkRsWJKrzPkIpPuL/o0T7UGKJr9g/xTxckpQK5CRdXJRY Y5mCxBvhkrP9o/cTu34l7OwBs7VMMj/G24RAsKv76WoRJwk9MJluNRm142loJA387mqH61gJ3VrOv KweKuLpeJ1KTtKftXXo8atkau7doEZuT1W4LXN/o4YWm5GRJiftB7Gzeub/zPGQsdUDU4EQN63gUw R8tDTyPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0JAs-00C8SZ-Ng; Thu, 23 Dec 2021 08:10:07 +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 1n0Iov-00BzxV-Qm for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 07:47:27 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id p133-20020a255b8b000000b006086e19f89fso8557964ybb.19 for ; Wed, 22 Dec 2021 23:47:25 -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=hkPo8liTuI9h6KOorTG0Q0VnFokCocOgWRmiktw00dU=; b=Xcj0ee+hgy+nDCYG/rsM91+FuuqQSJiMSCzMOM5SkpY53T4DzkFC3flZLbcPQJ0xOW ucf2StOzgxlmQWFBtpk07akH+Ih91uqwgd1SMQCB2yVnBLHsYRa+avn6wgPFt0kjsNpr YwbBXIrJUuKVqeYyf/FM/YHOI0xj9btID3ki+m/EGWmg+sNQYCI07g79MZCdpOAU/BVP 7xrCMsCuo94Fz14MPRqjNXM3IgUKSoibZqYXoQlX7f4LfI/d9uARzppArHlhFKv0NNPP godVNKuyjvowcHh5mfHlqzEk2VHtLkw1SGFdfboDj6XRovc2Lq4bIDiSIU5UWJUDkBe0 Qlng== 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=hkPo8liTuI9h6KOorTG0Q0VnFokCocOgWRmiktw00dU=; b=6gqJQmTshoHL+IWoaDsKQGJAqpGruTx1wtF9WHwuNRPMlzxn1aXJzPZ6VbOn9F8EAb bjzstTw65ZauHp2raJH7V1UZj+GbxDQD9tgBNbdpp+ebPBXIMzpam0Q8X8peIVU6N6qF K8/SXZiOc3WLgBReVvhYbdiBFD/lHjy1bDPzGpiCjXEsyRvFa4FNG/QOpE0u2oYn87qH leHxR056OFXtDgwcxqfBgYwL0kxtyyV9riDRjoM6xvedEil3wZtAlYPOnZG2J9SaW+UU 1PSI8mbKNJ6aU0EiiYqgeksJcbpvIrhfCh6c2AQPUlS7bIwUuwFRCd+aNLi6Q7aoE4dQ Bubg== X-Gm-Message-State: AOAM531xZK5ofIIgiGS4Da4nX0sBWd+c2jgYVWdZxiPtQIJvgNtoRArC qHPfGbkdL/EKsv8UPa03oyydekpx5dYE X-Google-Smtp-Source: ABdhPJxp6t3w/qnJ+v3zw2zyM1duZWB+B4DWIZtTNpflJlX6sZOLZwc2wLe7o4mryuVEonh3x19x1ZBXjNXr X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:4fef:90ff:589d:24ca]) (user=irogers job=sendgmr) by 2002:a25:50cf:: with SMTP id e198mr1803293ybb.508.1640245644353; Wed, 22 Dec 2021 23:47:24 -0800 (PST) Date: Wed, 22 Dec 2021 23:45:23 -0800 In-Reply-To: <20211223074541.3318938-1-irogers@google.com> Message-Id: <20211223074541.3318938-31-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 30/48] perf stat: Rename aggr_data cpu to imply it's an index 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_234725_900460_88BD50E5 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 Trying to make cpu maps less error prone. Signed-off-by: Ian Rogers --- tools/perf/util/python.c | 2 +- tools/perf/util/stat-display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 563a9ba8954f..4b510a1f27d4 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -1057,7 +1057,7 @@ static struct mmap *get_md(struct evlist *evlist, int cpu) for (i = 0; i < evlist->core.nr_mmaps; i++) { struct mmap *md = &evlist->mmap[i]; - if (md->core.cpu == cpu) + if (md->core.cpu_map_idx == cpu) return md; } diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 821511ba22cc..4f93591aaa76 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -626,7 +626,7 @@ struct aggr_data { u64 ena, run, val; struct aggr_cpu_id id; int nr; - int cpu; + int cpu_map_idx; }; static void aggr_cb(struct perf_stat_config *config, @@ -878,9 +878,9 @@ static void counter_cb(struct perf_stat_config *config __maybe_unused, { struct aggr_data *ad = data; - ad->val += perf_counts(counter->counts, ad->cpu, 0)->val; - ad->ena += perf_counts(counter->counts, ad->cpu, 0)->ena; - ad->run += perf_counts(counter->counts, ad->cpu, 0)->run; + ad->val += perf_counts(counter->counts, ad->cpu_map_idx, 0)->val; + ad->ena += perf_counts(counter->counts, ad->cpu_map_idx, 0)->ena; + ad->run += perf_counts(counter->counts, ad->cpu_map_idx, 0)->run; } /* @@ -897,7 +897,7 @@ static void print_counter(struct perf_stat_config *config, struct aggr_cpu_id id; for (cpu = 0; cpu < evsel__nr_cpus(counter); cpu++) { - struct aggr_data ad = { .cpu = cpu }; + struct aggr_data ad = { .cpu_map_idx = cpu }; if (!collect_data(config, counter, counter_cb, &ad)) return;