4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
7 * @author John Levon <levon@movementarian.org>
10 #ifndef OPROFILE_CPU_BUFFER_H
11 #define OPROFILE_CPU_BUFFER_H
13 #include <linux/types.h>
14 #include <linux/spinlock.h>
15 #include <linux/cache.h>
19 /* allocate a sample buffer for each CPU */
20 int alloc_cpu_buffers(void);
22 void free_cpu_buffers(void);
24 /* CPU buffer is composed of such entries (which are
25 * also used for context switch notes)
32 struct oprofile_cpu_buffer
{
33 volatile unsigned long head_pos
;
34 volatile unsigned long tail_pos
;
35 unsigned long buffer_size
;
36 struct task_struct
* last_task
;
38 struct op_sample
* buffer
;
39 unsigned long sample_received
;
40 unsigned long sample_lost_overflow
;
41 unsigned long sample_lost_task_exit
;
42 } ____cacheline_aligned
;
44 extern struct oprofile_cpu_buffer cpu_buffer
[];
46 void cpu_buffer_reset(struct oprofile_cpu_buffer
*cpu_buf
);
48 #endif /* OPROFILE_CPU_BUFFER_H */