High Precision Event Timer

From Wikipedia, the free encyclopedia

The High Precision Event Timer (HPET, formerly known as Multimedia Timer[1]) is a hardware timer used in computers.

Older operating systems cannot use HPET, so run only on hardware that has the older timer facilities. Some hardware has both.

Contents

[edit] Features

An HPET block consists of a fixed-rate up-counter and 3 to 32 independent timers, each of which consists of a comparator and a register for storing a trigger value. There can be at most 8 HPET blocks. Each comparator can generate an interrupt when the counter reaches a pre-programmed value.

All timers can be put into one-shot mode and some may also support a periodic mode. In one-shot mode the timer fires an interrupt once when the main counter reaches the value stored in the comparator's register. In the periodic mode the interrupts are generated at specified intervals.

[edit] Applications

The HPET can produce periodic interrupts at a much higher resolution than the RTC and is often used to synchronize multimedia streams, providing smooth playback and reducing the need to use other timestamp calculations such as an x86 CPU's RDTSC instruction.

[edit] Comparison to predecessors

HPET is meant to supplement and replace the 8254 Programmable Interval Timer (PIT) and the Real-time clock's (RTC) periodic interrupt function. Compared to these older timer circuits, the HPET has higher frequency (at least 10 MHz) and wider 64-bit counters (although they can be driven in 32-bit mode).[1]

While 8254 and RTC can, similarly to HPET, be put in one-shot mode, the set-up process is so slow that their one-shot mode is not used in practice for tasks requiring precise scheduling.[2] Instead, 8254 and RTC are typically used in periodic mode with very small time interval. For example, if an application needs to perform several short (some milliseconds, perhaps) waits, it is better to have a periodic timer running constantly with 1 ms period because of the high setup cost of an 8254 or RTC one-shot timer. This causes an interrupt on every millisecond even if the application needs to do actual work less frequently. With HPET, the extra interrupts can be avoided, because the set-up cost of a HPET one-shot timer is considerably smaller.

[edit] Compatibility

Operating systems designed before HPET existed cannot use HPET, so work only on hardware that has other timer facilities. Newer operating systems tend to be able to use either. Some hardware has both.

The following operating systems are known not to be able to use HPET: Windows XP, Windows Server 2003, and earlier Windows versions. Older Linux. Windows XP contains a driver for the HPET, but it is not functional.

The following operating systems are known to be able to use HPET: Windows Vista, Windows 2008, x86 based versions of Mac OS X, Linux 2.6 and FreeBSD.

With a Linux kernel, you need the newer "rtc-cmos" hardware clock device driver rather than the original "rtc" driver.

[edit] See also

[edit] References

  1. ^ a b Intel Corporation, IA-PC HPET (High Precision Event Timers) Specification (revision 1.0a), <http://www.intel.com/hardwaredesign/hpetspec_1.pdf>. Retrieved on 16 July 2007 
  2. ^ Guidelines For Providing Multimedia Timer Support, 2002-09-20, <http://www.microsoft.com/whdc/system/CEC/mm-timer.mspx>. Retrieved on 16 July 2007