1/**
2 * @file timer_int.c
3 *
4 * @remark Copyright 2002 OProfile authors
5 * @remark Read the file COPYING
6 *
7 * @author John Levon <levon@movementarian.org>
8 */
9
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>
17
18#include "oprof.h"
19
20static int timer_notify(struct pt_regs *regs)
21{
22 	oprofile_add_sample(regs, 0);
23	return 0;
24}
25
26static int timer_start(void)
27{
28	return register_timer_hook(timer_notify);
29}
30
31
32static void timer_stop(void)
33{
34	unregister_timer_hook(timer_notify);
35}
36
37
38void __init oprofile_timer_init(struct oprofile_operations * ops)
39{
40	ops->create_files = NULL;
41	ops->setup = NULL;
42	ops->shutdown = NULL;
43	ops->start = timer_start;
44	ops->stop = timer_stop;
45	ops->cpu_type = "timer";
46}
47