diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-28 11:49:19 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-29 13:23:58 -0500 |
commit | dc82009aac6ee6e423b48de43a251745c62ab012 (patch) | |
tree | 0f3a37aa7340a173f822e60e77e8c8bd5d520a7d | |
parent | 54489c189b1a0c10eaf21c6d2c5916b50442c871 (diff) |
perf record: No need to check for overwrites
As we open the mmap with (PROT_READ | PROT_WRITE), signalling the kernel
with perf_mmap__write_tail() when consuming data, so the kernel will not
overwrite.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-record.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index d7886307f6f4..caf927978d92 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -115,27 +115,11 @@ static void mmap_read(struct perf_mmap *md) | |||
115 | unsigned char *data = md->base + page_size; | 115 | unsigned char *data = md->base + page_size; |
116 | unsigned long size; | 116 | unsigned long size; |
117 | void *buf; | 117 | void *buf; |
118 | int diff; | ||
119 | 118 | ||
120 | /* | 119 | if (old == head) |
121 | * If we're further behind than half the buffer, there's a chance | 120 | return; |
122 | * the writer will bite our tail and mess up the samples under us. | ||
123 | * | ||
124 | * If we somehow ended up ahead of the head, we got messed up. | ||
125 | * | ||
126 | * In either case, truncate and restart at head. | ||
127 | */ | ||
128 | diff = head - old; | ||
129 | if (diff < 0) { | ||
130 | fprintf(stderr, "WARNING: failed to keep up with mmap data\n"); | ||
131 | /* | ||
132 | * head points to a known good entry, start there. | ||
133 | */ | ||
134 | old = head; | ||
135 | } | ||
136 | 121 | ||
137 | if (old != head) | 122 | samples++; |
138 | samples++; | ||
139 | 123 | ||
140 | size = head - old; | 124 | size = head - old; |
141 | 125 | ||