Message ID | 20211223074541.3318938-33-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 C1E16C433EF for <linux-arm-kernel@archiver.kernel.org>; Thu, 23 Dec 2021 08:13:28 +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=XdASlrsQv1LAe4IZynZhgcCJIdM5fbqpfeEBEBYF4wI=; b=tEgz7J7mVTofJQdEO3Vaxqzc3W /1G8sSQ8DZqbB8tcSJP6UrNO9ibbiqAMRp32RkElM1Q1p0nftdXC3/6dPCEvK5wKc/9NWsCgY2+vI n0Q8ueiTY4IeIY5ZRaVvt1/c64kiLSn/y7VJVnSzx//YnC5nfCcbkzTjn5vP2nk/tyezRI7GoBbg4 1uTrtD6e/MBCOsdOiyzGUGsquw9A+kjeyb4dGV1RUprDdG6BipydPb4eGQcF3YcK+FWB4TgAEJWRL M3DPQ4DK5PjpHAlEbCskrZ72a1oX6ZKHwF855EGN1O19ptoB+4JANgDYEyaQY14ICeaiI5tHeFFrO pEyuKBEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0JCZ-00C98V-J0; Thu, 23 Dec 2021 08:11:52 +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 1n0Ip1-00C00R-2Q for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 07:47:32 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id t184-20020a2546c1000000b006008b13c80bso8747851yba.1 for <linux-arm-kernel@lists.infradead.org>; Wed, 22 Dec 2021 23:47:30 -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=gS702mZNdqaqGqsGN8/od6/9eJfsTdX5XaCwO/CHnxg=; b=ZAG5FsujH76QsBUz/tYbzeEG+GrdHE0RRbhUkLTKIjXs8evI8wAwEzY1h9EMDJqLnH hlWlHw8ziKRJadI9FWV7TXuil8dvJNhJdyncQg+B0ziD3qhSeeGq9zd8RStul7QZcUHP nLgq9PAndLX+i87S/32ECHBitev9Eh0Ep/uGVfLee+lL+BdKoKPAUlgUEFWZvOiIwJld 9RGSqm7s322Kdx9GRuLW6iLuqNsN5wQqpiwwM2KspOhUZUSB0WHBTF0FV7MJMUm5PikU 7a8JPVmxmEa9NuVRw/kcDPUHBeKeJE5lbmgn1WFsX9OJ5W6RcdOIsS2rG/xSt8AG48z3 3XLQ== 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=gS702mZNdqaqGqsGN8/od6/9eJfsTdX5XaCwO/CHnxg=; b=Ikf5nBoyQtgwe524e9w5rkLqLTYkZc7cxDBwEtpDMWWg2caTztEpw2EpxHCl3GooIN YzbZ0Eg+t7ROsEO2NDaq5HroDyRofSWd7N/0JqrgdGPoxyHqaMKWQB0GR/2Az8foGqWk sY1YjcNnoP93R3LXD8KwbMPnlrN8w/5138lEHY/OAGzuk5rYOR5hGRWrKDq4H4lkue/F kLkiUDhrdk/v2SpeMKKpjRfy1KPpaV5KUEAhixhBOSD6hgv9ZRjJ1DV9SBfabb8Ka/1W D+hWlbGeGaQSMKQfFZodVhEFEBmxdG5VSNgrvsjcMdVcRozwrLoZtOSnEmNtbTLsfPgW +7aw== X-Gm-Message-State: AOAM530/9pi5TzzcvCZEifuJ20jg2TWSQckP3Xo/t0TNDlWbfG+TaXwE jPI+q3YlWpiYDBt4Mcy0v2OVTqEocrjj X-Google-Smtp-Source: ABdhPJzky4057KHzG/tA4tur8qNXghY66f9kz+2zvw0XyPAyGCbP0JD3U0gIN/QaSj9xsR799MWG2pDgUs+J X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:4fef:90ff:589d:24ca]) (user=irogers job=sendgmr) by 2002:a25:258c:: with SMTP id l134mr1685364ybl.40.1640245649513; Wed, 22 Dec 2021 23:47:29 -0800 (PST) Date: Wed, 22 Dec 2021 23:45:25 -0800 In-Reply-To: <20211223074541.3318938-1-irogers@google.com> Message-Id: <20211223074541.3318938-33-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 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 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-20211222_234731_153054_C1320A0C X-CRM114-Status: GOOD ( 12.20 ) 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 9434367af166..af06fe1271cc 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -2113,8 +2113,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) @@ -2127,13 +2126,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(-)