From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
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>,
John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Kajol Jain <kjain@linux.ibm.com>,
James Clark <james.clark@arm.com>,
German Gomez <german.gomez@arm.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Riccardo Mancini <rickyman7@gmail.com>,
Andi Kleen <ak@linux.intel.com>,
Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>,
Alexander Antonov <alexander.antonov@linux.intel.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com>
Subject: [PATCH v5 6/6] perf evlist: Rename all_cpus
Date: Mon, 2 May 2022 21:17:57 -0700 [thread overview]
Message-ID: <20220503041757.2365696-7-irogers@google.com> (raw)
In-Reply-To: <20220503041757.2365696-1-irogers@google.com>
Try to make the struct variable clearer by renaming to
merged_evsel_cpus.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/lib/perf/evlist.c | 16 ++++++++--------
tools/lib/perf/include/internal/evlist.h | 2 +-
tools/perf/util/bpf_counter_cgroup.c | 12 ++++++------
tools/perf/util/evlist.c | 6 +++---
tools/perf/util/evlist.h | 4 ++--
5 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
index 974b4585f93e..5840a9377494 100644
--- a/tools/lib/perf/evlist.c
+++ b/tools/lib/perf/evlist.c
@@ -52,16 +52,16 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
perf_thread_map__put(evsel->threads);
evsel->threads = perf_thread_map__get(evlist->threads);
- evlist->all_cpus = perf_cpu_map__merge(evlist->all_cpus, evsel->cpus);
+ evlist->merged_evsel_cpus = perf_cpu_map__merge(evlist->merged_evsel_cpus, evsel->cpus);
}
static void perf_evlist__propagate_maps(struct perf_evlist *evlist)
{
struct perf_evsel *evsel;
- /* Recomputing all_cpus, so start with a blank slate. */
- perf_cpu_map__put(evlist->all_cpus);
- evlist->all_cpus = NULL;
+ /* Recomputing merged_evsel_cpus, so start with a blank slate. */
+ perf_cpu_map__put(evlist->merged_evsel_cpus);
+ evlist->merged_evsel_cpus = NULL;
perf_evlist__for_each_evsel(evlist, evsel)
__perf_evlist__propagate_maps(evlist, evsel);
@@ -128,10 +128,10 @@ static void perf_evlist__purge(struct perf_evlist *evlist)
void perf_evlist__exit(struct perf_evlist *evlist)
{
perf_cpu_map__put(evlist->user_requested_cpus);
- perf_cpu_map__put(evlist->all_cpus);
+ perf_cpu_map__put(evlist->merged_evsel_cpus);
perf_thread_map__put(evlist->threads);
evlist->user_requested_cpus = NULL;
- evlist->all_cpus = NULL;
+ evlist->merged_evsel_cpus = NULL;
evlist->threads = NULL;
fdarray__exit(&evlist->pollfd);
}
@@ -169,8 +169,8 @@ void perf_evlist__set_maps(struct perf_evlist *evlist,
evlist->threads = perf_thread_map__get(threads);
}
- if (!evlist->all_cpus && cpus)
- evlist->all_cpus = perf_cpu_map__get(cpus);
+ if (!evlist->merged_evsel_cpus && cpus)
+ evlist->merged_evsel_cpus = perf_cpu_map__get(cpus);
perf_evlist__propagate_maps(evlist);
}
diff --git a/tools/lib/perf/include/internal/evlist.h b/tools/lib/perf/include/internal/evlist.h
index 74541bd87aa9..3a0a47ba8c57 100644
--- a/tools/lib/perf/include/internal/evlist.h
+++ b/tools/lib/perf/include/internal/evlist.h
@@ -26,7 +26,7 @@ struct perf_evlist {
*/
struct perf_cpu_map *user_requested_cpus;
/** The union of all evsel cpu maps. */
- struct perf_cpu_map *all_cpus;
+ struct perf_cpu_map *merged_evsel_cpus;
struct perf_thread_map *threads;
int nr_mmaps;
size_t mmap_len;
diff --git a/tools/perf/util/bpf_counter_cgroup.c b/tools/perf/util/bpf_counter_cgroup.c
index 63b9db657442..35e92b889c3b 100644
--- a/tools/perf/util/bpf_counter_cgroup.c
+++ b/tools/perf/util/bpf_counter_cgroup.c
@@ -88,12 +88,12 @@ static int bperf_load_program(struct evlist *evlist)
err = -1;
cgrp_switch = evsel__new(&cgrp_switch_attr);
- if (evsel__open_per_cpu(cgrp_switch, evlist->core.all_cpus, -1) < 0) {
+ if (evsel__open_per_cpu(cgrp_switch, evlist->core.merged_evsel_cpus, -1) < 0) {
pr_err("Failed to open cgroup switches event\n");
goto out;
}
- perf_cpu_map__for_each_cpu(cpu, i, evlist->core.all_cpus) {
+ perf_cpu_map__for_each_cpu(cpu, i, evlist->core.merged_evsel_cpus) {
link = bpf_program__attach_perf_event(skel->progs.on_cgrp_switch,
FD(cgrp_switch, cpu.cpu));
if (IS_ERR(link)) {
@@ -115,14 +115,14 @@ static int bperf_load_program(struct evlist *evlist)
evsel->cgrp = NULL;
/* open single copy of the events w/o cgroup */
- err = evsel__open_per_cpu(evsel, evlist->core.all_cpus, -1);
+ err = evsel__open_per_cpu(evsel, evlist->core.merged_evsel_cpus, -1);
if (err) {
pr_err("Failed to open first cgroup events\n");
goto out;
}
map_fd = bpf_map__fd(skel->maps.events);
- perf_cpu_map__for_each_cpu(cpu, j, evlist->core.all_cpus) {
+ perf_cpu_map__for_each_cpu(cpu, j, evlist->core.merged_evsel_cpus) {
int fd = FD(evsel, cpu.cpu);
__u32 idx = evsel->core.idx * total_cpus + cpu.cpu;
@@ -210,7 +210,7 @@ static int bperf_cgrp__sync_counters(struct evlist *evlist)
int idx;
int prog_fd = bpf_program__fd(skel->progs.trigger_read);
- perf_cpu_map__for_each_cpu(cpu, idx, evlist->core.all_cpus)
+ perf_cpu_map__for_each_cpu(cpu, idx, evlist->core.merged_evsel_cpus)
bperf_trigger_reading(prog_fd, cpu.cpu);
return 0;
@@ -269,7 +269,7 @@ static int bperf_cgrp__read(struct evsel *evsel)
goto out;
}
- perf_cpu_map__for_each_cpu(cpu, i, evlist->core.all_cpus) {
+ perf_cpu_map__for_each_cpu(cpu, i, evlist->core.merged_evsel_cpus) {
counts = perf_counts(evsel->counts, i, 0);
counts->val = values[cpu.cpu].counter;
counts->ena = values[cpu.cpu].enabled;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 52ea004ba01e..57ecd94e6f9e 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -349,7 +349,7 @@ struct evlist_cpu_iterator evlist__cpu_begin(struct evlist *evlist, struct affin
.evsel = NULL,
.cpu_map_idx = 0,
.evlist_cpu_map_idx = 0,
- .evlist_cpu_map_nr = perf_cpu_map__nr(evlist->core.all_cpus),
+ .evlist_cpu_map_nr = perf_cpu_map__nr(evlist->core.merged_evsel_cpus),
.cpu = (struct perf_cpu){ .cpu = -1},
.affinity = affinity,
};
@@ -360,7 +360,7 @@ struct evlist_cpu_iterator evlist__cpu_begin(struct evlist *evlist, struct affin
} else {
itr.evsel = evlist__first(evlist);
if (itr.affinity) {
- itr.cpu = perf_cpu_map__cpu(evlist->core.all_cpus, 0);
+ itr.cpu = perf_cpu_map__cpu(evlist->core.merged_evsel_cpus, 0);
affinity__set(itr.affinity, itr.cpu.cpu);
itr.cpu_map_idx = perf_cpu_map__idx(itr.evsel->core.cpus, itr.cpu);
/*
@@ -388,7 +388,7 @@ void evlist_cpu_iterator__next(struct evlist_cpu_iterator *evlist_cpu_itr)
if (evlist_cpu_itr->evlist_cpu_map_idx < evlist_cpu_itr->evlist_cpu_map_nr) {
evlist_cpu_itr->evsel = evlist__first(evlist_cpu_itr->container);
evlist_cpu_itr->cpu =
- perf_cpu_map__cpu(evlist_cpu_itr->container->core.all_cpus,
+ perf_cpu_map__cpu(evlist_cpu_itr->container->core.merged_evsel_cpus,
evlist_cpu_itr->evlist_cpu_map_idx);
if (evlist_cpu_itr->affinity)
affinity__set(evlist_cpu_itr->affinity, evlist_cpu_itr->cpu.cpu);
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index a21daaa5fc1b..e2e68f988d26 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -336,12 +336,12 @@ struct evlist_cpu_iterator {
/** The CPU map index corresponding to the evsel->core.cpus for the current CPU. */
int cpu_map_idx;
/**
- * The CPU map index corresponding to evlist->core.all_cpus for the
+ * The CPU map index corresponding to evlist->core.merged_evsel_cpus for the
* current CPU. Distinct from cpu_map_idx as the evsel's cpu map may
* contain fewer entries.
*/
int evlist_cpu_map_idx;
- /** The number of CPU map entries in evlist->core.all_cpus. */
+ /** The number of CPU map entries in evlist->core.merged_evsel_cpus. */
int evlist_cpu_map_nr;
/** The current CPU of the iterator. */
struct perf_cpu cpu;
--
2.36.0.464.gb9c8b46e94-goog
prev parent reply other threads:[~2022-05-03 4:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 4:17 [PATCH v5 0/6] Make evlist CPUs more accurate Ian Rogers
2022-05-03 4:17 ` [PATCH v5 1/6] perf cpumap: Switch to using perf_cpu_map API Ian Rogers
2022-05-04 17:44 ` Namhyung Kim
2022-05-05 17:39 ` Arnaldo Carvalho de Melo
2022-05-03 4:17 ` [PATCH v5 2/6] perf evlist: Clear all_cpus before propagating Ian Rogers
2022-05-04 14:15 ` Adrian Hunter
2022-05-05 17:39 ` Arnaldo Carvalho de Melo
2022-05-03 4:17 ` [PATCH v5 3/6] perf stat: Avoid printing cpus with no counters Ian Rogers
2022-05-03 14:19 ` Arnaldo Carvalho de Melo
2022-05-03 4:17 ` [PATCH v5 4/6] perf cpumap: Handle dummy maps as empty in subset Ian Rogers
2022-05-03 7:43 ` Adrian Hunter
2022-05-03 14:03 ` Ian Rogers
2022-05-04 12:54 ` Adrian Hunter
2022-05-04 13:59 ` Ian Rogers
2022-05-04 16:33 ` Ian Rogers
2022-05-03 4:17 ` [PATCH v5 5/6] perf evlist: Add to user_requested_cpus documentation Ian Rogers
2022-05-03 4:17 ` Ian Rogers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220503041757.2365696-7-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.antonov@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexey.v.bayduraev@linux.intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eranian@google.com \
--cc=german.gomez@arm.com \
--cc=james.clark@arm.com \
--cc=john.fastabend@gmail.com \
--cc=john.garry@huawei.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kjain@linux.ibm.com \
--cc=kpsingh@kernel.org \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rickyman7@gmail.com \
--cc=songliubraving@fb.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).