timer_int.c

来自「Linux Kernel 2.6.9 for OMAP1710」· C语言 代码 · 共 58 行

C
58
字号
/** * @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 notifier_block * self, unsigned long val, void * data){	struct pt_regs * regs = (struct pt_regs *)data;	int cpu = smp_processor_id();	unsigned long eip = profile_pc(regs); 	oprofile_add_sample(eip, !user_mode(regs), 0, cpu);	return 0;}  static struct notifier_block timer_notifier = {	.notifier_call	= timer_notify,}; static int timer_start(void){	return register_profile_notifier(&timer_notifier);}static void timer_stop(void){	unregister_profile_notifier(&timer_notifier);}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");}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?