mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
perf session: Add reader object
Add a session private reader object to encapsulate the reading of the event data block. Starting with a 'fd' field. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20190110101301.6196-4-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
4f5a473d79
commit
82715eb184
@ -1820,11 +1820,17 @@ fetch_mmaped_event(struct perf_session *session,
|
||||
#define NUM_MMAPS 128
|
||||
#endif
|
||||
|
||||
struct reader {
|
||||
int fd;
|
||||
};
|
||||
|
||||
static int __perf_session__process_events(struct perf_session *session)
|
||||
{
|
||||
struct reader rd = {
|
||||
.fd = perf_data__fd(session->data),
|
||||
};
|
||||
struct ordered_events *oe = &session->ordered_events;
|
||||
struct perf_tool *tool = session->tool;
|
||||
int fd = perf_data__fd(session->data);
|
||||
u64 data_offset = session->header.data_offset;
|
||||
u64 data_size = session->header.data_size;
|
||||
u64 head, page_offset, file_offset, file_pos, size;
|
||||
@ -1864,7 +1870,7 @@ static int __perf_session__process_events(struct perf_session *session)
|
||||
mmap_flags = MAP_PRIVATE;
|
||||
}
|
||||
remap:
|
||||
buf = mmap(NULL, mmap_size, mmap_prot, mmap_flags, fd,
|
||||
buf = mmap(NULL, mmap_size, mmap_prot, mmap_flags, rd.fd,
|
||||
file_offset);
|
||||
if (buf == MAP_FAILED) {
|
||||
pr_err("failed to mmap file\n");
|
||||
|
Loading…
Reference in New Issue
Block a user