}
static int
-mmap_per_thread(struct perf_evlist *evlist, struct perf_mmap_param *mp)
+mmap_per_thread(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops,
+ struct perf_mmap_param *mp)
{
int thread;
int nr_threads = perf_thread_map__nr(evlist->threads);
int output = -1;
int output_overwrite = -1;
+ if (ops->idx)
+ ops->idx(evlist, mp, thread, false);
+
if (mmap_per_evsel(evlist, thread, mp, 0, thread,
&output, &output_overwrite))
goto out_unmap;
}
static int
-mmap_per_cpu(struct perf_evlist *evlist, struct perf_mmap_param *mp)
+mmap_per_cpu(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops,
+ struct perf_mmap_param *mp)
{
int nr_threads = perf_thread_map__nr(evlist->threads);
int nr_cpus = perf_cpu_map__nr(evlist->cpus);
int output = -1;
int output_overwrite = -1;
+ if (ops->idx)
+ ops->idx(evlist, mp, cpu, true);
+
for (thread = 0; thread < nr_threads; thread++) {
if (mmap_per_evsel(evlist, cpu, mp, cpu,
thread, &output, &output_overwrite))
}
if (perf_cpu_map__empty(cpus))
- return mmap_per_thread(evlist, mp);
+ return mmap_per_thread(evlist, ops, mp);
- return mmap_per_cpu(evlist, mp);
+ return mmap_per_cpu(evlist, ops, mp);
}
int perf_evlist__mmap(struct perf_evlist *evlist, int pages)
{
struct perf_mmap_param mp;
- struct perf_evlist_mmap_ops ops;
+ struct perf_evlist_mmap_ops ops = { 0 };
evlist->mmap_len = (pages + 1) * page_size;
mp.mask = evlist->mmap_len - page_size - 1;