Messages in this thread | | | Subject | Re: [PATCH v11 2/3]: perf record: enable asynchronous trace writing | From | Alexey Budankov <> | Date | Mon, 8 Oct 2018 15:24:31 +0300 |
| |
Hi,
On 08.10.2018 13:52, Jiri Olsa wrote: > On Mon, Oct 08, 2018 at 09:17:11AM +0300, Alexey Budankov wrote: <SNIP> >> +#ifdef HAVE_AIO_SUPPORT >> + off = lseek(trace_fd, 0, SEEK_CUR); >> +#endif > > I'm still little puzzled why we need to do this, > when the aio write takes the offset value, but
pwrite() syscall [1] which is the base for aio_write() doesn't advance file pos value so it requires to be calculated and updated by callers of aio_write() API.
> please provide some aio_.. function for this
Accepted.
> > >> for (i = 0; i < evlist->nr_mmaps; i++) { >> struct perf_mmap *map = &maps[i]; >> >> if (map->base) { >> - if (perf_mmap__push(map, rec, record__pushfn) != 0) { >> - rc = -1; >> - goto out; >> +#ifdef HAVE_AIO_SUPPORT >> + if (!rec->opts.nr_cblocks) { >> +#endif >> + if (perf_mmap__push(map, rec, record__pushfn) != 0) { >> + rc = -1; >> + goto out; >> + } >> +#ifdef HAVE_AIO_SUPPORT >> + } else { >> + /* >> + * Call record__aio_sync() to wait till map->data buffer >> + * becomes available after previous aio write request. >> + */ >> + record__aio_sync(map); >> + if (perf_mmap__aio_push(map, rec, record__aio_pushfn, &off) != 0) { >> + lseek(trace_fd, off, SEEK_SET); >> + rc = -1; >> + goto out; >> + } >> } >> +#endif >> } >> >> if (map->auxtrace_mmap.base && !rec->opts.auxtrace_snapshot_mode && >> @@ -547,7 +694,9 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli >> goto out; >> } >> } >> - >> +#ifdef HAVE_AIO_SUPPORT >> + lseek(trace_fd, off, SEEK_SET); >> +#endif > > ditto
Accepted.
Thanks, Alexey
> > thanks, > jirka >
[1] http://man7.org/linux/man-pages/man2/pread.2.html
| |