diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-09-17 15:42:58 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-09-17 17:01:43 -0400 |
commit | e5685730e2c620f97bc12380e9370e857e5bd7a7 (patch) | |
tree | f65a2e146bbb838b882128e17d06a1b34e8fe63c /tools | |
parent | 664fee3dc37939bb8010906913fa9dbc52abb587 (diff) |
perf record: Use ring buffer consume method to look like other tools
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 8 |
1 files 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, | |||
65 | return record__write(rec, event, event->header.size); | 65 | return record__write(rec, event, event->header.size); |
66 | } | 66 | } |
67 | 67 | ||
68 | static int record__mmap_read(struct record *rec, struct perf_mmap *md) | 68 | static int record__mmap_read(struct record *rec, int idx) |
69 | { | 69 | { |
70 | struct perf_mmap *md = &rec->evlist->mmap[idx]; | ||
70 | unsigned int head = perf_mmap__read_head(md); | 71 | unsigned int head = perf_mmap__read_head(md); |
71 | unsigned int old = md->prev; | 72 | unsigned int old = md->prev; |
72 | unsigned char *data = md->base + page_size; | 73 | unsigned char *data = md->base + page_size; |
@@ -102,8 +103,7 @@ static int record__mmap_read(struct record *rec, struct perf_mmap *md) | |||
102 | } | 103 | } |
103 | 104 | ||
104 | md->prev = old; | 105 | md->prev = old; |
105 | perf_mmap__write_tail(md, old); | 106 | perf_evlist__mmap_consume(rec->evlist, idx); |
106 | |||
107 | out: | 107 | out: |
108 | return rc; | 108 | return rc; |
109 | } | 109 | } |
@@ -245,7 +245,7 @@ static int record__mmap_read_all(struct record *rec) | |||
245 | 245 | ||
246 | for (i = 0; i < rec->evlist->nr_mmaps; i++) { | 246 | for (i = 0; i < rec->evlist->nr_mmaps; i++) { |
247 | if (rec->evlist->mmap[i].base) { | 247 | if (rec->evlist->mmap[i].base) { |
248 | if (record__mmap_read(rec, &rec->evlist->mmap[i]) != 0) { | 248 | if (record__mmap_read(rec, i) != 0) { |
249 | rc = -1; | 249 | rc = -1; |
250 | goto out; | 250 | goto out; |
251 | } | 251 | } |