KeQueryPerformanceCounter function (wdm.h)

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

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

Syntax

NTHALAPI LARGE_INTEGER KeQueryPerformanceCounter(
  [out, optional] PLARGE_INTEGER PerformanceFrequency
);

Parameters

[out, optional] 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

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.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