Table Of Contents:

#pragma section-numbers off

Description

The objective of the HRT 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 jiffy.

When the project started, the POSIX clocks and timers APIs were not supported by Linux. Over time, the clocks and timers APIs have been adopted, with the only outstanding part being support for high resolution timers within these APIs.

Rationale

Currently, timers in Linux 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, and is 1 millisecond on i386 and some other platforms, and 10 milliseconds on most embedded platforms.

Higher resolution timers are needed to allow the system to wake up and process data at more accurate intervals.

Resources

Projects

hrtimers - Thomas Gleixner's patch

One project to support high resolution timers is Thomas Gleixner's hrtimers.

Thomas gave a presentation at the Ottawa Linux Symposium, July 2006, presenting the current status of hrtimers. The presentation is here: http://www.tglx.de/projects/hrtimers/ols2006-hrtimers.pdf

As of July 2006, "generic clock sources" was accepted into Linus' mainline kernel tree (2.6.18-rc??). This means it should be appear in the mainline 2.6.18 kernel version, when that is available. hrtimers should soon follow, likely appearing in 2.6.19.

In February of 2006, James Perkins of WindRiver wrote:

Note that the current HRT maintainers objected to this characterization.

HRT - Geoge Anzinger's patch

Prior to hrtimers, the main patch which provided high resolution timers was George Anzinger's patch.The official HRT site for this patch is at:

Specifications

Downloads

Patch

Utility programs

How To Use

[not described yet.]

How to validate

There are test programs in a user-space support package.

Sample Results

[Examples of use with measurement of the effects.]

Case Study 1

Case Study 2

Status

Future Work/Action Items

Here is a list of things that could be worked on for this feature:

Old information (for 2.4 kernel)

The High Resolution Timers system allows a user space program to be wake up from a timer event with better accuracy, when using the POSIX timer APIs. Without this system, the best accuracy that can be obtained for timer events is 1 jiffy. This depends on the setting of HZ in the kernel. In the 2.4 kernel, HZ was set to 100, which means that the best accuracy you could get on a timer wakeup in user space was 10 milliseconds.

Put differently, if you asked for a timer event in 500 microseconds, you would wake up in 10 milliseconds (at least).

To support this feature on a particular board, you have to add a kernel driver that uses a timer on the system and supports the interface documented in:

include/linux/hrtime.h (in the CELF tree)

Additional documentation about this feature is available in

Documentation/high-res-timers/

Patches for high-res timers were first presented at the time of kernel version 2.5.47, in November, 2002. See http://lwn.net/Articles/14538/

HighResolutionTimers (last edited 2008-05-07 18:21:55 by localhost)