QueryPerformanceFrequency function
Applies to: desktop apps | Metro style apps
Retrieves the frequency of the high-resolution performance counter, if one exists. The frequency cannot change while the system is running.
Syntax
BOOL WINAPI QueryPerformanceFrequency( __out LARGE_INTEGER *lpFrequency );
Parameters
- lpFrequency [out]
-
Type: LARGE_INTEGER*
A pointer to a variable that receives the current performance-counter frequency, in counts per second. If the installed hardware does not support a high-resolution performance counter, this parameter can be zero.
Return value
Type:
Type: BOOL
If the installed hardware supports a high-resolution performance counter, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. For example, if the installed hardware does not support a high-resolution performance counter, the function fails.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Reference
- QueryPerformanceCounter
- Conceptual
- Timers
Send comments about this topic to Microsoft
Build date: 3/6/2012
- 2/28/2012
- david-at-work
- 1/7/2012
- Heeroyui1777
I myself (on an Intel Celeron Mobile based machine) have noted on occasion that the CPU frequency reported in tools such as CPU-Z is different to the frequency reported by this function call. This is especially true when using Intel Speed Step, or when the BIOS has been set to use CPUTHRM settings to throttle down the CPU when overheating.
In these latter occasions is common to see a higher return from "QueryPerformanceFrequency" than one can see reported by the CPU. Skewing any timing performed in a high performance loop.
- 8/9/2011
- Xelous
- 9/1/2011
- Thomas Lee
arabcoder
- 4/19/2011
- arabcoder
- 9/1/2011
- Thomas Lee
[DllImport("kernel32.dll", SetLastError=true)]
public static extern bool QueryPerformanceFrequency(out long lpFrequency);
- 4/26/2009
- dmex