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: Kan Liang <kan.liang@linux.intel.com>
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri 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.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Kan Liang 2018-03-06 10:36:06 -05:00 committed by Arnaldo Carvalho de Melo
parent d6ace3df43
commit 0019dc87b9
17 changed files with 17 additions and 22 deletions

View File

@ -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 ||

View File

@ -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);

View File

@ -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);

View File

@ -2509,7 +2509,7 @@ again:
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;

View File

@ -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) {

View File

@ -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)

View File

@ -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)

View File

@ -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() &&

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -116,7 +116,7 @@ retry:
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++;

View File

@ -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;

View File

@ -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));

View File

@ -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;