What is CPU Time?

CPU time is the amount of time that the process is using the CPU, converting it to percentage is done by dividing it by the real amount of time passed. For example, if CPU time is 1 second of total execution time 2 seconds then the CPU utilization is ½ x 100 = 50%.

How does the CPU time is calculated?

The formula is:

CPU Time = Instruction Count X Clock Cycles per Instructions X Clock Cycle Time

where:

CPU Time: CPU Time is the time between the start and end of the execution of the given program. It is measured in seconds/program. It includes the OS routines executed on the program’s behalf. However, it does not include the waiting time for I/O and other programs.

Instruction Count: It is the total number of instructions that get executed for a particular task, algorithm, workload or program. Instruction Count is measured in Instructions/Program. Its values are dynamic in nature, dominated by repetitive operations such as loops and recursions. For predicting incremental changes, architects use execution traces of benchmark programs to get the instruction count. It also depends on the instruction set offered by different processors. As different instruction sets may do different amounts of work in a single instruction.

Clock Cycles Per Instructions: It is measured in Clock Cycles/Instructions. The steps required to execute an instruction include:

• Fetch
• Decode
• Execute
• Write Back

Clock Cycle Time: It is the period of the clock that synchronizes circuits in the processor and is measured in seconds/clock cycle. It is inversely proportional to the frequency of the processor. If the processor is 4 GHz then the clock cycle time of the oscillator in the processor is 0.25 nanoseconds. The formula is

T α 1/F

Key Point for Performance Tester/Engineer:

1. CPU Utilization is not always associated with the frequency of the processors. It can also be affected by the branch prediction algorithm, dependency analysis, register renaming and instruction window size for clock cycles per instruction calculation as well as the total number of instructions executed for specific tasks, programs or algorithms.
2. To improve the performance, it is required to split the execution engine into separate units to achieve Instruction Level Parallelism. More execution engines will be responsible for lesser clock cycles which in turn improves the performance.
3. Large instruction window tends to higher performance and higher power consumption

You may be interested: