In the previous blog, we were looking at the verification of customer requirements. Even a simple product specification involving a battery can raise new questions. The initial information provided led to the need to ask the customer more clarifying questions about the user scenario. With the answers to these questions in hand, we have a better idea about what needs to be measured.
We need to measure two things: Time and the CPU load percentage.
Time will be the easier of the two and can be done utilizing any of the available Win32 APIs. Furthermore, the required accuracy in the area of time is not high, so using the tick count value will be enough. Since we are looking for a measurement in hours, a margin of error of 1 or 2 seconds will be acceptable.
In the specification, the CPU load percentage was measured directly. There are no Win32 APIs that provide this information; instead they provide the CPU Idle time. Idle time is the time the CPU spends in the OEMIdle state. This state is called when there are no threads running. In the picture below, the IDLE time is shown in RED the other colors represent various applications or threads that are running.
Of course, this time will not always be the same since you will have various applications running on the device, but in general, we can calculate the CPU utilization as:
CPU Utilization = Total Time - Idle time
This is an indirect form of measurement. We have identified what needs to be measured. We know what APIs are available for our purpose, and in discovering that there is no direct way to measure the CPU, we instead found a way to measure when the CPU is idle. There are times when this sort of indirect measurement is the only method to determine the data we need to verify the requirement.
In the next installment we’ll look at what tools we will need to develop to reveal if the customer’s device meets the product’s requirements.