Re: [PATCH v12 2/3]: perf record: enable asynchronous trace writing

From: Jiri Olsa
Date: Thu Oct 11 2018 - 09:45:50 EST


On Tue, Oct 09, 2018 at 11:58:53AM +0300, Alexey Budankov wrote:

SNIP

> @@ -329,7 +469,7 @@ static int record__mmap_evlist(struct record *rec,
>
> if (perf_evlist__mmap_ex(evlist, opts->mmap_pages,
> opts->auxtrace_mmap_pages,
> - opts->auxtrace_snapshot_mode) < 0) {
> + opts->auxtrace_snapshot_mode, opts->nr_cblocks) < 0) {
> if (errno == EPERM) {
> pr_err("Permission error mapping pages.\n"
> "Consider increasing "
> @@ -513,6 +653,29 @@ static struct perf_event_header finished_round_event = {
> .type = PERF_RECORD_FINISHED_ROUND,
> };
>
> +#ifdef HAVE_AIO_SUPPORT
> +static void record__mmap_read_sync(struct record *rec)
> +{
> + int i;
> + struct perf_evlist *evlist = rec->evlist;
> + struct perf_mmap *maps = evlist->mmap;
> +
> + if (!rec->opts.nr_cblocks)
> + return;
> +
> + for (i = 0; i < evlist->nr_mmaps; i++) {
> + struct perf_mmap *map = &maps[i];
> +
> + if (map->base)
> + record__aio_sync(map);
> + }
> +}
> +#else
> +static void record__mmap_read_sync(struct record *rec __maybe_unused)
> +{
> +}
> +#endif

please move this up so we have just one 'ifdef HAVE_AIO_SUPPORT' block

and change the name to record__aio_mmap_read_sync, so it's obvious it's
aio related, like the rest of the functions you added

thanks,
jirka