diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-06-27 10:47:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-07-01 05:06:35 -0400 |
commit | a7ac67ea021b4603095d2aa458bc41641238f22c (patch) | |
tree | e79d13a1096e751061af285265b1862d7e6dca70 /kernel/events/ring_buffer.c | |
parent | a8b0ca17b80e92faab46ee7179ba9e99ccb61233 (diff) |
perf: Remove the perf_output_begin(.sample) argument
Since only samples call perf_output_sample() its much saner (and more
correct) to put the sample logic in there than in the
perf_output_begin()/perf_output_end() pair.
Saves a useless argument, reduces conditionals and shrinks
struct perf_output_handle, win!
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-2crpvsx3cqu67q3zqjbnlpsc@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/events/ring_buffer.c')
-rw-r--r-- | kernel/events/ring_buffer.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 8b3b73630fa4..a2a29205cc0f 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -98,8 +98,7 @@ out: | |||
98 | } | 98 | } |
99 | 99 | ||
100 | int perf_output_begin(struct perf_output_handle *handle, | 100 | int perf_output_begin(struct perf_output_handle *handle, |
101 | struct perf_event *event, unsigned int size, | 101 | struct perf_event *event, unsigned int size) |
102 | int sample) | ||
103 | { | 102 | { |
104 | struct ring_buffer *rb; | 103 | struct ring_buffer *rb; |
105 | unsigned long tail, offset, head; | 104 | unsigned long tail, offset, head; |
@@ -124,7 +123,6 @@ int perf_output_begin(struct perf_output_handle *handle, | |||
124 | 123 | ||
125 | handle->rb = rb; | 124 | handle->rb = rb; |
126 | handle->event = event; | 125 | handle->event = event; |
127 | handle->sample = sample; | ||
128 | 126 | ||
129 | if (!rb->nr_pages) | 127 | if (!rb->nr_pages) |
130 | goto out; | 128 | goto out; |
@@ -192,21 +190,6 @@ void perf_output_copy(struct perf_output_handle *handle, | |||
192 | 190 | ||
193 | void perf_output_end(struct perf_output_handle *handle) | 191 | void perf_output_end(struct perf_output_handle *handle) |
194 | { | 192 | { |
195 | struct perf_event *event = handle->event; | ||
196 | struct ring_buffer *rb = handle->rb; | ||
197 | |||
198 | if (handle->sample && !event->attr.watermark) { | ||
199 | int wakeup_events = event->attr.wakeup_events; | ||
200 | |||
201 | if (wakeup_events) { | ||
202 | int events = local_inc_return(&rb->events); | ||
203 | if (events >= wakeup_events) { | ||
204 | local_sub(wakeup_events, &rb->events); | ||
205 | local_inc(&rb->wakeup); | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | |||
210 | perf_output_put_handle(handle); | 193 | perf_output_put_handle(handle); |
211 | rcu_read_unlock(); | 194 | rcu_read_unlock(); |
212 | } | 195 | } |