[BACK]Return to timer_int.c CVS log [TXT][DIR] Up to [Development] / linux-2.6-xfs / drivers / oprofile

File: [Development] / linux-2.6-xfs / drivers / oprofile / timer_int.c (download)

Revision 1.4, Wed Jan 5 14:17:31 2005 UTC (12 years, 9 months ago) by nathans.longdrop.melbourne.sgi.com
Branch: MAIN
Changes since 1.3: +3 -10 lines

Merge up to 2.6.10.
Merge of 2.6.x-xfs-melb:linux:21010a by kenmcd.

/**
 * @file timer_int.c
 *
 * @remark Copyright 2002 OProfile authors
 * @remark Read the file COPYING
 *
 * @author John Levon <levon@movementarian.org>
 */

#include <linux/kernel.h>
#include <linux/notifier.h>
#include <linux/smp.h>
#include <linux/oprofile.h>
#include <linux/profile.h>
#include <linux/init.h>
#include <asm/ptrace.h>
 
static int timer_notify(struct pt_regs *regs)
{
	int cpu = smp_processor_id();
	unsigned long eip = profile_pc(regs);
 
	oprofile_add_sample(eip, !user_mode(regs), 0, cpu);
	return 0;
}

static int timer_start(void)
{
	return register_timer_hook(timer_notify);
}


static void timer_stop(void)
{
	unregister_timer_hook(timer_notify);
}


static struct oprofile_operations timer_ops = {
	.start	= timer_start,
	.stop	= timer_stop,
	.cpu_type = "timer"
};

 
void __init timer_init(struct oprofile_operations ** ops)
{
	*ops = &timer_ops;
	printk(KERN_INFO "oprofile: using timer interrupt.\n");
}