unsigned long size;
void *addr;
int page;
- int sample;
};
#ifdef CONFIG_PERF_EVENTS
#endif
extern 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);
extern void perf_output_end(struct perf_output_handle *handle);
extern void perf_output_copy(struct perf_output_handle *handle,
const void *buf, unsigned int len);
perf_output_put(handle, raw);
}
}
+
+ if (!event->attr.watermark) {
+ int wakeup_events = event->attr.wakeup_events;
+
+ if (wakeup_events) {
+ struct ring_buffer *rb = handle->rb;
+ int events = local_inc_return(&rb->events);
+
+ if (events >= wakeup_events) {
+ local_sub(wakeup_events, &rb->events);
+ local_inc(&rb->wakeup);
+ }
+ }
+ }
}
void perf_prepare_sample(struct perf_event_header *header,
perf_prepare_sample(&header, data, event, regs);
- if (perf_output_begin(&handle, event, header.size, 1))
+ if (perf_output_begin(&handle, event, header.size))
goto exit;
perf_output_sample(&handle, &header, data, event);
int ret;
perf_event_header__init_id(&read_event.header, &sample, event);
- ret = perf_output_begin(&handle, event, read_event.header.size, 0);
+ ret = perf_output_begin(&handle, event, read_event.header.size);
if (ret)
return;
perf_event_header__init_id(&task_event->event_id.header, &sample, event);
ret = perf_output_begin(&handle, event,
- task_event->event_id.header.size, 0);
+ task_event->event_id.header.size);
if (ret)
goto out;
perf_event_header__init_id(&comm_event->event_id.header, &sample, event);
ret = perf_output_begin(&handle, event,
- comm_event->event_id.header.size, 0);
+ comm_event->event_id.header.size);
if (ret)
goto out;
perf_event_header__init_id(&mmap_event->event_id.header, &sample, event);
ret = perf_output_begin(&handle, event,
- mmap_event->event_id.header.size, 0);
+ mmap_event->event_id.header.size);
if (ret)
goto out;
perf_event_header__init_id(&throttle_event.header, &sample, event);
ret = perf_output_begin(&handle, event,
- throttle_event.header.size, 0);
+ throttle_event.header.size);
if (ret)
return;
}
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;
handle->rb = rb;
handle->event = event;
- handle->sample = sample;
if (!rb->nr_pages)
goto out;
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();
}