Linux 2.6 内核阅读笔记 时间度量
2014-07-27 17:14
423 查看
2014年7月27日 定时器
在80x86体系结构上,内核可能需要和好几种时钟和定时器打交道,大概有:
实时时钟(RTC),时间戳计数器(TSC),可编程间隔定时器(PIT),CPU本地定时器,高精度事件定时器(HPET),ACPI电源管理定时器。
linux内核使用来定时器对象来代表一种定时器,采用函数指针实现类似面向对象的功能。
在80x86体系结构上,内核可能需要和好几种时钟和定时器打交道,大概有:
实时时钟(RTC),时间戳计数器(TSC),可编程间隔定时器(PIT),CPU本地定时器,高精度事件定时器(HPET),ACPI电源管理定时器。
linux内核使用来定时器对象来代表一种定时器,采用函数指针实现类似面向对象的功能。
<span style="font-size:14px;">struct timer_opts { char* name; void (*mark_offset)(void); unsigned long (*get_offset)(void); unsigned long long (*monotonic_clock)(void); void (*delay)(unsigned long); unsigned long (*read_timer)(void); int (*suspend)(pm_message_t state); int (*resume)(void); };</span>linux内核通过编译期宏定义来优先选择最优的定时器来使用,使用一个cur_timer的全局变量来表示系统正在使用的定时器。
<span style="font-size:14px;">static struct init_timer_opts* __initdata timers[] = { #ifdef CONFIG_X86_CYCLONE_TIMER &timer_cyclone_init, #endif #ifdef CONFIG_HPET_TIMER &timer_hpet_init, #endif #ifdef CONFIG_X86_PM_TIMER &timer_pmtmr_init, #endif &timer_tsc_init, &timer_pit_init, NULL, };</span>
相关文章推荐
- Linux 2.6 内核阅读笔记 信号
- Linux 2.6 内核阅读笔记 中断和异常
- Linux 2.6 内核阅读笔记 内存管理
- Linux 2.6 内核阅读笔记 进程
- Linux 2.6 内核阅读笔记 内核同步
- Linux 2.6 内核阅读笔记 中断和异常
- LINUX0.11内核阅读笔记 (2)
- Linux网管笔记(17)阅读Linux的内核源码
- 每日阅读1之内核设计与实现(第三版)4.5——linux调度实现之时间记账
- LINUX0.11内核阅读笔记
- (转载)Linux内核网络设备操作部分阅读笔记收藏
- 【转】深入理解Linux内核--信号(阅读笔记)
- 【转帖LINUX】netfilter中的conntrack内核阅读笔记(5)
- (原创)Linux内核网络设备操作部分阅读笔记
- 【转帖LINUX】netfilter中的conntrack内核阅读笔记(2)
- LINUX0.11内核阅读笔记
- 【转帖LINUX】netfilter中的conntrack内核阅读笔记(4)
- 《Linux 内核完全注释》阅读笔记
- LINUX0.11内核阅读笔记
- LINUX0.11 内核阅读笔记