oprofile: remove ring buffer inline functions in cpu_buffer.h
[deliverable/linux.git] / drivers / oprofile / cpu_buffer.h
CommitLineData
1da177e4
LT
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/workqueue.h>
16#include <linux/cache.h>
608dfddd 17#include <linux/sched.h>
6dad828b 18#include <linux/ring_buffer.h>
6a18037d 19
1da177e4 20struct task_struct;
6a18037d 21
1da177e4
LT
22int alloc_cpu_buffers(void);
23void free_cpu_buffers(void);
24
25void start_cpu_work(void);
26void end_cpu_work(void);
27
28/* CPU buffer is composed of such entries (which are
29 * also used for context switch notes)
30 */
31struct op_sample {
32 unsigned long eip;
33 unsigned long event;
34};
6a18037d 35
6dad828b
RR
36struct op_entry {
37 struct ring_buffer_event *event;
38 struct op_sample *sample;
39 unsigned long irq_flags;
40};
41
1da177e4
LT
42struct oprofile_cpu_buffer {
43 volatile unsigned long head_pos;
44 volatile unsigned long tail_pos;
45 unsigned long buffer_size;
25ad2913 46 struct task_struct *last_task;
1da177e4
LT
47 int last_is_kernel;
48 int tracing;
1da177e4
LT
49 unsigned long sample_received;
50 unsigned long sample_lost_overflow;
51 unsigned long backtrace_aborted;
df9d177a 52 unsigned long sample_invalid_eip;
1da177e4 53 int cpu;
c4028958 54 struct delayed_work work;
8b8b4988 55};
1da177e4 56
608dfddd 57DECLARE_PER_CPU(struct oprofile_cpu_buffer, cpu_buffer);
1da177e4 58
fbc9bf9f
RR
59/*
60 * Resets the cpu buffer to a sane state.
61 *
62 * reset these to invalid values; the next sample collected will
63 * populate the buffer with proper values to initialize the buffer
64 */
6d2c53f3 65static inline void op_cpu_buffer_reset(int cpu)
fbc9bf9f
RR
66{
67 struct oprofile_cpu_buffer *cpu_buf = &per_cpu(cpu_buffer, cpu);
68
69 cpu_buf->last_is_kernel = -1;
70 cpu_buf->last_task = NULL;
71}
1da177e4 72
9966718d
RR
73int op_cpu_buffer_write_entry(struct op_entry *entry);
74int op_cpu_buffer_write_commit(struct op_entry *entry);
75struct op_sample *op_cpu_buffer_read_entry(int cpu);
76unsigned long op_cpu_buffer_entries(int cpu);
bf589e32 77
1da177e4
LT
78/* transient events for the CPU buffer -> event buffer */
79#define CPU_IS_KERNEL 1
80#define CPU_TRACE_BEGIN 2
345c2573
BK
81#define IBS_FETCH_BEGIN 3
82#define IBS_OP_BEGIN 4
1da177e4
LT
83
84#endif /* OPROFILE_CPU_BUFFER_H */
This page took 0.367099 seconds and 5 git commands to generate.