All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>, Don Zickus <dzickus@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 20/20] perf record: Use ring buffer consume method to look like other tools
Date: Wed, 17 Sep 2014 18:24:23 -0300	[thread overview]
Message-ID: <1410989063-14207-21-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1410989063-14207-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

All builtins that consume events from perf's ring buffer now end up
calling perf_evlist__mmap_consume(), which will allow unmapping the ring
buffer when all the fds gets closed and all events in the buffer
consumed.

This is in preparation for the patchkit that will notice POLLHUP on
perf events file descriptors.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-8vhaeeoq11ppz0713el4xcps@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 87e28a4e33ba..a1b040394170 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -65,8 +65,9 @@ static int process_synthesized_event(struct perf_tool *tool,
 	return record__write(rec, event, event->header.size);
 }
 
-static int record__mmap_read(struct record *rec, struct perf_mmap *md)
+static int record__mmap_read(struct record *rec, int idx)
 {
+	struct perf_mmap *md = &rec->evlist->mmap[idx];
 	unsigned int head = perf_mmap__read_head(md);
 	unsigned int old = md->prev;
 	unsigned char *data = md->base + page_size;
@@ -102,8 +103,7 @@ static int record__mmap_read(struct record *rec, struct perf_mmap *md)
 	}
 
 	md->prev = old;
-	perf_mmap__write_tail(md, old);
-
+	perf_evlist__mmap_consume(rec->evlist, idx);
 out:
 	return rc;
 }
@@ -245,7 +245,7 @@ static int record__mmap_read_all(struct record *rec)
 
 	for (i = 0; i < rec->evlist->nr_mmaps; i++) {
 		if (rec->evlist->mmap[i].base) {
-			if (record__mmap_read(rec, &rec->evlist->mmap[i]) != 0) {
+			if (record__mmap_read(rec, i) != 0) {
 				rc = -1;
 				goto out;
 			}
-- 
1.9.3


  parent reply	other threads:[~2014-09-17 21:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 21:24 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
2014-09-17 21:24 ` Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 01/20] perf tools: Add +field argument support for --sort option Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 02/20] perf tools powerpc: Fix build issue when DWARF support is disabled Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 03/20] perf kvm stat report: Save pid string in opts.target.pid Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 04/20] perf kvm stat report: Enable the target.system_wide flag Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 05/20] perf kvm stat report: Unify the title bar output Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 06/20] perf tools: Allow to specify lib compile variable for spec usage Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 07/20] perf tools: Let a user specify a PMU event without any config terms Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 08/20] perf tools: Add perf-with-kcore script Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 09/20] perf tools: Let default config be defined for a PMU Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 10/20] perf tools: Add perf_pmu__scan_file() Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 11/20] perf tool: fix compilation for ARM Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 12/20] perf tools: Disable kernel symbol demangling by default Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 13/20] perf tools: Fix GNU-only grep usage in Makefile Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 14/20] perf tools: Don't include sys/poll.h directly Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 15/20] perf tools: define _DEFAULT_SOURCE for glibc_2.20 Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 16/20] perf symbols: Ignore stripped vmlinux and fallback to kallsyms Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 17/20] perf symbols: Add path to Ubuntu kernel debuginfo file Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 18/20] perf probe: Do not access kallsyms when analyzing user binaries Arnaldo Carvalho de Melo
2014-09-17 21:24 ` [PATCH 19/20] perf probe: Do not use dwfl_module_addrsym if dwarf_diename finds symbol name Arnaldo Carvalho de Melo
2014-09-17 21:24 ` Arnaldo Carvalho de Melo [this message]
2014-09-19  5:15 ` [GIT PULL 00/20] perf/core improvements and fixes Ingo Molnar
2014-09-19  5:15   ` Ingo Molnar

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=1410989063-14207-21-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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.