Enable/Disable high resolution timers on Linux
The objective of the high resolution timers project is to implement the POSIX 1003.1b Section 14 (Clocks and Timers) API in Linux. This includes support for high resolution timers - that is, timers with accuracy better than 1
Currently, timers in a few Linux distribution are only supported at a resolution of 1
jiffy. The length of a
jiffy is dependent on the value of
HZ in the Linux kernel.
# grep CONFIG_HZ /boot/config-$(uname -r) # CONFIG_HZ_PERIODIC is not set CONFIG_HZ_250=y CONFIG_HZ=250
Higher resolution timers are needed to config and allow the system to wake up and process data at more accurate intervals.
Check timer and highres config
highres is enabled, the following output should be seen, and the minimal time resolution is around 1 nano second.
cat /proc/cmdline |grep highres # cat /proc/timer_list |grep handler event_handler: tick_handle_oneshot_broadcast event_handler: hrtimer_interrupt # cat /proc/timer_list |grep resolution |uniq .resolution: 1 nsecs
highres is forbidden, might get the following, and the minimal time resolution is around milliseconds.
# cat /proc/cmdline |grep highres highres=off # cat /proc/timer_list |grep handler event_handler: tick_handle_oneshot_broadcast event_handler: tick_nohz_handler # cat /proc/timer_list |grep resolution |uniq .resolution: 4000000 nsecs
Enable highres on kernel config
add the following line into grub config,
and update grub, then reboot
Back to Table of Contents
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.com, replace # with @
- Not all the commands and scripts are tested in production environment, use at your own risk
- No personal information is collected.