steve@sle11-sp2:~/Desktop>
cat
/sys/devices/system/clocksource/clocksource0/available_clocksource
tsc hpet acpi_pm
steve@sle11-sp2:~/Desktop>
cat
/sys/devices/system/clocksource/clocksource0/current_clocksource
tsc
设置HPET为当前时钟源
echo 'hpet' >
/sys/devices/system/clocksource/clocksource0/current_clocksource
查看timer信息:
cat /proc/timer_list
Windows 7 使用HPET(需要重启):
bcdedit /set useplatformclock true enable
HPET
bcdedit /deletevalue
useplatformclock disable
查看tsc时钟源类型。《深入理解Linux内核》一书中说HPET时钟源是首选,但是现在的TSC时钟都是constant_tsc和nonstop_tsc类型的,不会受到CPU频率的变化影响精度。而且TSC时钟的高频率和读取速度,使得TSC比起HPET更有优势,所以Linux内核会选择更好的TSC时钟源。
# cat /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8
apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse
sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl
xtopology nonstop_tsc aperfmperf pni
pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr
pdcm dca sse4_1 sse4_2 x2apic popcnt aes xsave avx lahf_lm ida arat
epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept
vpid
TSC 的4种类型:
1. Constant. Constant TSC means that the TSC does not change
with CPU frequency changes, however it does change on C state
transitions.
2. Invariant. As described in the Intel manual: “The invariant TSC
will run at a constant rate in all ACPI P-, C- and T-states”
3. Non-stop. The Non-stop TSC has the properties of both Constant
and Invariant TSC.
4. None of the above. The TSC changes with the C, P and S state
transitions.