Skip to content

Commit

Permalink
perf: Split up buffer handling from core code
Browse files Browse the repository at this point in the history
And create the internal perf events header.

v2: Keep an internal inlined perf_output_copy()

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Stephane Eranian <eranian@google.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1305827704-5607-1-git-send-email-fweisbec@gmail.com
[ v3: use clearer 'ring_buffer' and 'rb' naming ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Jun 9, 2011
1 parent b58f6b0 commit 7636913
Show file tree
Hide file tree
Showing 5 changed files with 572 additions and 527 deletions.
33 changes: 4 additions & 29 deletions include/linux/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -680,33 +680,6 @@ enum perf_event_active_state {
};

struct file;

#define PERF_BUFFER_WRITABLE 0x01

struct perf_buffer {
atomic_t refcount;
struct rcu_head rcu_head;
#ifdef CONFIG_PERF_USE_VMALLOC
struct work_struct work;
int page_order; /* allocation order */
#endif
int nr_pages; /* nr of data pages */
int writable; /* are we writable */

atomic_t poll; /* POLL_ for wakeups */

local_t head; /* write position */
local_t nest; /* nested writers */
local_t events; /* event limit */
local_t wakeup; /* wakeup stamp */
local_t lost; /* nr records lost */

long watermark; /* wakeup watermark */

struct perf_event_mmap_page *user_page;
void *data_pages[0];
};

struct perf_sample_data;

typedef void (*perf_overflow_handler_t)(struct perf_event *, int,
Expand Down Expand Up @@ -745,6 +718,8 @@ struct perf_cgroup {
};
#endif

struct ring_buffer;

/**
* struct perf_event - performance event kernel representation:
*/
Expand Down Expand Up @@ -834,7 +809,7 @@ struct perf_event {
atomic_t mmap_count;
int mmap_locked;
struct user_struct *mmap_user;
struct perf_buffer *buffer;
struct ring_buffer *rb;

/* poll related */
wait_queue_head_t waitq;
Expand Down Expand Up @@ -945,7 +920,7 @@ struct perf_cpu_context {

struct perf_output_handle {
struct perf_event *event;
struct perf_buffer *buffer;
struct ring_buffer *rb;
unsigned long wakeup;
unsigned long size;
void *addr;
Expand Down
2 changes: 1 addition & 1 deletion kernel/events/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ ifdef CONFIG_FUNCTION_TRACER
CFLAGS_REMOVE_core.o = -pg
endif

obj-y := core.o
obj-y := core.o ring_buffer.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
Loading

0 comments on commit 7636913

Please sign in to comment.