RtQueryPerformanceFrequency

RtQueryPerformanceFrequency retrieves the frequency of the high-resolution performance counter (based on the processor’s time-stamp counter, TSC). The frequency cannot change while the system is running.

Syntax

Copy
BOOL RtQueryPerformanceFrequency(
    [out]   LARGE_INTEGER* lpFrequency);

Parameters

[out] lpFrequency

Pointer to a variable that receives the performance-counter frequency, in counts per second.

Return Value

If the function succeeds, it returns a non-zero value. If the function fails, it returns zero. Call GetLastError to obtain an error code.

Remarks

In a Windows process, RtQueryPerformanceFrequency call may return different frequency than the QueryPerformanceFrequency call. This is because QueryPerformanceFrequency may be based on HPET. For consistency, use the frequency returned by RtQueryPerformanceFrequency when converting the counters returned from RtQueryPerformanceCounter to time. Use the frequency returned by QueryPerformanceFrequency when converting the counters returned from QueryPerformanceCounter to time.

In a RTSS process, QueryPerformanceFrequency is the same as RtQueryPerformanceFrequency. QueryPerformanceCounter is the same as RtQueryPerformanceCounter.

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

RtApi.h

RtApi.lib (Windows), Startup.lib (RTSS)

See Also: