libperf: Add perf_mmap struct

Add the perf_mmap struct to libperf.

The definition is added into:

  include/internal/mmap.h

which is not to be included by users, but shared within perf and
libperf.

Committer notes:

Remove unnecessary includes from tools/perf/lib/include/internal/mmap.h,
those will be readded as they become necessary, later in the series.

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 <a.p.zijlstra@chello.nl>
Link: http://lore.kernel.org/lkml/20190913132355.21634-11-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Jiri Olsa
2019-07-27 22:07:44 +02:00
committed by Arnaldo Carvalho de Melo
parent e0fcfb086f
commit 547740f7b3
7 changed files with 39 additions and 24 deletions

View File

@ -1,6 +1,7 @@
#ifndef __PERF_MMAP_H
#define __PERF_MMAP_H 1
#include <internal/mmap.h>
#include <linux/compiler.h>
#include <linux/refcount.h>
#include <linux/types.h>
@ -20,7 +21,7 @@ struct aiocb;
* @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this
*/
struct mmap {
void *base;
struct perf_mmap core;
int mask;
int fd;
int cpu;
@ -60,12 +61,12 @@ void perf_mmap__consume(struct mmap *map);
static inline u64 perf_mmap__read_head(struct mmap *mm)
{
return ring_buffer_read_head(mm->base);
return ring_buffer_read_head(mm->core.base);
}
static inline void perf_mmap__write_tail(struct mmap *md, u64 tail)
{
ring_buffer_write_tail(md->base, tail);
ring_buffer_write_tail(md->core.base, tail);
}
union perf_event *perf_mmap__read_forward(struct mmap *map);