2_Computer Organization and Architecture
2_Computer Organization and Architecture
Architecture
Assessing and Understanding
Performance
Introduction
For a program:
CPU execution time= CPU clock cycles X Clock cycle time …..(1)
Clock cycle time= …..(2)
by putting the value from (2) into (1) we get,
CPU execution time=
CPU clock cycle= Instructions for a program x Avg clock cycles per instruction
CPU time= Instruction count x CPI x Clock cycle time
Or , CPU time=
CPI=
CPI = [ CPU clock cycle= CPU time x clock rate ]
Improving performance
= = = 1.2
That means , Computer A is 1.2 times faster than Computer B.
Comparing code segment
A compiler designer is trying to decedide between two code sequences
for a particular computer. The hard ware designers have supplied the
following facts:
CPI for this instruction class
A B C
CPI 1 2 3
1 2 1 2
2 4 1 1
i. Whish code sequences executes the most instructions? Ii. Which will be
faster? Iii. What is the CPI for each sequence?
Continue…
Solution for i. : Sequence 1 executes 2+1+2 = 5 instructions.
Sequence 2 executes 4+1+1 = 6
instructions.
So, sequence 2 executes the most instructions.
Solution for ii. : we know that, CPU clock cycle =
This yields, CPU clock cycles(1) = (2x1)+(1x2)+(2x3)=2+2+6=10 cycles
CPU clock cycles(2) = (4x1)+(1x2)+(1x3)=4+2+3=9 cycles
So code sequence 2 is faster, even though it actually executes one extra
instruction.
Solution for iii. : CPI =
CPI (1)= = = 2
CPI (2)= = = 1.5
Evaluating performance
= = = 9.1
So , = 9.1 x
That is B is 9.1 time faster than A for programs 1 and 2 together.
MIPS =
MIPS as a performance measure
CPI for this instruction class
A B C
CPI 1 2 3
Assume that the computer’s clock rate is 4 GHz. Which code sequence
will execute faster according to MIPS? According to execution time?
Continue…
Let’s compute the MIPS rate for each version of the program,using the
following equation:
MIPS =