What Is CPU Time

Time is a measure used to quantify computer performance. Hence, computer that performs same amount of work in comparatively less time is recognised as fastest computer. CPU time is often worded as CPU usage, CPU execution time or the process time. CPU time is defined as the total time the Central Processing Unit was utilized to execute user instructions. Instructions may be either in the form of a computer program or I/O-Input/ Output operations. CPU time can be further divided into user CPU time and system CPU time. CPU time depleted in the program is user CPU time and the CPU time spent in the operating system performing tasks on behalf of the program is called system CPU time. While executing a program, CPU time is comparatively lesser than the total execution time of the program. This is where multitasking operating systems take advantage; they share CPU among quite a lot of programs. CPU times can be used for range of functions such as comparing the speed of two dissimilar processors to calculate the total processing time allocated to these programs on a multitasking platform.

CPU time is characterized by the data type clock_t, referred as clock ticks. Accordingly, to arrive at CPU time, we need three parameters Cycle time, Cycles per average instruction (CPAI) and path length. These three parameters depend on:

Cycle time: CPU Model based technology.

CPI: Design such as coding or micro-coding of instructions.

Path length: set of instructions lined up and compiler.

Hence, CPU time can be calculated as: CPU time=path length * (cycles/instruction) * cycle time or since the clock rate is the inverse of clock cycle time:

CPU time=Path length*CPI (Cycles per instruction)/Clock rate

These formulas are principally useful since they break up three key factors that influence performance. We can use these formulas to evaluate two different executions or to evaluate a design alternative if we know its impact on these three parameters. For example, assuming we have two executions of the same instruction. Computer X has a clock cycle time of 250 ps and a CPI of 2.0 for some program and computer Y has a clock cycle time of 500 ps and a CPI of 1.2 for the same program. Now we will use performance equation to evaluate which computer is faster for this program and by how much.

We know that every computer executes the same number of instructions for the program and let us name these instructions as “I”. Firstly, to calculate number of processor clock cycle for each computer:

CPU clock cyclesX = I * 2.0 and CPU clock cyclesY = I *1. 2

Therefore CPU timeX = CPU clock cycles * Clock cycle time

                                        =I*2.0*250 ps=500*I ps

Similarly, CPU timeY = CPU clock cycles * Clock cycle time

                                        =I*1.2*500 ps=600*I ps

Hence we can conclude that Computer X is faster. How faster it is can be calculated as:

CPU PerformanceX/ CPU PerformanceY =Execution timeY/Execution timeX= (600*Ips)/ (500*Ips) =1.2

Computer X is 1.2 times faster than Computer Y.