NdisGetCurrentProcessorCounts function (ndis.h)
The NdisGetCurrentProcessorCounts function returns counts for the current processor that a driver can use to determine CPU usage for a particular time interval.
Syntax
void NdisGetCurrentProcessorCounts(
[out] PULONG pIdleCount,
[out] PULONG pKernelAndUser,
[out] PULONG pIndex
);
Parameters
[out] pIdleCount
A pointer to a caller-supplied variable in which this function returns the cumulative idle time for the processor since the system was booted.
[out] pKernelAndUser
A pointer to a caller-supplied variable in which this function returns the cumulative processing time (kernel-mode time plus user-mode time) for the processor since the system was booted.
[out] pIndex
A pointer to a caller-supplied variable in which this function returns a zero-based index that identifies the processor within the computer.
Return value
None
Remarks
NdisGetCurrentProcessorCounts returns idle and CPU-usage counts that the caller can use to determine CPU usage for the current processor. The CPU utilization value indicates how loaded the CPU was since the immediately preceding call to this function. If the CPU was heavily loaded, such a driver can change how it handles certain operations to improve driver performance.
CpuUsage = 100-100*(Idle - Idle[n])/(KernelAndUser - KernelAndUser[n]);
where:
- CpuUsage is CPU usage as a percentage of the total interval time
- Idle is the IdleCount value returned by the most recent call to NdisGetCurrentProcessorCounts
- Idle[n] is an IdleCount value returned by a previous call, stored as the nth element in an array
- KernelandUser is the KernelAndUser value returned by the most recent call to NdisGetCurrentProcessorCounts
- KernelandUser[n] is the KernelandUser value returned by a previous call, stored as the nth element in an array
Requirements
Requirement | Value |
---|---|
Minimum supported client | Supported for NDIS 6.0 and later drivers in Windows Vista and later. Supported for NDIS 5.1 drivers (see NdisGetCurrentProcessorCounts (NDIS 5.1)) in Windows XP and later. |
Target Platform | Universal |
Header | ndis.h (include Ndis.h) |
Library | Ndis.lib |
IRQL | <= DISPATCH_LEVEL |
DDI compliance rules | Irql_Miscellaneous_Function(ndis) |