⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer_int.c

📁 这个linux源代码是很全面的~基本完整了~使用c编译的~由于时间问题我没有亲自测试~但就算用来做参考资料也是非常好的
💻 C
字号:
/** * @file timer_int.c * * @remark Copyright 2002 OProfile authors * @remark Read the file COPYING * * @author John Levon <levon@movementarian.org> */#include <linux/config.h>#include <linux/sched.h>#include <linux/kernel.h>#include <linux/notifier.h>#include <linux/irq.h>#include <linux/oprofile.h>#include <asm/ptrace.h> #include "op_counter.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(); 	oprofile_add_sample(regs->rip, 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}; void __init timer_init(struct oprofile_operations ** ops, enum oprofile_cpu * cpu){	*ops = &timer_ops;	*cpu = OPROFILE_CPU_TIMER;	printk(KERN_INFO "oprofile: using timer interrupt.\n");}

⌨️ 快捷键说明

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