Message ID | 20211230072030.302559-34-irogers@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 3C625C433EF for <linux-arm-kernel@archiver.kernel.org>; Thu, 30 Dec 2021 07:47: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=MTvzqnz0tVAOdxuN79V2cAwOygS/QM588LO79ZUb6FU=; b=CWYeCoYqRhaLRHwMT9k+qIBJX2 PjD5tHtZlnlPu/T3PWkB/wNPoxwTYNF6zbRu1ab/CjZzLGEXDlL2MYVrq4aRW81LXue+vhOwbpZtE PQtZkSgA9yll/4iwHDNjxLbKBl3aXDMLZtXReHkUZHYJKDJanCHbs5ZMefkgmXYBRvKabJpTrMDeE vA0qAxUQYW9KtcrhbTlwKhZwk7UNBgU1td9yv2ajMOPwsjefrtf7K6AAJTkwZX5Hw7jX+wjMeMjaf AT5Zy87+Oh237Dd0K8xahb48izMfAd+P3/jRLXgeCypx2Vf91kRq15+C0bDQwhXskzuwuxc/3U3AF 7mmqNNDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n2q7y-003sV9-BW; Thu, 30 Dec 2021 07:45:35 +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 1n2plA-003k45-1s for linux-arm-kernel@lists.infradead.org; Thu, 30 Dec 2021 07:22:01 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id g130-20020a255288000000b0060ba07af29eso25853635ybb.2 for <linux-arm-kernel@lists.infradead.org>; Wed, 29 Dec 2021 23:21:59 -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=5E7qCmbhcG6PuyklpswsQQtsh3hwpY8VT2UNYS3McbM=; b=Gfhu9VtJeNHpp94ZAOP6BEURqOQ1GB6YOAeaR/IzzwZeyLURpqc67PaFFz/svrG/5W 8YYk+r4TM/UIFsnt4bxDH4ndbwwA6Jj2rUeBY7fauHo5PJTQkQW7WZ2Dci8Tk5X04IAR qol/PwQ1QT54Q97bUMvleW+hsVQFCdokNqrNhowSMoC001DZ+wUBY8IpZE+LjSDt//NK wZo6RvyyUOOijFXYimwlA1kFDw8a/vPEsykmvv/4UjIBZzxQCtV3qsq6KWVQJMK33Lmn QaiUZCKcANuuBE134rv3z0y1/NmEwPn62XEYEP148inW2xo9A/pQfKz87qGfRLYvIGDB Z+Mw== 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=5E7qCmbhcG6PuyklpswsQQtsh3hwpY8VT2UNYS3McbM=; b=Ovr5YY3JQ5GlOC+dUkPNs00H4XnhVpqo59tQCMNKWFkOfn0YFHqTcss3XtLIlz/vGF FS4toYPKc8ObkSk0kdjYpdOOHIJ7P7gdVG1yaQPL3vUDKw0Lpy9tQqT9nxrl7RVS/8AW bSuLwprbDZu60uinKjXmuwWGn2VEm7FuBAjlQLXJ+Vl7ZihqX3M1xb/HljDAElOgrjKE sfrymZDzDAi5kS+eqUtFERVOFlnz9/ZskglJvifMA1trNrsWME//8zAM9FO/rE+Qc9qG ZhpefUGb5UCkeTFIoew1RzOryYMswCZJLezenR9QvE9aFdg2zukF07pCv+1Kk2Il5ciP YDBQ== X-Gm-Message-State: AOAM531rOspX8gw8JnAb+9hv5SSeDVRFXgFSNQLx9EGSlSdOtDMIl9Ng HlUzDXwbsD53JPmbLAL3Oq+oVPNCQsVb X-Google-Smtp-Source: ABdhPJxZFDLUd2Q0RsMuQCwod5Dec4u0Ta/2jbhXReC6ERU+A1dE0YVQIPPxEVw4ATvDX8Chh3lEQuWY5H0M X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:31c4:9539:dba1:a82b]) (user=irogers job=sendgmr) by 2002:a25:d914:: with SMTP id q20mr27808227ybg.140.1640848918378; Wed, 29 Dec 2021 23:21:58 -0800 (PST) Date: Wed, 29 Dec 2021 23:20:14 -0800 In-Reply-To: <20211230072030.302559-1-irogers@google.com> Message-Id: <20211230072030.302559-34-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 32/48] perf script: Use for each cpu to aid readability From: Ian Rogers <irogers@google.com> To: Andi Kleen <ak@linux.intel.com>, Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>, John Garry <john.garry@huawei.com>, Kajol Jain <kjain@linux.ibm.com>, "Paul A . Clarke" <pc@us.ibm.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Riccardo Mancini <rickyman7@gmail.com>, Kan Liang <kan.liang@linux.intel.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Vineet Singh <vineet.singh@intel.com>, James Clark <james.clark@arm.com>, Mathieu Poirier <mathieu.poirier@linaro.org>, Suzuki K Poulose <suzuki.poulose@arm.com>, Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, zhengjun.xing@intel.com Cc: eranian@google.com, Ian Rogers <irogers@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211229_232200_156251_0560F9DC X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Refactor perf cpumap
|
expand
|
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index d308adfd1176..ce9c3c5d881d 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -2115,8 +2115,7 @@ static struct scripting_ops *scripting_ops; static void __process_stat(struct evsel *counter, u64 tstamp) { int nthreads = perf_thread_map__nr(counter->core.threads); - int ncpus = evsel__nr_cpus(counter); - int cpu, thread; + int idx, cpu, thread; static int header_printed; if (counter->core.system_wide) @@ -2129,13 +2128,13 @@ static void __process_stat(struct evsel *counter, u64 tstamp) } for (thread = 0; thread < nthreads; thread++) { - for (cpu = 0; cpu < ncpus; cpu++) { + perf_cpu_map__for_each_cpu(cpu, idx, evsel__cpus(counter)) { struct perf_counts_values *counts; counts = perf_counts(counter->counts, cpu, thread); printf("%3d %8d %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %s\n", - counter->core.cpus->map[cpu], + cpu, perf_thread_map__pid(counter->core.threads, thread), counts->val, counts->ena,
Use perf_cpu_map__for_each_cpu to help with readability. Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/builtin-script.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)