Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf evlist: Choose correct reading direction according to evlist->backward

Now we have evlist->backward to indicate the mmap direction. Make
perf_evlist__mmap_read() choose right direction automatically.

Signed-off-by: Wang Nan <wangnan0@huawei.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: pi3orama@163.com
Link: http://lkml.kernel.org/r/1464183898-174512-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Wang Nan and committed by
Arnaldo Carvalho de Melo
5a5ddeb6 e10e4ef6

+10 -1
+8 -1
tools/perf/util/evlist.c
··· 777 777 return event; 778 778 } 779 779 780 - union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) 780 + union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int idx) 781 781 { 782 782 struct perf_mmap *md = &evlist->mmap[idx]; 783 783 u64 head; ··· 830 830 end = head + md->mask + 1; 831 831 832 832 return perf_mmap__read(md, false, start, end, &md->prev); 833 + } 834 + 835 + union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) 836 + { 837 + if (!evlist->backward) 838 + return perf_evlist__mmap_read_forward(evlist, idx); 839 + return perf_evlist__mmap_read_backward(evlist, idx); 833 840 } 834 841 835 842 void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx)
+2
tools/perf/util/evlist.h
··· 131 131 132 132 union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx); 133 133 134 + union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, 135 + int idx); 134 136 union perf_event *perf_evlist__mmap_read_backward(struct perf_evlist *evlist, 135 137 int idx); 136 138 void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx);