linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 14/14] perf record: Add --dir option to store data in directory
Date: Tue, 5 Feb 2019 14:51:37 +0100	[thread overview]
Message-ID: <20190205135137.GI4794@krava> (raw)
In-Reply-To: <41a1874b-3cd5-91d2-bc02-40fc8e93a9c4@linux.intel.com>

On Tue, Feb 05, 2019 at 03:36:24PM +0300, Alexey Budankov wrote:
> 
> On 03.02.2019 18:30, Jiri Olsa wrote:
> > Adding --dir option to store data in directory. It's next
> > step for multiple threads in record. It's not possible
> > to make directory data via --dir option, like:
> > 
> >   $ perf record --dir perf bench sched messaging
> >   $ ls -l perf.data
> >   total 344
> >   -rw-------. 1 jolsa jolsa 43864 Jan 20 22:26 data.0
> >   -rw-------. 1 jolsa jolsa 30464 Jan 20 22:26 data.1
> >   -rw-------. 1 jolsa jolsa 53816 Jan 20 22:26 data.2
> >   -rw-------. 1 jolsa jolsa 30368 Jan 20 22:26 data.3
> >   -rw-------. 1 jolsa jolsa 40088 Jan 20 22:26 data.4
> >   -rw-------. 1 jolsa jolsa 42592 Jan 20 22:26 data.5
> >   -rw-------. 1 jolsa jolsa 56136 Jan 20 22:26 data.6
> >   -rw-------. 1 jolsa jolsa 25992 Jan 20 22:26 data.7
> >   -rw-------. 1 jolsa jolsa  8832 Jan 20 22:26 header
> > 
> > There's a data file created for every cpu and it's storing
> > data for those cpu maps.
> > 
> > It's possible to transform directory data into standard
> > perf.data file via following inject command:
> > 
> >   $ perf inject -o perf.data.file -i perf.data
> > 
> > Link: http://lkml.kernel.org/n/tip-0kjm8wpglzu2tm18tpagfm4d@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/perf/Documentation/perf-record.txt |  3 ++
> >  tools/perf/builtin-record.c              | 59 ++++++++++++++++++++++--
> >  tools/perf/util/mmap.h                   | 23 ++++-----
> >  3 files changed, 70 insertions(+), 15 deletions(-)
> > 
> > diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
> > index d232b13ea713..8dcdc8cabcad 100644
> > --- a/tools/perf/Documentation/perf-record.txt
> > +++ b/tools/perf/Documentation/perf-record.txt
> > @@ -505,6 +505,9 @@ config terms. For example: 'cycles/overwrite/' and 'instructions/no-overwrite/'.
> >  
> >  Implies --tail-synthesize.
> >  
> > +--dir::
> > +Store data into directory with one data file for cpu.
> > +
> 
> Makes sense to mention compatibility with -o option and per-thread buffer mapping.

right, will do

