From patchwork Thu Dec 30 07:20:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12701293 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 09116C433F5 for ; Thu, 30 Dec 2021 07:46:07 +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=70GdaOTsZt/oEHIKE2K7vtDRHtP93GPT3hqy7yFpGuQ=; b=zaT186RmSQ+9GpOZSUYzz4cEOw PtI+DeV/R3uMfYFOfUfBa/F8Re1beqJ/x36TxsQxw08o1aS7UR/ndeRjIsaQ7PVN5NlYuTlmOTYxZ OyrlxqxbGGBP1M42YaSXCphr4HWCQe/Q/oGJKnh7fIr6xYsHx+T9VrxaepsL+rB3MxuvvdyXsAIBe rm0VlvAd1KFpGh+nPpliFXf+1K/P/3H3Z1dDnIj6RDXQaJbq3c8Q1gYK7kUjo4gz7a9qw+7a44oEw sVenDCqxUH+ODWzyA3DjjVM8UhmY6VDDyUMy1rGBHsm3+Om2jNW/8pmjZzxMH7QIGFnCLyn8yjrME 8VuHkh3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n2q78-003sEn-Ou; Thu, 30 Dec 2021 07:44:43 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n2pl7-003k2p-GJ for linux-arm-kernel@lists.infradead.org; Thu, 30 Dec 2021 07:21:58 +0000 Received: by mail-yb1-xb49.google.com with SMTP id k130-20020a255688000000b0060c3dcae580so22465481ybb.6 for ; Wed, 29 Dec 2021 23:21:56 -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=cJxFT+Wieuw1JhmOKv6vMYAg7VBOnu+0BYOqRINi2fw=; b=AaHv8eORAJsQxS3I6J+wspo278XHNMt6cWHmkPeINdeVvH11+NxswWMDsad4x7P5iU wFWnpYfbaMzXhlXauKb2YPOklu8N4eAssGnSq3SpBE1EXifP/WJc40XmzDKnA8d15Fau +i4mG9wvHLxQChrj2VP/FX8/FaBAWkCtukNHvtnCP05sy913IDR9iB4lW7pYSaNbjPyP lNYvx7oPqTukT1sc0ZtP25ItEUr9cAINncuZy+9dA1z7aGpk7y/JncbOgnrLiJhgXaLM wSu2ozmiPMQzAyX7ov7N+rNVvThkH8FyKO1rJra4k+4vcaRMPYXd5iAnDC8NQzaERA4b Kk8g== 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=cJxFT+Wieuw1JhmOKv6vMYAg7VBOnu+0BYOqRINi2fw=; b=yXtOEymGDmBI6rvRyvzFuUv0QhzLnEL2Cf/EyA3FzpeRQSXf8tBnkPvIODP9/uBAmK e31auoDNRwRL8wJ5i4v5UZSWRFYXWrllk14DGfCyHRhnI4L0N2ygLdgxRt1wHD9du+2G Z/nI2or3Nhj37vDYlQSHcl4uMGBgXMMQXbV0AtJc3Nj5pw3R3IljGqgzKXdq83VgGFYl tbxxtwe31RdbIUf89Fsj6n5MIBOe6VupmqXzmHgu44YwcsvgBHj4c0KRsjPCUtb/WlEp HKV2kVTZG6GuuwswpmV1wpl8/fXWaCbUKyEa+CwoLO8Fk/5qMasjcYHBrLvtVXgAEMbk AWyg== X-Gm-Message-State: AOAM532zZ0r9MTXvsSTiOidgGxf5rq37YllX30sBLxrW/TjXp2rbf73g Tv2lNNBprU/miCQBgPKpaKVbzgPrGCRz X-Google-Smtp-Source: ABdhPJytWKabroUG8HjyhF2QFoTqO1zK7EFRJ5h2dMTVhrWEAu4oyvBpIf//FFwcyF9lGBO1qvzQX2ZJ23s2 X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:31c4:9539:dba1:a82b]) (user=irogers job=sendgmr) by 2002:a5b:743:: with SMTP id s3mr22066829ybq.209.1640848916024; Wed, 29 Dec 2021 23:21:56 -0800 (PST) Date: Wed, 29 Dec 2021 23:20:13 -0800 In-Reply-To: <20211230072030.302559-1-irogers@google.com> Message-Id: <20211230072030.302559-33-irogers@google.com> Mime-Version: 1.0 References: <20211230072030.302559-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH v3 31/48] perf stat: Use perf_cpu_map__for_each_cpu 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, zhengjun.xing@intel.com Cc: eranian@google.com, Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211229_232157_604810_76243B04 X-CRM114-Status: GOOD ( 12.92 ) 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 Correct in print_counter where an index was being used as a cpu. Signed-off-by: Ian Rogers --- tools/perf/util/stat-display.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 7e933a8fee68..0f192360b6c6 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "color.h" #include "counts.h" #include "evlist.h" @@ -732,7 +733,7 @@ static void print_aggr(struct perf_stat_config *config, evlist__for_each_entry(evlist, counter) { print_counter_aggrdata(config, counter, s, prefix, metric_only, - &first, -1); + &first, /*cpu=*/-1); } if (metric_only) fputc('\n', output); @@ -893,11 +894,11 @@ static void print_counter(struct perf_stat_config *config, FILE *output = config->output; u64 ena, run, val; double uval; - int cpu; + int idx, cpu; struct aggr_cpu_id id; - for (cpu = 0; cpu < evsel__nr_cpus(counter); cpu++) { - struct aggr_data ad = { .cpu_map_idx = cpu }; + perf_cpu_map__for_each_cpu(cpu, idx, evsel__cpus(counter)) { + struct aggr_data ad = { .cpu_map_idx = idx }; if (!collect_data(config, counter, counter_cb, &ad)) return; @@ -1248,7 +1249,7 @@ static void print_percore(struct perf_stat_config *config, print_counter_aggrdata(config, counter, s, prefix, metric_only, - &first, -1); + &first, /*cpu=*/-1); } if (metric_only)