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>
This commit is contained in:
Peter Zijlstra
2011-06-27 16:47:16 +02:00
committed by Ingo Molnar
parent a8b0ca17b8
commit a7ac67ea02
4 changed files with 23 additions and 28 deletions

View File

@ -98,8 +98,7 @@ out:
}
int perf_output_begin(struct perf_output_handle *handle,
struct perf_event *event, unsigned int size,
int sample)
struct perf_event *event, unsigned int size)
{
struct ring_buffer *rb;
unsigned long tail, offset, head;
@ -124,7 +123,6 @@ int perf_output_begin(struct perf_output_handle *handle,
handle->rb = rb;
handle->event = event;
handle->sample = sample;
if (!rb->nr_pages)
goto out;
@ -192,21 +190,6 @@ void perf_output_copy(struct perf_output_handle *handle,
void perf_output_end(struct perf_output_handle *handle)
{
struct perf_event *event = handle->event;
struct ring_buffer *rb = handle->rb;
if (handle->sample && !event->attr.watermark) {
int wakeup_events = event->attr.wakeup_events;
if (wakeup_events) {
int events = local_inc_return(&rb->events);
if (events >= wakeup_events) {
local_sub(wakeup_events, &rb->events);
local_inc(&rb->wakeup);
}
}
}
perf_output_put_handle(handle);
rcu_read_unlock();
}