QueryIdleProcessorCycleTime function (Windows)

Switch View :
ScriptFree
QueryIdleProcessorCycleTime function

Applies to: desktop apps only

Retrieves the cycle time for the idle thread of each processor in the system.

On a system with more than 64 processors, this function retrieves the cycle time for the idle thread of each processor in the processor group to which the calling thread is assigned. Use the QueryIdleProcessorCycleTimeEx function to retrieve the cycle time for the idle thread on each logical processor for a specific processor group.

Syntax

BOOL WINAPI QueryIdleProcessorCycleTime(
  __inout  PULONG BufferLength,
  __out    PULONG64 ProcessorIdleCycleTime
);

Parameters

BufferLength [in, out]

On input, specifies the size of the ProcessorIdleCycleTime buffer, in bytes. This buffer is expected to be 8 times the number of processors in the group.

On output, specifies the number of elements written to the buffer. If the buffer size is not sufficient, the function fails and this parameter receives the required length of the buffer.

ProcessorIdleCycleTime [out]

The number of CPU clock cycles used by each idle thread. This buffer must be 8 times the number of processors in the system in size.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

To compile an application that uses this function, define _WIN32_WINNT as 0x0600 or later.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

Processor Groups
QueryIdleProcessorCycleTimeEx
QueryProcessCycleTime
QueryThreadCycleTime

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Community Content

hopperplus
BufferLength
BufferLength does not return the number of elements. It returns the size of the written ProcessorIdleCycleTime field. On a quad-core CPU it returns 32, not 4.