Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1406625
| From | Wang Nan <wangnan0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v5 2/8] perf tools: Choose correct reading direction according to evlist->backward |
| Date | 2016-05-25 07:10 +0200 |
| Message-ID | <rCzeW-5mD-9@gated-at.bofh.it> (permalink) |
| References | <rCzeV-5mD-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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: Arnaldo Carvalho de Melo <acme@redhat.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: He Kuang <hekuang@huawei.com>
---
tools/perf/util/evlist.c | 9 ++++++++-
tools/perf/util/evlist.h | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index f916d25..8f7b44e 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -778,7 +778,7 @@ broken_event:
return event;
}
-union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
+union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int idx)
{
struct perf_mmap *md = &evlist->mmap[idx];
u64 head;
@@ -833,6 +833,13 @@ perf_evlist__mmap_read_backward(struct perf_evlist *evlist, int idx)
return perf_mmap__read(md, false, start, end, &md->prev);
}
+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);
+}
+
void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx)
{
struct perf_mmap *md = &evlist->mmap[idx];
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 0505012..41e65ac 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -134,6 +134,8 @@ struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id);
union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx);
+union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist,
+ int idx);
union perf_event *perf_evlist__mmap_read_backward(struct perf_evlist *evlist,
int idx);
void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx);
--
1.8.3.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 0/8] perf tools: Support overwritable ring buffer Wang Nan <wangnan0@huawei.com> - 2016-05-25 07:10 +0200
[PATCH v5 4/8] perf record: Introduce rec->overwrite_evlist for overwritable events Wang Nan <wangnan0@huawei.com> - 2016-05-25 07:10 +0200
Re: [PATCH v5 4/8] perf record: Introduce rec->overwrite_evlist for overwritable events "Wangnan (F)" <wangnan0@huawei.com> - 2016-05-25 12:20 +0200
Re: [PATCH v5 4/8] perf record: Introduce rec->overwrite_evlist for overwritable events "Wangnan (F)" <wangnan0@huawei.com> - 2016-05-25 15:50 +0200
Re: [PATCH v5 4/8] perf record: Introduce rec->overwrite_evlist for overwritable events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-25 16:20 +0200
[PATCH v5 1/8] perf tools: Check 'base' pointer before checking refcnt when put a mmap Wang Nan <wangnan0@huawei.com> - 2016-05-25 07:10 +0200
[PATCH v5 2/8] perf tools: Choose correct reading direction according to evlist->backward Wang Nan <wangnan0@huawei.com> - 2016-05-25 07:10 +0200
[PATCH v5 3/8] perf tests: Add testcase for auxiliary evlist Wang Nan <wangnan0@huawei.com> - 2016-05-25 07:10 +0200
[PATCH v5 7/8] perf tools: Don't warn about out of order event if write_backward is used Wang Nan <wangnan0@huawei.com> - 2016-05-25 07:10 +0200
[PATCH v5 6/8] perf tools: Enable overwrite settings Wang Nan <wangnan0@huawei.com> - 2016-05-25 07:10 +0200
csiph-web