Instruction Performance
The number of clock cycles required for a program can be written as
CPU clock cycles = Instructions for a program ×
Average clock cycles per instruction (CPI)
where clock cycles per instruction (CPI) is the average number of clock cycles per instruction for a program or program fragment.
Using the Performance Equation
Consider two different processors P1 and P2 executing the same instruction set with the clock rates and CPIs given in the table.
|
|
Processor |
Clock Rate |
CPI |
P1 |
2.5 GHz |
2.0 |
P2 |
3.0 GHz |
2.5 |
|
Which processor has the higher performance and by how much?
Assume each computer executes the same number of instructions, I, for a program.
The number of processor clock cycles for each computer is
CPU clock cycleP1 = I×2.0 and CPU clock cycleP2 = I×2.5
Now we can compute the CPU time for each computer:
CPU timeP1 = CPU clock cycleP1 / Clock rateP1
= ( I × 2.0 cycles ) / ( 2.5 × 109 cycles/second )
= I × 0.8 × 10-9 seconds = I × 0.8 × 103 × 10-12 seconds
= I × 800 × 10-12 seconds = 800 × I ps
CPU timeP2 = ( I × 2.5 ) / ( 3.0 × 109 ) = 833 × I ps
Thus, P1 is faster.
The amount faster is given by the following ratio:
CPU performanceP1 / CPU performanceP2
= Execution timeP2 / Execution timeP1
= ( 833 × I ps ) / ( 800 × I ps ) = 1.04
We can conclude that computer P1 is 1.04 times as fast as computer P2 for this program.