NdisGetCurrentProcessorCpuUsage

VOID
NdisGetCurrentProcessorCpuUsage(
PULONG pCpuUsage
);

NdisGetCurrentProcessorCpuUsage returns how busy the current processor is as a percentage.

Parameters

pCpuUsage

Points to a caller-supplied variable in which this function returns the percentage of CPU, on which the caller is running, that is currently in use.

Comments

NDIS drivers can call NdisGetCurrentProcessorCpuUsage to determine how loaded the CPU on which they are running is so they can change how they handle certain operations to improve driver performance.

For example, a NIC driver might call this function periodically and, as its percentage of CPU usage trends higher, disable interrupts on the NIC and switch to polling the state of the NIC. This strategy yields higher performance during periods of high network traffic by eliminating interrupt-processing overhead while the NIC is generating many interrupts. Instead, the driver's polling MiniportTimer function makes indications and completes sends until network traffic declines again. When its periodic calls to NdisGetCurrentProcessorCpuUsage indicate CPU usage is trending lower again, such a driver would re-enable interrupts on the NIC and cancel its polling MiniportTimer function.

Callers of NdisGetCurrentProcessorCpuUsage can run at any IRQL.

See Also

MiniportDisableInterrupt, MiniportHandleInterrupt, MiniportISR, MiniportTimer, NdisMCancelTimer, NdisMSetPeriodicTimer