summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evlist.h
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2016-07-14 10:34:35 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-07-15 22:27:46 +0200
commit8db6d6b19e486eef3db41bbd74a1f4c2b82d7706 (patch)
tree719f07ba8567f25333b292519b8d6864c40b09e7 /tools/perf/util/evlist.h
parenttools lib fd array: Allow associating a pointer cookie with each entry (diff)
downloadlinux-8db6d6b19e486eef3db41bbd74a1f4c2b82d7706.tar.xz
linux-8db6d6b19e486eef3db41bbd74a1f4c2b82d7706.zip
perf evlist: Update mmap related APIs and helpers
Currently, the evlist mmap related helpers and APIs accept evlist and idx, and dereference 'struct perf_mmap' by evlist->mmap[idx]. This is unnecessary, and force each evlist contains only one mmap array. Following commits are going to introduce multiple mmap arrays to a evlist. This patch refators these APIs and helpers, introduces functions accept perf_mmap pointer directly. New helpers and APIs are decoupled with perf_evlist, and become perf_mmap functions (so they have perf_mmap prefix). Old functions are reimplemented with new functions. Some of them will be removed in following commits. Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: He Kuang <hekuang@huawei.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Nilay Vaish <nilayvaish@gmail.com> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1468485287-33422-4-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evlist.h')
-rw-r--r--tools/perf/util/evlist.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index afd087761a47..9e680c62c980 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -35,6 +35,12 @@ struct perf_mmap {
char event_copy[PERF_SAMPLE_MAX_SIZE] __attribute__((aligned(8)));
};
+static inline size_t
+perf_mmap__mmap_len(struct perf_mmap *map)
+{
+ return map->mask + 1 + page_size;
+}
+
struct perf_evlist {
struct list_head entries;
struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
@@ -129,6 +135,12 @@ struct perf_evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist,
struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id);
+union perf_event *perf_mmap__read_forward(struct perf_mmap *map, bool check_messup);
+union perf_event *perf_mmap__read_backward(struct perf_mmap *map);
+
+void perf_mmap__read_catchup(struct perf_mmap *md);
+void perf_mmap__consume(struct perf_mmap *md, bool overwrite);
+
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,