All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: David Ahern <dsahern@gmail.com>
Cc: acme@ghostprotocols.net, linux-kernel@vger.kernel.org,
	jolsa@redhat.com, Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mike Galbraith <efault@gmx.de>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 2/2] perf record: mmap output file - v4
Date: Mon, 11 Nov 2013 12:29:06 +0100	[thread overview]
Message-ID: <20131111112906.GE15810@gmail.com> (raw)
In-Reply-To: <1383884605-30968-3-git-send-email-dsahern@gmail.com>


* David Ahern <dsahern@gmail.com> wrote:

> When recording raw_syscalls for the entire system, e.g.,
>     perf record -e raw_syscalls:*,sched:sched_switch -a -- sleep 1
> 
> you end up with a negative feedback loop as perf itself calls write() fairly
> often. This patch handles the problem by mmap'ing the file in chunks of 64M at
> a time and copies events from the event buffers to the file avoiding write
> system calls.
> 
> Before (with write syscall):
> 
>     perf record -o /tmp/perf.data -e raw_syscalls:*,sched:sched_switch -a -- sleep 1
>     [ perf record: Woken up 0 times to write data ]
>     [ perf record: Captured and wrote 81.843 MB /tmp/perf.data (~3575786 samples) ]
> 
> After (using mmap):
> 
>     perf record -o /tmp/perf.data -e raw_syscalls:*,sched:sched_switch -a -- sleep 1
>     [ perf record: Woken up 31 times to write data ]
>     [ perf record: Captured and wrote 8.203 MB /tmp/perf.data (~358388 samples) ]
> 
> In addition to perf-trace benefits using mmap lowers the overhead of
> perf-record. For example,
> 
>   perf stat -i -- perf record -g -o /tmp/perf.data openssl speed aes
> 
> shows a drop in time, CPU cycles, and instructions all drop by more than a
> factor of 3. Jiri also ran a test that showed a big improvement.
> 
> v4: Refactoring per Ingo's comments
> 
> v3: Removed use of bytes_at_mmap_start at the stat() that set it
>     Added user option to control the size of the mmap for writing file.
> 
> v2: Removed msync call before munmap per Jiri's suggestion
> 
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Stephane Eranian <eranian@google.com>
> ---
>  tools/perf/Documentation/perf-record.txt |   5 +
>  tools/perf/builtin-record.c              | 155 +++++++++++++++++++++++++++++++
>  2 files changed, 160 insertions(+)

Looks very clean now!

Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo

  parent reply	other threads:[~2013-11-11 11:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08  4:23 [PATCH 0/2] perf: mmap output file - v4 David Ahern
2013-11-08  4:23 ` [PATCH 1/2] perf record: Move existing write_output into helper function David Ahern
2013-11-12 21:55   ` [tip:perf/urgent] " tip-bot for David Ahern
2013-11-08  4:23 ` [PATCH 2/2] perf record: mmap output file - v4 David Ahern
2013-11-08  9:34   ` Jiri Olsa
2013-11-08 16:52     ` David Ahern
2013-11-11 11:29   ` Ingo Molnar [this message]
2013-11-11 14:58     ` Arnaldo Carvalho de Melo
2013-11-11 15:17       ` David Ahern
2013-11-11 20:41         ` Ingo Molnar
2013-11-11 20:44           ` David Ahern

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=20131111112906.GE15810@gmail.com \
    --to=mingo@kernel.org \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.