ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / oprofile / cpu_buffer.h
1 /**
2  * @file cpu_buffer.h
3  *
4  * @remark Copyright 2002 OProfile authors
5  * @remark Read the file COPYING
6  *
7  * @author John Levon <levon@movementarian.org>
8  */
9
10 #ifndef OPROFILE_CPU_BUFFER_H
11 #define OPROFILE_CPU_BUFFER_H
12
13 #include <linux/types.h>
14 #include <linux/spinlock.h>
15 #include <linux/cache.h>
16  
17 struct task_struct;
18  
19 /* allocate a sample buffer for each CPU */
20 int alloc_cpu_buffers(void);
21
22 void free_cpu_buffers(void);
23
24 /* CPU buffer is composed of such entries (which are
25  * also used for context switch notes)
26  */
27 struct op_sample {
28         unsigned long eip;
29         unsigned long event;
30 };
31  
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;
37         int last_is_kernel;
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;
43
44 extern struct oprofile_cpu_buffer cpu_buffer[];
45
46 void cpu_buffer_reset(struct oprofile_cpu_buffer *cpu_buf);
47
48 #endif /* OPROFILE_CPU_BUFFER_H */