@@ -119,11 +119,10 @@ backward_rb_find_range(void *buf, int mask, u64 head, u64 *start, u64 *end)
}
static int
-rb_find_range(struct perf_evlist *evlist,
- void *data, int mask, u64 head, u64 old,
- u64 *start, u64 *end)
+rb_find_range(void *data, int mask, u64 head, u64 old,
+ u64 *start, u64 *end, bool backward)
{
- if (!evlist->backward) {
+ if (!backward) {
*start = old;
*end = head;
return 0;
@@ -143,8 +142,8 @@ static int record__mmap_read(struct record *rec, struct perf_evlist *evlist, int
void *buf;
int rc = 0;
- if (rb_find_range(evlist, data, md->mask, head,
- old, &start, &end))
+ if (rb_find_range(data, md->mask, head,
+ old, &start, &end, false))
return -1;
if (start == end)
@@ -101,7 +101,6 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
return TEST_FAIL;
}
- evlist->backward = true;
err = perf_evlist__create_maps(evlist, &opts.target);
if (err < 0) {
pr_debug("Not enough memory to create thread/cpu maps\n");
@@ -44,7 +44,6 @@ void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
perf_evlist__set_maps(evlist, cpus, threads);
fdarray__init(&evlist->pollfd, 64);
evlist->workload.pid = -1;
- evlist->backward = false;
}
struct perf_evlist *perf_evlist__new(void)
@@ -853,9 +852,7 @@ union perf_event *perf_evlist__mmap_read_backward(struct perf_evlist *evlist, in
union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
{
- if (!evlist->backward)
- return perf_evlist__mmap_read_forward(evlist, idx);
- return perf_evlist__mmap_read_backward(evlist, idx);
+ return perf_evlist__mmap_read_forward(evlist, idx);
}
void perf_mmap__read_catchup(struct perf_mmap *md)
@@ -50,7 +50,6 @@ struct perf_evlist {
bool overwrite;
bool enabled;
bool has_user_cpus;
- bool backward;
size_t mmap_len;
int id_pos;
int is_pos;
We are going to use evlist->backward_mmap as a container for backward ring buffer. Since a evlist can hold normal and backward ring buffers together, evlist->backward is useless and misleading. Drop this indicator. Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Cc: Nilay Vaish <nilayvaish@gmail.com> Cc: pi3orama@163.com --- tools/perf/builtin-record.c | 11 +++++------ tools/perf/tests/backward-ring-buffer.c | 1 - tools/perf/util/evlist.c | 5 +---- tools/perf/util/evlist.h | 1 - 4 files changed, 6 insertions(+), 12 deletions(-) -- 1.8.3.4