From mboxrd@z Thu Jan 1 00:00:00 1970 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 96DA1C433EF for ; Wed, 5 Jan 2022 06:41:32 +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=iw09+FHCf5lMHM4UmRFMSwwqn6E3MwaYFTNyJREf84I=; b=mnz2bj+/TlK1SdAT3iPD+TKmcP 7azDmPmxE6vKGgLEoXEt1g/R4qAEOQbFDLh3OqN34a5GggQVwrHjrdFt2mFidAyTRLVHVhL3ULc0s 5Nc8NgYz/ndhI4Y0C6rrB6rjryj7noH+50kTX1RSVuB3XV0EuDUzls/L0ErTwW7YQ3aEK2wcyh4nL uGLV1phjsowZlzL7cybWuThJ/AyOgwwNEDYBwb0q38cy+Q3foWB2GZtecuAauif6/hsRyJ1iS/Quj LIMwbfMNe1X8D6PKErOJR3Rb6r6GPoYsHiGD4/8Pr4LHXcFQEJ1GFdgYtVSUUB2tFX45EYGtFV1wX 9k5a5KeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n4zxr-00Dq0E-9O; Wed, 05 Jan 2022 06:40:03 +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 1n4zZu-00DgH1-Vd for linux-arm-kernel@lists.infradead.org; Wed, 05 Jan 2022 06:15:20 +0000 Received: by mail-yb1-xb49.google.com with SMTP id c5-20020a25f305000000b0060bbdf755f7so53952197ybs.14 for ; Tue, 04 Jan 2022 22:15:17 -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=luwQXebbF2igIF9jSSjuVf8RLHQ4IC0BEqVD3GLmXPI=; b=QetdgK/gVfLu22be3BQIQlfCMuIyuNwF45ShhfLh8FYheOQr/rTjKa5x6ONI5/u35M WoEdqiWKmmR32Z1z0Rrbdo/N9meKqeFcOYCUOhEVmU19OnlkArmFwd8qZ1aeuegN8GLZ IH0YRMvQqEDAt0M6HRuuZUz7AKdE4nCac+ynBvKyRsUHxo+A0DU2G+FQWOtbGMh3LkEV Ls/PemePB8DcuCQ9QqPiXSZgFGSwZyxYS0gET7muGmN7DeKxHkKNMMejCCSdH2J8rQ11 /0ctpJh9r3o9d6tS3N+/nwhnKO2PpBggJKuSr9hFqMsuL1zK3Winx7EAyWPBiV59Zy6l ub9w== 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=luwQXebbF2igIF9jSSjuVf8RLHQ4IC0BEqVD3GLmXPI=; b=Jp8m9oW3F2vkkSPZVpz9Mz2clwQT3Q0EX7mQsktEDoJkORyRQv8JtCRgwmnGhrIAdK fno0+z3iJ0xMSR/ylpeDxHGwd9ZU+JwgHRJzLkxfrJ+NU7Ar/Ls3JTQ7SBWYrqspI1KY F3mwlpOcI74PsmXyq0W2Gp+kKjojzQTZqoKD3w/tV4suDbFe0ltqO3ebtpLdLmN7wBG8 lb3RLAIgD4qTRCj0LYRrFRC7sImw3k2n5hnqsL13q4HpEOEup04bG+C1md4Xxd3Ne8To o/Cn7Rernedq8ocR9wxDrIBhTZ7QlsntWrUO+1XnEo0hBRv8B82wJZaRZOO9LBPManWE 45Rg== X-Gm-Message-State: AOAM530JLOElS+pA3keYi3PcEp8GJnw9QYW/i6dMXNmc61c1vlzF4+5Q vnPWzNDG8SwsczVXLhDTFrRjehSINFdQ X-Google-Smtp-Source: ABdhPJzaD777xe8ZffZh+OZK9hDkj1lmvmYUHwd0ci5FDrOvMELLp2e3mQA1dym206MA3fzCwA1WqieefTkN X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:3af1:caef:2937:5d2b]) (user=irogers job=sendgmr) by 2002:a25:d7d6:: with SMTP id o205mr55490999ybg.291.1641363317345; Tue, 04 Jan 2022 22:15:17 -0800 (PST) Date: Tue, 4 Jan 2022 22:13:35 -0800 In-Reply-To: <20220105061351.120843-1-irogers@google.com> Message-Id: <20220105061351.120843-33-irogers@google.com> Mime-Version: 1.0 References: <20220105061351.120843-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH v4 32/48] perf script: Use for each cpu to aid readability 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-20220104_221519_054079_D670E298 X-CRM114-Status: GOOD ( 12.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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use perf_cpu_map__for_each_cpu to help with readability. Signed-off-by: Ian Rogers --- tools/perf/builtin-script.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index c9b3002ec254..f40319144856 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, -- 2.34.1.448.ga2b2bfdf31-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel