22 #include <linux/sched.h>
24 #include <linux/errno.h>
31 #define OP_BUFFER_FLAGS 0
38 #define DEFAULT_TIMER_EXPIRE (HZ / 10)
39 static int work_enabled;
57 op_ring_buffer =
NULL;
60 #define RB_EVENT_HDR_SIZE 4
67 unsigned long byte_size = buffer_size * (
sizeof(
struct op_sample) +
145 (op_ring_buffer,
sizeof(
struct op_sample) +
146 size *
sizeof(entry->
sample->data[0]));
171 / sizeof(entry->sample->data[0]);
173 return entry->sample;
196 is_kernel = !!is_kernel;
227 op_cpu_buffer_add_data(&
entry, (
unsigned long)task);
236 unsigned long pc,
unsigned long event)
261 unsigned long backtrace,
int is_kernel,
unsigned long event,
272 if (op_add_code(cpu_buf, backtrace, is_kernel, tsk))
275 if (op_add_sample(cpu_buf, pc, event))
296 __oprofile_add_ext_sample(
unsigned long pc,
struct pt_regs *
const regs,
297 unsigned long event,
int is_kernel,
307 if (!log_sample(cpu_buf, pc, backtrace, is_kernel, event, task))
314 oprofile_begin_trace(cpu_buf);
316 oprofile_end_trace(cpu_buf);
320 unsigned long event,
int is_kernel,
323 __oprofile_add_ext_sample(pc, regs, event, is_kernel, task);
327 unsigned long event,
int is_kernel)
329 __oprofile_add_ext_sample(pc, regs, event, is_kernel,
NULL);
345 __oprofile_add_ext_sample(pc, regs, event, is_kernel,
NULL);
356 unsigned long pc,
int code,
int size)
365 if (op_add_code(cpu_buf, 0, is_kernel,
current))
374 op_cpu_buffer_add_data(entry, code);
375 op_cpu_buffer_add_data(entry, pc);
388 return op_cpu_buffer_add_data(entry, val);
395 if (op_cpu_buffer_get_size(entry) < 2)
401 if (!op_cpu_buffer_add_data(entry, (
u32)val))
403 return op_cpu_buffer_add_data(entry, (
u32)(val >> 32));
416 log_sample(cpu_buf, pc, 0, is_kernel, event,
NULL);
433 if (op_add_sample(cpu_buf, pc, 0))