[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181008105720.GI17270@krava>
Date: Mon, 8 Oct 2018 12:57:20 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v11 2/3]: perf record: enable asynchronous trace writing
On Mon, Oct 08, 2018 at 09:17:11AM +0300, Alexey Budankov wrote:
SNIP
> static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evlist,
> bool overwrite)
> {
> @@ -520,7 +644,10 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
> int i;
> int rc = 0;
> struct perf_mmap *maps;
> -
> +#ifdef HAVE_AIO_SUPPORT
> + int trace_fd = rec->data.file.fd;
> + off_t off;
> +#endif
> if (!evlist)
> return 0;
>
> @@ -531,14 +658,34 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
> if (overwrite && evlist->bkw_mmap_state != BKW_MMAP_DATA_PENDING)
> return 0;
>
> +#ifdef HAVE_AIO_SUPPORT
> + off = lseek(trace_fd, 0, SEEK_CUR);
> +#endif
> 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
I really don't like this.. let's have some aio_... function with its
dummy counterpart to be called in here.. and again.. if we realyl must
have this compiled optionaly, which I'm not convinced of
jirka
Powered by blists - more mailing lists