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/workqueue.h>
16 #include <linux/cache.h>
17 #include <linux/sched.h>
18 #include <linux/ring_buffer.h>
22 int alloc_cpu_buffers(void);
23 void free_cpu_buffers(void);
25 void start_cpu_work(void);
26 void end_cpu_work(void);
28 /* CPU buffer is composed of such entries (which are
29 * also used for context switch notes)
37 struct ring_buffer_event
*event
;
38 struct op_sample
*sample
;
39 unsigned long irq_flags
;
42 struct oprofile_cpu_buffer
{
43 unsigned long buffer_size
;
44 struct task_struct
*last_task
;
47 unsigned long sample_received
;
48 unsigned long sample_lost_overflow
;
49 unsigned long backtrace_aborted
;
50 unsigned long sample_invalid_eip
;
52 struct delayed_work work
;
55 DECLARE_PER_CPU(struct oprofile_cpu_buffer
, cpu_buffer
);
58 * Resets the cpu buffer to a sane state.
60 * reset these to invalid values; the next sample collected will
61 * populate the buffer with proper values to initialize the buffer
63 static inline void op_cpu_buffer_reset(int cpu
)
65 struct oprofile_cpu_buffer
*cpu_buf
= &per_cpu(cpu_buffer
, cpu
);
67 cpu_buf
->last_is_kernel
= -1;
68 cpu_buf
->last_task
= NULL
;
71 int op_cpu_buffer_write_entry(struct op_entry
*entry
);
72 int op_cpu_buffer_write_commit(struct op_entry
*entry
);
73 struct op_sample
*op_cpu_buffer_read_entry(int cpu
);
74 unsigned long op_cpu_buffer_entries(int cpu
);
76 /* transient events for the CPU buffer -> event buffer */
77 #define CPU_IS_KERNEL 1
78 #define CPU_TRACE_BEGIN 2
79 #define IBS_FETCH_BEGIN 3
80 #define IBS_OP_BEGIN 4
82 #endif /* OPROFILE_CPU_BUFFER_H */
This page took 0.056153 seconds and 5 git commands to generate.