perf mmap: Simplify perf_mmap__read_event()
authorKan Liang <kan.liang@linux.intel.com>
Tue, 6 Mar 2018 15:36:06 +0000 (10:36 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 8 Mar 2018 13:05:53 +0000 (10:05 -0300)
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>
17 files changed:
tools/perf/arch/x86/tests/perf-time-to-tsc.c
tools/perf/builtin-kvm.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/tests/backward-ring-buffer.c
tools/perf/tests/bpf.c
tools/perf/tests/code-reading.c
tools/perf/tests/keep-tracking.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/openat-syscall-tp-fields.c
tools/perf/tests/perf-record.c
tools/perf/tests/sw-clock.c
tools/perf/tests/switch-tracking.c
tools/perf/tests/task-exit.c
tools/perf/util/mmap.c
tools/perf/util/mmap.h
tools/perf/util/python.c

index a9bc77df6a652b3d9681522a4a9579bf905258e8..17cf7fc3c7d5650705442af3bf5e96872ba546eb 100644 (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 ||
index 165c044616b6939e797f53cfe4147fdeedaff1cb..e9f69b8f8e251ebfc6e614b5d7e2b34c568ef4d9 100644 (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);
index 11b4a413039fe524cb25bbd4e94c871bae25c0bb..eb19cf92a3887ea1de33714c6e7c4bffe9d07583 100644 (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);
index 27eadf3018c6df2bc8365e326d865239a96e7e4f..29fda506ac757eff7048563b07d78a85a4a39e79 100644 (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;
index e0b1b414d466b4601fb9033717b9bed5f0bd9c3e..e0eae1053ddc5f34cd6e0cbff0c8af5aa4e037e7 100644 (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) {
index 09c9c9f9e827124aec20f98c15fdaa05f0c1d4e5..384c20f4c902344a4fdf72557e0c02fe296b5240 100644 (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)
index f7c199acb7ac86e1574399fb3a504313293864e9..f7919666bc2c03db018537a59c2304c758bb5228 100644 (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)
index 1f1db5965d05835db1c0be2128ca8d91695ea297..ad477b7cf238a23f2beb10b08758b9ab3db315c1 100644 (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() &&
index f473e106aebaf9aad97e7460cd627d3a63bc300e..7790eb3303e6438f543a4910ff640a9de8081005 100644 (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) {
index 7837ae93667922ff5d51a7776c56510f4e021439..b0be2da65da734a79878cfcd5edb328e072f9e69 100644 (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;
index 6ff5f99b3e0e47ec15f7cb1af793d9a5f94e01c4..59be0942b787a41ab812144bc88447ac65bdd630 100644 (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);
 
index b58297b9a83d74995cd7bb8d2c94fe29f1ad8bcc..403f2d9cee9641adae0057068957ff1f8cd56918 100644 (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)
index dbf9e20f7d56f44a299934e8dcb798c70e77ce91..99839de3caeefc38b43518252f71321353f41b3e 100644 (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);
index 5aa2e68e9d05e17bd8838f5846f52f11a67fc6cf..2df0c0573e2c6041c2eb4bd9322fc7e380b11638 100644 (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++;
 
index 62312e06d75b041bd6099625db074d27835e2af2..2fbe4c8a02d228e3347639988c36820aa2bd51a4 100644 (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;
 
index 043916a20de686e82c24f272d9205fee37b69c7f..ae9499b801105c16650dab13e9d59e88e263813a 100644 (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));
index ca077f8be1f0a5d11dc189c955c7924307ced1b8..4798db93e7ee8924ab7bb1748dfddca7b00b449f 100644 (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;