Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Saturday, August 16, 2008

Multimedia Timer: HPET

The High Precision Event Timer (HPET) was developed jointly by Intel and Microsoft to meet the timing requirements of multimedia and other time-sensitive applications. Originally, the HPET was called the Multimedia Timer (MM Timer), but the name was later changed to avoid confusion with a Microsoft DirectX timer, and to better describe the timer.
Benefits of the HPET
Experiments on prototype HPET hardware by Microsoft Test Engineers have shown that, in addition to extending the capabilities and precision of a system, the HPET also improved system performance.
In a test that compared the performance of the HPET to that of the PM clock, a function that called the usermode QueryPerformanceCounter() API 1000 times was executed and timed. To ensure the results were comparable, the test was run multiple times on a single system. A similar test was run using the kernel mode KeQueryPerformanceCounter() API on the same hardware to identify the kernel mode benefits of the new timer. Table 1 shows the results of these two experiments.
Table 1   Comparison between HPET and PM Clock Performance

Benchmark1000 consecutive [K]QPC callsPM Clock[calls/ms][µs / call]HPET[calls/ms][µs / call]Perf Increase using the HPET

QueryPerformanceCounter()

6301.59

7841.27

24%

KeQueryPerformanceCounter()

11940.84

19200.59

61%

This data shows that reading the timestamp from the HPET is more efficient and faster than with legacy timers. However, because of the fine level of resolution needed for measurement, the actual performance benefits of the HPET and their implications on applications are impossible to quantify.
Migration to the HPET
The next generation of chipsets will need to support both the HPET and legacy timers. This approach will maintain compatibility with Windows XP and older versions of Windows while enabling the migration to the new timer. Eventually however, chipsets can ship without support for the legacy 8254 timer, PM clock, and APIC timer.
Windows Support of the HPET
Initially, on systems with an HPET, all Windows timer APIs will be ported to the new hardware rather than using the legacy 8254, RTC, APIC, or PM clock. After the HPET is widely available, Windows timer APIs will be extended and the underlying Windows timer code will be enhanced to take advantage of the enhanced capabilities of the HPET.

Glossary

8254 PIT
Programmable Interval Timer, one of the system timers in use today.
Aperiodic timer
A "one-shot" timer that only generates a single interrupt at a specified time. If subsequent interrupts are required after an interrupt is generated, the timer must be reprogrammed.
APIC timer
Advanced Programmable Interrupt Controller timer, one of the system timers in use today.
Clock interrupt
The periodic interrupts, generated by the system timing hardware (typically the 8254 clock), which the OS uses to track time and trigger events. The clock interrupt period can vary over time.
HPET
High Precision Event Timer, the new timer.
Multimedia Timer (MM Timer)
The original name of the HPET. Also a peripheral timer used by graphics packages.
Periodic timer
A timer that generates interrupts at regular, periodic intervals.
Peripheral timer
A proprietary timer that provides some specific, non-essential functionality such as the watchdog timer support used by failover systems.
PM clock
One of the system timers in use today.
Real-time clock (RTC)
One of the system timers in use today.
System timer
A timer that is used by the system to provide fundamental time functionality, such as tracking the time of day and triggering scheduled time-based events.
Timer object
Used by Windows to track requests for a signal at a specific precise time. Timer objects are checked at each clock interrupt to see if the time the object was supposed to expire has passed and schedule a timer DPC to generate a signal or run code for each object that has expired.
Timer tick
An abstract notion used by Windows to consistently track time and thread quantum. The period of a timer tick does not change after boot, while the period of the clock interrupt that physically measures time on the system may change.

No comments: