4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
7 * @author John Levon <levon@movementarian.org>
10 #include <linux/kernel.h>
11 #include <linux/oprofile.h>
12 #include <linux/errno.h>
13 #include <linux/init.h>
16 #include <linux/notifier.h>
17 #include <linux/rcupdate.h>
18 #include <linux/kdebug.h>
21 static int profile_timer_exceptions_notify(struct notifier_block *self,
22 unsigned long val, void *data)
24 struct die_args *args = (struct die_args *)data;
25 int ret = NOTIFY_DONE;
29 oprofile_add_sample(args->regs, 0);
38 static struct notifier_block profile_timer_exceptions_nb = {
39 .notifier_call = profile_timer_exceptions_notify,
42 static int timer_start(void)
44 if (register_die_notifier(&profile_timer_exceptions_nb))
51 static void timer_stop(void)
54 unregister_die_notifier(&profile_timer_exceptions_nb);
55 synchronize_sched(); /* Allow already-started NMIs to complete. */
58 static int op_nmi_timer_init(struct oprofile_operations *ops)
63 ops->start = timer_start;
64 ops->stop = timer_stop;
65 ops->cpu_type = "timer";
66 printk(KERN_INFO "oprofile: Using perfctr NMI timer interrupt.\n");
71 int __init oprofile_arch_init(struct oprofile_operations *ops)
76 ret = op_nmi_timer_init(ops);
84 void oprofile_arch_exit(void)