QueryPerformanceCounter

QueryPerformanceCounter retrieves the current value of the high-resolution performance counter.

Syntax

BOOL QueryPerformanceCounter(
    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

Use QueryPerformanceCounter 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.

Requirements

Minimum Supported Version RTX64 2013
Header windows.h
Library Rtx_Rtss.lib

In Windows applications, this function is available by including rtapi.h and linking to rtapi.lib.

See Also:

QueryPerformanceFrequency