From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
LKML <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>,
Stephane Eranian <eranian@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Andi Kleen <andi@firstfloor.org>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [PATCH 08/37] perf tools: Handle multi-file session properly
Date: Wed, 31 Dec 2014 13:01:12 +0100 [thread overview]
Message-ID: <20141231120112.GD1256@krava.brq.redhat.com> (raw)
In-Reply-To: <1419405333-27952-9-git-send-email-namhyung@kernel.org>
On Wed, Dec 24, 2014 at 04:15:04PM +0900, Namhyung Kim wrote:
> When perf detects multi-file data directory, process header file first
> and then rest data files in a row. Note that the multi-file data is
> recorded for each cpu/thread separately, it's already ordered with
> respect to themselves so no need to use the ordered event queue
> interface.
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/data.c | 17 +++++++++++++++++
> tools/perf/util/session.c | 41 +++++++++++++++++++++++++++++++----------
> 2 files changed, 48 insertions(+), 10 deletions(-)
>
> diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
> index 8dacd34659cc..b6f7cdc4a39f 100644
> --- a/tools/perf/util/data.c
> +++ b/tools/perf/util/data.c
> @@ -52,6 +52,21 @@ static int check_backup(struct perf_data_file *file)
> return 0;
> }
>
> +static void check_multi(struct perf_data_file *file)
> +{
> + struct stat st;
> +
> + /*
> + * For write, it'll be determined by user (perf record -M)
> + * whether to enable multi file data storage.
> + */
> + if (perf_data_file__is_write(file))
> + return;
> +
> + if (!stat(file->path, &st) && S_ISDIR(st.st_mode))
> + file->is_multi = true;
> +}
> +
> static int scandir_filter(const struct dirent *d)
> {
> return !prefixcmp(d->d_name, "perf.data.");
> @@ -206,6 +221,8 @@ int perf_data_file__open(struct perf_data_file *file)
> if (check_pipe(file))
> return 0;
>
> + check_multi(file);
> +
> if (!file->path)
> file->path = default_data_path(file);
>
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index 88aa2f09df93..4f0fcd2d3901 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -1252,11 +1252,10 @@ fetch_mmaped_event(struct perf_session *session,
> #define NUM_MMAPS 128
> #endif
>
> -static int __perf_session__process_events(struct perf_session *session,
> +static int __perf_session__process_events(struct perf_session *session, int fd,
> u64 data_offset, u64 data_size,
> u64 file_size, struct perf_tool *tool)
> {
> - int fd = perf_data_file__fd(session->file);
> u64 head, page_offset, file_offset, file_pos, size;
> int err, mmap_prot, mmap_flags, map_idx = 0;
> size_t mmap_size;
> @@ -1362,18 +1361,40 @@ int perf_session__process_events(struct perf_session *session,
> struct perf_tool *tool)
> {
> u64 size = perf_data_file__size(session->file);
> - int err;
> + int err, i;
>
> if (perf_session__register_idle_thread(session) == NULL)
> return -ENOMEM;
>
> - if (!perf_data_file__is_pipe(session->file))
> - err = __perf_session__process_events(session,
> - session->header.data_offset,
> - session->header.data_size,
> - size, tool);
> - else
> - err = __perf_session__process_pipe_events(session, tool);
> + if (perf_data_file__is_pipe(session->file))
> + return __perf_session__process_pipe_events(session, tool);
> +
> + err = __perf_session__process_events(session,
> + perf_data_file__fd(session->file),
> + session->header.data_offset,
> + session->header.data_size,
> + size, tool);
> + if (!session->file->is_multi || err)
> + return err;
if we have file->is_multi true, the perf_data_file__fd(session->file)
is the perf.header file right? So presumably, there's no data in it,
and we dont need to call above __perf_session__process_events function?
jirka
> +
> + /*
> + * For multi-file data storage, events are processed for each
> + * cpu/thread so it's already ordered.
> + */
> + tool->ordered_events = false;
> +
> + for (i = 0; i < session->file->nr_multi; i++) {
> + int fd = perf_data_file__multi_fd(session->file, i);
> +
> + size = lseek(fd, 0, SEEK_END);
> + if (size == 0)
> + continue;
> +
> + err = __perf_session__process_events(session, fd,
> + 0, size, size, tool);
> + if (err < 0)
> + break;
> + }
>
> return err;
> }
> --
> 2.1.3
>
next prev parent reply other threads:[~2014-12-31 12:01 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-24 7:14 [RFC/PATCHSET 00/37] perf tools: Speed-up perf report by using multi thread (v1) Namhyung Kim
2014-12-24 7:14 ` [PATCH 01/37] perf tools: Set attr.task bit for a tracking event Namhyung Kim
2014-12-31 11:25 ` Jiri Olsa
2014-12-24 7:14 ` [PATCH 02/37] perf record: Use a software dummy event to track task/mmap events Namhyung Kim
2014-12-26 16:27 ` David Ahern
2014-12-27 5:28 ` Namhyung Kim
2014-12-29 12:58 ` Adrian Hunter
2014-12-30 5:51 ` Namhyung Kim
2014-12-30 9:04 ` Adrian Hunter
2014-12-24 7:14 ` [PATCH 03/37] perf tools: Use perf_data_file__fd() consistently Namhyung Kim
2014-12-26 16:30 ` David Ahern
2014-12-27 5:30 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 04/37] perf tools: Add multi file interface to perf_data_file Namhyung Kim
2014-12-25 22:08 ` Jiri Olsa
2014-12-26 1:19 ` Namhyung Kim
2014-12-31 11:26 ` Jiri Olsa
2014-12-31 14:55 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 05/37] perf tools: Create separate mmap for dummy tracking event Namhyung Kim
2014-12-25 22:08 ` Jiri Olsa
2014-12-26 1:45 ` Namhyung Kim
2014-12-25 22:09 ` Jiri Olsa
2014-12-26 1:55 ` Namhyung Kim
2014-12-26 16:51 ` David Ahern
2014-12-27 5:32 ` Namhyung Kim
2014-12-29 13:44 ` Adrian Hunter
2014-12-30 5:57 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 06/37] perf tools: Introduce perf_evlist__mmap_multi() Namhyung Kim
2014-12-24 7:15 ` [PATCH 07/37] perf tools: Do not use __perf_session__process_events() directly Namhyung Kim
2014-12-31 11:33 ` Jiri Olsa
2014-12-24 7:15 ` [PATCH 08/37] perf tools: Handle multi-file session properly Namhyung Kim
2014-12-31 12:01 ` Jiri Olsa [this message]
2014-12-31 14:53 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 09/37] perf record: Add -M/--multi option for multi file recording Namhyung Kim
2014-12-24 7:15 ` [PATCH 10/37] perf report: Skip dummy tracking event Namhyung Kim
2014-12-24 7:15 ` [PATCH 11/37] perf tools: Introduce thread__comm_time() helpers Namhyung Kim
2014-12-26 17:00 ` David Ahern
2014-12-27 5:36 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 12/37] perf tools: Add a test case for thread comm handling Namhyung Kim
2014-12-24 7:15 ` [PATCH 13/37] perf tools: Use thread__comm_time() when adding hist entries Namhyung Kim
2014-12-25 22:53 ` Jiri Olsa
2014-12-26 2:10 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 14/37] perf tools: Convert dead thread list into rbtree Namhyung Kim
2014-12-25 23:05 ` Jiri Olsa
2014-12-26 2:26 ` Namhyung Kim
2014-12-26 17:14 ` David Ahern
2014-12-27 5:42 ` Namhyung Kim
2014-12-27 15:31 ` David Ahern
2014-12-28 13:24 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 15/37] perf tools: Introduce machine__find*_thread_time() Namhyung Kim
2014-12-27 16:33 ` David Ahern
2014-12-28 14:50 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 16/37] perf tools: Add a test case for timed thread handling Namhyung Kim
2014-12-31 14:17 ` Jiri Olsa
2014-12-31 15:32 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 17/37] perf tools: Maintain map groups list in a leader thread Namhyung Kim
2014-12-24 7:15 ` [PATCH 18/37] perf tools: Remove thread when map groups initialization failed Namhyung Kim
2014-12-28 0:45 ` David Ahern
2014-12-29 7:08 ` Namhyung Kim
2014-12-24 7:15 ` [PATCH 19/37] perf tools: Introduce thread__find_addr_location_time() and friends Namhyung Kim
2014-12-24 7:15 ` [PATCH 20/37] perf tools: Add a test case for timed map groups handling Namhyung Kim
2014-12-24 7:15 ` [PATCH 21/37] perf tools: Protect dso symbol loading using a mutex Namhyung Kim
2014-12-24 7:15 ` [PATCH 22/37] perf tools: Protect dso cache tree using dso->lock Namhyung Kim
2014-12-24 7:15 ` [PATCH 23/37] perf tools: Protect dso cache fd with a mutex Namhyung Kim
2014-12-24 7:15 ` [PATCH 24/37] perf session: Pass struct events stats to event processing functions Namhyung Kim
2014-12-24 7:15 ` [PATCH 25/37] perf hists: Pass hists struct to hist_entry_iter functions Namhyung Kim
2014-12-24 7:15 ` [PATCH 26/37] perf tools: Move BUILD_ID_SIZE definition to perf.h Namhyung Kim
2014-12-24 7:15 ` [PATCH 27/37] perf report: Parallelize perf report using multi-thread Namhyung Kim
2014-12-24 7:15 ` [PATCH 28/37] perf tools: Add missing_threads rb tree Namhyung Kim
2014-12-24 7:15 ` [PATCH 29/37] perf top: Always creates thread in the current task tree Namhyung Kim
2014-12-24 7:15 ` [PATCH 30/37] perf tools: Fix progress ui to support multi thread Namhyung Kim
2014-12-24 7:15 ` [PATCH 31/37] perf record: Show total size of multi file data Namhyung Kim
2014-12-24 7:15 ` [PATCH 32/37] perf report: Add --multi-thread option and config item Namhyung Kim
2014-12-24 7:15 ` [PATCH 33/37] perf tools: Add front cache for dso data access Namhyung Kim
2014-12-24 7:15 ` [PATCH 34/37] perf tools: Convert lseek + read to pread Namhyung Kim
2014-12-24 7:15 ` [PATCH 35/37] perf callchain: Save eh/debug frame offset for dwarf unwind Namhyung Kim
2014-12-24 7:15 ` [PATCH 36/37] perf tools: Add new perf data command Namhyung Kim
2014-12-24 7:15 ` [PATCH 37/37] perf data: Implement 'split' subcommand Namhyung Kim
2014-12-24 13:51 ` Arnaldo Carvalho de Melo
2014-12-24 14:14 ` Namhyung Kim
2014-12-24 14:45 ` Arnaldo Carvalho de Melo
2014-12-26 13:59 ` Jiri Olsa
2014-12-27 5:21 ` Namhyung Kim
2014-12-26 14:02 ` [RFC/PATCHSET 00/37] perf tools: Speed-up perf report by using multi thread (v1) Jiri Olsa
2014-12-27 5:23 ` Namhyung Kim
2015-01-05 18:48 ` Andi Kleen
2015-01-06 15:50 ` Stephane Eranian
2015-01-07 7:13 ` Namhyung Kim
2015-01-07 15:14 ` Stephane Eranian
2015-01-08 5:19 ` Namhyung Kim
2015-01-07 6:58 ` Namhyung Kim
2015-01-08 14:52 ` Andi Kleen
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=20141231120112.GD1256@krava.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--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