KeQueryPerformanceCounter function

The KeQueryPerformanceCounter routine retrieves the current value and frequency of the performance counter.

Use KeQueryPerformanceCounter to acquire high resolution (<1us) time stamps for time interval measurements.

Syntax

NTHALAPI LARGE_INTEGER KeQueryPerformanceCounter(
  PLARGE_INTEGER PerformanceFrequency
);

Parameters

PerformanceFrequency

A pointer to a variable to which KeQueryPerformanceCounter writes the performance counter frequency, in ticks per second. This parameter is optional and can be NULL if the caller does not need the counter frequency value.

Return Value

KeQueryPerformanceCounter returns the performance counter value in units of ticks.

Remarks

KeQueryPerformanceCounter returns a 64-bit integer that represents the current value of a high-resolution monotonically nondecreasing counter.

To obtain the frequency of the performance counter, specify a non-NULL pointer value for the PerformanceFrequency parameter. The frequency of the performance counter is fixed at system boot and is consistent across all processors. Therefore, a driver can cache the frequency of the performance counter during initialization.

For more info about this function and its usage, see Acquiring high-resolution time stamps.

Requirements

   
Windows version Available starting with Windows 2000.
Target Platform Universal
Header ntifs.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library Hal.lib
DLL Hal.dll
IRQL Any level

See Also

KeQueryInterruptTime

KeQuerySystemTime

KeQueryTickCount

KeQueryTimeIncrement

QueryPerformanceCounter

QueryPerformanceFrequency