Commit 0019dc87 authored by Kan Liang's avatar Kan Liang Committed by Arnaldo Carvalho de Melo

perf mmap: Simplify perf_mmap__read_event()

It isn't necessary to pass the 'overwrite', 'start' and 'end' argument
to perf_mmap__read_event().  Discard them.
Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
Suggested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1520350567-80082-7-git-send-email-kan.liang@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent d6ace3df
......@@ -115,7 +115,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
if (perf_mmap__read_init(md, false, &start, &end) < 0)
continue;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
struct perf_sample sample;
if (event->header.type != PERF_RECORD_COMM ||
......
......@@ -757,7 +757,7 @@ static s64 perf_kvm__mmap_read_idx(struct perf_kvm_stat *kvm, int idx,
if (err < 0)
return (err == -EAGAIN) ? 0 : -1;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
err = perf_evlist__parse_sample_timestamp(evlist, event, &timestamp);
if (err) {
perf_mmap__consume(md);
......
......@@ -824,7 +824,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
if (perf_mmap__read_init(md, opts->overwrite, &start, &end) < 0)
return;
while ((event = perf_mmap__read_event(md, opts->overwrite, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
ret = perf_evlist__parse_sample(evlist, event, &sample);
if (ret) {
pr_err("Can't parse sample, err = %d\n", ret);
......
......@@ -2509,7 +2509,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
if (perf_mmap__read_init(md, false, &start, &end) < 0)
continue;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
struct perf_sample sample;
++trace->nr_events;
......
......@@ -36,7 +36,7 @@ static int count_samples(struct perf_evlist *evlist, int *sample_count,
u64 start, end;
perf_mmap__read_init(map, true, &start, &end);
while ((event = perf_mmap__read_event(map, true, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(map)) != NULL) {
const u32 type = event->header.type;
switch (type) {
......
......@@ -183,7 +183,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void),
if (perf_mmap__read_init(md, false, &start, &end) < 0)
continue;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
const u32 type = event->header.type;
if (type == PERF_RECORD_SAMPLE)
......
......@@ -418,7 +418,7 @@ static int process_events(struct machine *machine, struct perf_evlist *evlist,
if (perf_mmap__read_init(md, false, &start, &end) < 0)
continue;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
ret = process_event(machine, evlist, event, state);
perf_mmap__consume(md);
if (ret < 0)
......
......@@ -36,7 +36,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm)
md = &evlist->mmap[i];
if (perf_mmap__read_init(md, false, &start, &end) < 0)
continue;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
if (event->header.type == PERF_RECORD_COMM &&
(pid_t)event->comm.pid == getpid() &&
(pid_t)event->comm.tid == getpid() &&
......
......@@ -112,7 +112,7 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuse
if (perf_mmap__read_init(md, false, &start, &end) < 0)
goto out_init;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
struct perf_sample sample;
if (event->header.type != PERF_RECORD_SAMPLE) {
......
......@@ -93,7 +93,7 @@ int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest
if (perf_mmap__read_init(md, false, &start, &end) < 0)
continue;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
const u32 type = event->header.type;
int tp_flags;
struct perf_sample sample;
......
......@@ -171,7 +171,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
if (perf_mmap__read_init(md, false, &start, &end) < 0)
continue;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
const u32 type = event->header.type;
const char *name = perf_event__name(type);
......
......@@ -99,7 +99,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
if (perf_mmap__read_init(md, false, &start, &end) < 0)
goto out_init;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
struct perf_sample sample;
if (event->header.type != PERF_RECORD_SAMPLE)
......
......@@ -267,7 +267,7 @@ static int process_events(struct perf_evlist *evlist,
if (perf_mmap__read_init(md, false, &start, &end) < 0)
continue;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
cnt += 1;
ret = add_event(evlist, &events, event);
perf_mmap__consume(md);
......
......@@ -116,7 +116,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused
if (perf_mmap__read_init(md, false, &start, &end) < 0)
goto out_init;
while ((event = perf_mmap__read_event(md, false, &start, end)) != NULL) {
while ((event = perf_mmap__read_event(md)) != NULL) {
if (event->header.type == PERF_RECORD_EXIT)
nr_exit++;
......
......@@ -75,10 +75,7 @@ static union perf_event *perf_mmap__read(struct perf_mmap *map,
* }
* perf_mmap__read_done()
*/
union perf_event *perf_mmap__read_event(struct perf_mmap *map,
bool overwrite __maybe_unused,
u64 *startp __maybe_unused,
u64 end __maybe_unused)
union perf_event *perf_mmap__read_event(struct perf_mmap *map)
{
union perf_event *event;
......
......@@ -89,9 +89,7 @@ static inline void perf_mmap__write_tail(struct perf_mmap *md, u64 tail)
union perf_event *perf_mmap__read_forward(struct perf_mmap *map);
union perf_event *perf_mmap__read_event(struct perf_mmap *map,
bool overwrite,
u64 *startp, u64 end);
union perf_event *perf_mmap__read_event(struct perf_mmap *map);
int perf_mmap__push(struct perf_mmap *md, void *to,
int push(void *to, void *buf, size_t size));
......
......@@ -995,7 +995,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
if (perf_mmap__read_init(md, false, &start, &end) < 0)
goto end;
event = perf_mmap__read_event(md, false, &start, end);
event = perf_mmap__read_event(md);
if (event != NULL) {
PyObject *pyevent = pyrf_event__new(event);
struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment