Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Interrupt Time

Interrupt time is the amount of time since the system was last started, in 100-nanosecond intervals. The interrupt-time count begins at zero when the system starts and is incremented at each clock interrupt by the length of a clock tick. The exact length of a clock tick depends on underlying hardware and can vary between systems.

Unlike system time, the interrupt-time count is not subject to adjustments by users or the Windows time service, making it a better choice for measuring short durations. Applications that require greater precision than the interrupt-time count should use a high-resolution timer. Use the QueryPerformanceFrequency function to retrieve the frequency of the high-resolution timer and the QueryPerformanceCounter function to retrieve the counter's value.

The QueryInterruptTime, QueryInterruptTimePrecise, QueryUnbiasedInterruptTime, and QueryUnbiasedInterruptTimePrecise functions can be used to retrieve the interrupt-time count. Unbiased interrupt-time means that only time that the system is in the working state is counted—therefore, the interrupt-time count is not "biased" by time the system spends in sleep or hibernation.

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP/2000:  The QueryUnbiasedInterruptTime function is available starting with Windows 7 and Windows Server 2008 R2.

The timer resolution set by the timeBeginPeriod and timeEndPeriod functions affects the resolution of the QueryInterruptTime and QueryUnbiasedInterruptTime functions. However, increasing the timer resolution is not recommended because it can reduce overall system performance and increase power consumption by preventing the processor from entering power-saving states. Instead, applications should use a high-resolution timer.

Note  The QueryInterruptTime, QueryInterruptTimePrecise, QueryUnbiasedInterruptTime, and QueryUnbiasedInterruptTimePrecise functions produces different results on debug ("checked") builds of Windows, because the interrupt-time count and tick count are advanced by approximately 49 days. This helps to identify bugs that might not occur until the system has been running for a long time. The checked build is available to MSDN subscribers through the Microsoft Developer Network (MSDN) Web site.

To retrieve elapsed time that accounts for sleep or hibernation, use the GetTickCount or GetTickCount64 function, or use the System Up Time performance counter. This performance counter can be retrieved from the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8-byte value. For more information, see Performance Counters.



Community Additions

© 2015 Microsoft