Accurate and Unbiased CPU Utilization Statistics for MP Machines
Original Publication Date: 2000-Jan-01
Included in the Prior Art Database: 2003-Jun-11
Disclosed here is a methodology for extracting accurate and unbiased per CPU utilization data in an SMP (Symmetric Multi-Processing) environment. Typical CPU idle/busy accounting is sample based (as is the case with most UNIX* variants) and is therefore not accurate for measuring small changes in utilization. Another method is to actually measure the amount of idle loop activity. Previous approaches provided an alternate, replacement idle loop which increments an idle counter when the machine is not busy. However, this approach results in OS (Operating System) scheduling deviations which, therefore, also biases the actual idle activity. The methodology disclosed here includes using a per CPU "idle" counter which is incremented (by each CPU) while in the OS's idle loop and includes a technique whereby an atomic counter increment is achieved which avoids constant use of hardware locking (which, when used by multiple CPU's, severely biases the idle measurement) resulting in accurate, repeatable, and unbiased per CPU and aggregate CPU utilization measurements. In the approach described here, the idle counter increment is inserted into the existing CPU idle procedure. Additionally, a calibration routine is included in the OS initialization code which determines the maximum idle counter increment rate for a truly 100% idle CPU. This max rate is then used as the basis for determining actual CPU utilization during normal operation.