summaryrefslogtreecommitdiff
path: root/tools/perf/lib
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-10-07 14:53:11 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-10-10 09:41:38 -0300
commitbf59b3053e63783520c2810fc3f676553bc7eedd (patch)
tree9f346e1a67d978a070e1083d5647eb4cacb098ce /tools/perf/lib
parente440979faf6ac8048e1792af383df6af78dd1cb0 (diff)
libperf: Adopt perf_mmap__mmap_len() function from tools/perf
Move perf_mmap__mmap_len() from tools/perf wto libperf, it will be used in the following patches. And rename the existing perf's function to mmap__mmap_len(). Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20191007125344.14268-4-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/lib')
-rw-r--r--tools/perf/lib/include/internal/mmap.h2
-rw-r--r--tools/perf/lib/mmap.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/lib/include/internal/mmap.h b/tools/perf/lib/include/internal/mmap.h
index b26806b36bb6..e7a67260940c 100644
--- a/tools/perf/lib/include/internal/mmap.h
+++ b/tools/perf/lib/include/internal/mmap.h
@@ -34,6 +34,8 @@ struct perf_mmap_param {
int mask;
};
+size_t perf_mmap__mmap_len(struct perf_mmap *map);
+
void perf_mmap__init(struct perf_mmap *map, bool overwrite);
#endif /* __LIBPERF_INTERNAL_MMAP_H */
diff --git a/tools/perf/lib/mmap.c b/tools/perf/lib/mmap.c
index 3da6177510e6..cc4284da4d99 100644
--- a/tools/perf/lib/mmap.c
+++ b/tools/perf/lib/mmap.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include <internal/mmap.h>
+#include <internal/lib.h>
void perf_mmap__init(struct perf_mmap *map, bool overwrite)
{
@@ -7,3 +8,8 @@ void perf_mmap__init(struct perf_mmap *map, bool overwrite)
map->overwrite = overwrite;
refcount_set(&map->refcnt, 0);
}
+
+size_t perf_mmap__mmap_len(struct perf_mmap *map)
+{
+ return map->mask + 1 + page_size;
+}