Timers and time management in the Linux kernel. Part 6
这篇文章 Timers and time management in the Linux kernel. Part 6. 是出自 linux-insides一书中 Timers and time management 章节 内核版本比对5.7-rc1 进行了相关调整, 增加相关备注 Linux内核中的定时器和时间管理.Part 6. x86_64 相关的时钟源 这是chapter的第六部分,它描述了Linux内核中与计时器和时间管理相关的内容。 在之前的part中,我们看到了clockevents框架,现在我们将继续深入探讨与时间管理相关的问题 Linux内核中的内容。 本部分将描述与时钟源相关的x86架构的实现(有关[clocksource]概念的更多信息,您可以在second part 中找到相关信息. 首先,我们必须知道在x86体系结构中可以使用哪些时钟源。 从 sysfs 或者从下面的文件 /sys/devices/system/clocksource/clocksource0/available_clocksource. /sys/devices/system/clocksource/clocksourceN来获取相关信息: available_clocksource - 提供系统可用是时钟源 current_clocksource - 提供系统当前使用时钟源 实际看一下: $ cat /sys/devices/system/clocksource/clocksource0/available_clocksource tsc hpet acpi_pm 我们可以看到有三个注册的时钟源在这个系统里: tsc - Time Stamp Counter; hpet - High Precision Event Timer; acpi_pm - ACPI Power Management Timer. 现在让我们看看第二个文件,它提供了最佳时钟源(在系统中具有最佳评级的时钟源) $ cat /sys/devices/system/clocksource/clocksource0/current_clocksource tsc tsc是Time Stamp Counter的简写. second part有过描述, 他描述了Linux Kernel的clocksource框架, 系统最好的时钟源应当是最有最好或最高功率,频率的, 或者说是具有最高frequency. ...