2 * @file nmi_timer_int.c
4 * @remark Copyright 2003 OProfile authors
5 * @remark Read the file COPYING
7 * @author Zwane Mwaikambo <zwane@linuxpower.ca>
10 #include <linux/init.h>
11 #include <linux/smp.h>
12 #include <linux/irq.h>
13 #include <linux/oprofile.h>
14 #include <linux/rcupdate.h>
19 #include <asm/ptrace.h>
21 static int nmi_timer_callback(struct pt_regs * regs, int cpu)
23 unsigned long eip = instruction_pointer(regs);
25 oprofile_add_sample(eip, !user_mode(regs), 0, cpu);
29 static int timer_start(void)
31 disable_timer_nmi_watchdog();
32 set_nmi_callback(nmi_timer_callback);
37 static void timer_stop(void)
39 enable_timer_nmi_watchdog();
45 static struct oprofile_operations nmi_timer_ops = {
51 int __init nmi_timer_init(struct oprofile_operations ** ops)
53 extern int nmi_active;
58 *ops = &nmi_timer_ops;
59 printk(KERN_INFO "oprofile: using NMI timer interrupt.\n");