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/notifier.h>
12 #include <linux/smp.h>
13 #include <linux/oprofile.h>
14 #include <linux/profile.h>
15 #include <linux/init.h>
16 #include <asm/ptrace.h>
18 static int timer_notify(struct pt_regs *regs)
20 int cpu = smp_processor_id();
21 unsigned long eip = profile_pc(regs);
23 oprofile_add_sample(eip, !user_mode(regs), 0, cpu);
27 static int timer_start(void)
29 return register_timer_hook(timer_notify);
33 static void timer_stop(void)
35 unregister_timer_hook(timer_notify);
39 static struct oprofile_operations timer_ops = {
46 void __init timer_init(struct oprofile_operations ** ops)
49 printk(KERN_INFO "oprofile: using timer interrupt.\n");