> 
> >  SEE ALSO
> >  --------
> >  linkperf:perf-stat[1], linkperf:perf-list[1]
> > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> > index cd02ab3ec4ff..87e39b9cc7bd 100644
> > --- a/tools/perf/builtin-record.c
> > +++ b/tools/perf/builtin-record.c
> > @@ -111,17 +111,21 @@ static bool switch_output_time(struct record *rec)
> >  	       trigger_is_ready(&switch_output_trigger);
> >  }
> >  
> > -static int record__write(struct record *rec, struct perf_mmap *map __maybe_unused,
> > +static int record__write(struct record *rec, struct perf_mmap *map,
> >  			 void *bf, size_t size)
> >  {
> > -	struct perf_data_file *file = &rec->session->data->file;
> > +	struct perf_data_file *file = &rec->data.file;
> > +
> > +	if (map && map->file)
> > +		file = map->file;
> 
> For AIO mode per-cpu streaming could be done in parallel because Posix 
> AIO API uses a separate thread for every open data.# or header fd.

yes, I was thinking of that and I plan to try that to see
if there's some benefit

> 
> >  
> >  	if (perf_data_file__write(file, bf, size) < 0) {
> >  		pr_err("failed to write perf data, error: %m\n");
> >  		return -1;
> >  	}
> >  
> > -	rec->bytes_written += size;
> > +	if (file == &rec->data.file)
> > +		rec->bytes_written += size;
> 
> switch-output logic now tracks header file size only? 
> If so, it probably needs to be corrected or simply disabled 
> for --output_dir mode.

the rec->bytes_written value is used to track header file size,
which is used to fill in the header data section in here
record__finish_output, we can't mix other file sizes into it

the switch-output option still needs some changes to work
over the directory data

jirka

  reply	other threads:[~2019-02-05 13:51 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-03 15:30 [RFC/PATCH 00/14] perf record: Add support to store data in directory Jiri Olsa
2019-02-03 15:30 ` [PATCH 01/14] perf tools: Make rm_rf to remove single file Jiri Olsa
2019-02-05 11:33   ` Alexey Budankov
2019-02-05 13:38     ` Jiri Olsa
2019-02-03 15:30 ` [PATCH 02/14] perf session: Add process callback to reader object Jiri Olsa
2019-02-03 15:30 ` [PATCH 03/14] perf data: Move size to struct perf_data_file Jiri Olsa
2019-02-03 15:30 ` [PATCH 04/14] perf data: Add global path holder Jiri Olsa
2019-02-03 15:30 ` [PATCH 05/14] perf data: Make check_backup work over directories Jiri Olsa
2019-02-03 15:30 ` [PATCH 06/14] perf data: Add perf_data__(create_dir|free_dir) functions Jiri Olsa
2019-02-05 11:52   ` Alexey Budankov
2019-02-05 13:42     ` Jiri Olsa
2019-02-05 13:46   ` Arnaldo Carvalho de Melo
2019-02-05 13:53     ` Jiri Olsa
2019-02-03 15:30 ` [PATCH 07/14] perf data: Add perf_data__open_dir_data function Jiri Olsa
2019-02-03 15:30 ` [PATCH 08/14] perf data: Add directory support Jiri Olsa
2019-02-03 15:30 ` [PATCH 09/14] perf data: Don't store auxtrace index for directory data file Jiri Olsa
2019-02-03 15:30 ` [PATCH 10/14] perf data: Add perf_data__update_dir function Jiri Olsa
2019-02-03 15:30 ` [PATCH 11/14] perf data: Make perf_data__size to work over directory Jiri Olsa
2019-02-03 15:30 ` [PATCH 12/14] perf session: Add __perf_session__process_dir_events function Jiri Olsa
2019-02-03 15:30 ` [PATCH 13/14] perf session: Add path to reader object Jiri Olsa
2019-02-03 15:30 ` [PATCH 14/14] perf record: Add --dir option to store data in directory Jiri Olsa
2019-02-05 12:36   ` Alexey Budankov
2019-02-05 13:51     ` Jiri Olsa [this message]
2019-02-04 10:12 ` [RFC/PATCH 00/14] perf record: Add support " Alexey Budankov
2019-02-04 10:36   ` Jiri Olsa
2019-02-04 11:29     ` Alexey Budankov
2019-02-04 11:41       ` Jiri Olsa
2019-02-04 18:56         ` Stephane Eranian
2019-02-04 19:27           ` Arnaldo Carvalho de Melo
2019-02-04 19:56             ` Alexey Budankov
2019-02-04 20:05             ` Stephane Eranian
2019-02-04 20:28               ` Jiri Olsa
2019-02-04 22:44                 ` Stephane Eranian
2019-02-05 13:37                   ` Jiri Olsa
2019-02-11 10:19                     ` Jiri Olsa
2019-02-11 18:34                       ` Stephane Eranian
2019-02-11 18:53                         ` Jiri Olsa
2019-02-11 19:32                           ` Arnaldo Carvalho de Melo
2019-02-11 20:18                             ` Jiri Olsa
2019-02-11 20:43                               ` Stephane Eranian
2019-02-14 11:34                                 ` Jiri Olsa
2019-02-14 12:57                                   ` Arnaldo Carvalho de Melo
2019-02-14 13:26                                     ` Jiri Olsa
2019-02-14 13:59                                       ` Arnaldo Carvalho de Melo
2019-02-14 21:30                                         ` Stephane Eranian
     [not found]                                           ` <CA+JHD90ssKi3CJ7yfCFTkrS8xwUsZhvd0t7cSCy1MF7TJ2XLYw@mail.gmail.com>
2019-02-14 21:39                                             ` Stephane Eranian
2019-02-11 18:55                         ` Arnaldo Carvalho de Melo
2019-02-11 19:30                           ` Stephane Eranian
2019-02-11 20:30                             ` Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190205135137.GI4794@krava \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).