RtQueryPerformanceCounter

RtQueryPerformanceCounter retrieves the current value of the high-resolution performance counter (based on the processor’s time-stamp counter, TSC).

Syntax

BOOL RtQueryPerformanceCounter(
    LARGE_INTEGER* lpPerformanceCount
);

Parameters

lpPerformanceCount

Pointer to a variable that receives the current performance-counter value, in counts.

Return Value

A non-zero value if the function succeeds, 0 (zero) if the function fails. To get extended error information, call GetLastError.

Remarks

On a multiprocessor computer, use RtQueryPerformanceCounter rather than RtGetClockTime. Using RtGetClockTime on more than one processor retrieves times that are not accurately aligned with each other, even when the functions are executed simultaneously.

To specify processor affinity for a thread, use the SetThreadAffinityMask function.

In a Win32 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 RTX64 2013 with Service Pack 1
Header Rtapi.h
Library RtApi.lib (Windows), Rtx_Rtss.lib (RTSS)

See Also:

RtQueryPerformanceFrequency