This commit is contained in:
Michael Kerrisk 2008-06-24 14:05:49 +00:00
parent 268f000bcf
commit 73858a07dd
1 changed files with 21 additions and 4 deletions

View File

@ -23,7 +23,7 @@
.\" 2008-06-24, mtk: added some details about where jiffies come into
.\" play; added section on high-resolution timers.
.\"
.TH TIME 7 2008-06-24 "Linux" "Linux Programmer's Manual"
.TH TIME 7 2008-06-25 "Linux" "Linux Programmer's Manual"
.SH NAME
time \- overview of time and timers
.SH DESCRIPTION
@ -91,16 +91,33 @@ yielding a jiffies value of, respectively, 0.01, 0.004, or 0.001 seconds.
Since kernel 2.6.20, a further frequency is available:
300, a number that divides evenly for the common video
frame rates (PAL, 25 HZ; NTSC, 30 HZ).
The
.BR times (2)
system call is a special case.
It reports times with a granularity defined by the kernel constant
.IR USER_HZ .
Userspace applications can determine the value of this constant using
.IR sysconf(_SC_CLK_TCK) .
.\" glibc gets this info with a little help from the ELF loader;
.\" see glibc elf/dl-support.c and kernel fs/binfmt_elf.c.
.\"
.SS "High-Resolution Timers"
Before Linux 2.6.16, the accuracy of timer and sleep system calls
Before Linux 2.6.21, the accuracy of timer and sleep system calls
(see below) was also limited by the size of the jiffy.
Since Linux 2.6.16, Linux supports high-resolution timers (HRTs),
optionally configurable since kernel 2.6.21 via CONFIG_HIGH_RES_TIMERS.
Since Linux 2.6.21, Linux supports high-resolution timers (HRTs),
optionally configurable via
.BR CONFIG_HIGH_RES_TIMERS .
On a system that supports HRTs, the accuracy of sleep and timer
system calls is no longer constrained by the jiffy,
but instead can be as accurate as the hardware allows
(microsecond accuracy is typical of modern hardware).
You can determine whether high-resolution timers are supported by
checking the resolution returned by a call to
.BR clock_getres (3)
or looking at the "resolution" entries in
.IR /proc/timer_list .
HRTs are not supported on all hardware architectures.
(Support is provided on x86, arm, and powerpc, among others.)