0% found this document useful (0 votes)
21 views16 pages

SEN307 Lecture 8

The document discusses CPU performance measures, including clock cycle, clock frequency, and cycle time, and provides mathematical formulas to calculate performance metrics such as CPI and MIPS. Several examples illustrate how to compute these metrics for different machines based on their instruction categories and execution times. The document emphasizes the relationship between clock rate, execution time, and CPU performance in various scenarios.

Uploaded by

hauwafaruk81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views16 pages

SEN307 Lecture 8

The document discusses CPU performance measures, including clock cycle, clock frequency, and cycle time, and provides mathematical formulas to calculate performance metrics such as CPI and MIPS. Several examples illustrate how to compute these metrics for different machines based on their instruction categories and execution times. The document emphasizes the relationship between clock rate, execution time, and CPU performance in various scenarios.

Uploaded by

hauwafaruk81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Lecture 8

Introduction to CPU Performance

Computer Architecture- NUN 2024 Austin Olom Ogar


Performance Measures
Computer system can be measured based on an expected outcome for instance, a user of a
computer measures its performance based on the time taken execute a given job(program)

On the other hand, a laboratory engineer measure its performance of his system by the throughput.

We denote the following by:

.
CPU Clock Cycle as …………………..>> CC
Clock Frequency as ………………….>> f
Cycle Time as …………………………..>> CT

Computer Architecture - NUN 2024 Austin Olom Ogar


Performance Measures
Mathematically;

• F = 1/CT
• Computer Performance = 1/Execution Time
• CC = instruction * CPI
• = CPU Time * Clockrate

• CPU Time = CC *CT


• .
= (I * CPI)/clock rate

• Clock rate = CC/CPU Time

• CPI =(σ𝑛𝑘=𝑖 𝐶𝑃𝐼 ∗ 𝐼)/(𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛 𝑐𝑜𝑢𝑛𝑡)


• = CC/Instruction Count

• MIPs = Instruction Count/(Execution time) *106


• = Clock rate/(CPI)*106
Computer Architecture - NUN 2024 Austin Olom Ogar
Example 1
Consider Computing the overall CPI for a machine A for which the following performance measures
were recorded when executing a set of benchmark programs. Assume that the clock rate of the CPU
is 200MHZ
Instruction category Percentage of Occurrence No. of Cycle per Instruction
ALU 38 1
Load & Store 15 3
Branch 42 4
Other . 5 5

Solution
CPIA = CPI =(σ𝑛𝑘=𝑖 𝐶𝑃𝐼 ∗ 𝐼𝐴)/(𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛 𝑐𝑜𝑢𝑛𝑡)
= (38*1 + 15*3 + 42*4 + 5*5)/100
= (38 + 45 + 168 + 25)/100
= 276/100
= 2.76

Computer Architecture - NUN 2024 Austin Olom Ogar


Example 2
Suppose that the the same set of benchmark programs considered in example 1 were extended on
another machine B, for which the following measures were recorded

Instruction category Percentage of Occurrence No. of Cycle per Instruction


ALU 35 1
Load & Store 30 2
Branch 15 3
Other . 20 5
What is the MIPS rating for the machine considered in the previous example (Machine A) and the
machine B assuming a clock rate of 200MHZ?
Solution
CPIA = CPI =(σ𝑛𝑘=𝑖 𝐶𝑃𝐼 ∗ 𝐼𝐴)/(𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛 𝑐𝑜𝑢𝑛𝑡)
= (38*1 + 15*3 + 42*4 + 5*5)/100
= (38 + 45 + 168 + 25)/100
= 276/100
= 2.76
Computer Architecture - NUN 2024 Austin Olom Ogar
Example 2 cont..
MIPSA = clock rate/(CPI) *106
= (200 *106)/(2.76 *106)
= 72.46

CPIB = CPI =(σ𝑛𝑘=𝑖 𝐶𝑃𝐼 ∗ 𝐼𝐵)/(𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛 𝑐𝑜𝑢𝑛𝑡)


= (35*1 + 30*2 + 15*3 + 20*5)/100

.
= (35 + 60 + 45 + 100)/100
= 240/100
= 2.4

MIPSB = clock rate/(CPI) *106


= (200 *106)/(2.4 *106)
= 83.33

Hence; MIPSB >MIPSA

Computer Architecture - NUN 2024 Austin Olom Ogar


Example 3
The following measurement made on two different machine using a given set of benchmark
programs
Instruction category No. of Instruction (in Million) No. of Cycle per Instruction
MACHINE A
ALU 8 1
Load & Store 4 3

.
Branch 2 4
Other 4 3
MACHINE B
ALU 10 1
Load & Store 8 2
Branch 2 4
Other 4 3

Calculate the overall CPI for A and B and their MIPS and CPU Time respectively

Computer Architecture - NUN 2024 Austin Olom Ogar


Example 3 cont..
Machine A:
CPIA = CPI =(σ𝑛𝑘=𝑖 𝐶𝑃𝐼 ∗ 𝐼𝐴)/(𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛 𝑐𝑜𝑢𝑛𝑡)
= (8*1 + 4*3 + 2*4 + 4*3)*106/(8+ 4+2+4)*106
= (8 + 12 + 8 + 12)*106/18”106
= 40*106/18*106
= 2.22

.
MIPSA = clock rate/(CPI) *106
= (200 *106)/(2.2 *106)
= 90.9

CPU TimeA = (Instruction*CPI)/clock rate


= ((18 *106)*2.2)/200*106
= 0.198s

Computer Architecture - NUN 2024 Austin Olom Ogar


Example 3 cont..
Machine B:
CPIB = CPI =(σ𝑛𝑘=𝑖 𝐶𝑃𝐼 ∗ 𝐼𝐵)/(𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑖𝑜𝑛 𝑐𝑜𝑢𝑛𝑡)
= (10*1 + 8*2 + 2*4 + 4*3)*106/(10+ 8+2+4)*106
= (10 + 16 + 8 + 12)*106/24*106
= 46*106/24*106
= 1.92

.
MIPSB = clock rate/(CPI) *106
= (200 *106)/(1.92 *106)
= 104.2

CPU TimeB = (Instruction*CPI)/clock rate


= ((24 *106)*1.92 )/200*106
= 0.23s

Hence; MIPSB >MIPSA


CPU TimeB >CPU TimeA
Computer Architecture - NUN 2024 Austin Olom Ogar
Example 4
A program runs in 10 seconds on a Computer A which has a 2GHZ clock. We are trying to help a
computer designer build a computer B, which will run this program in 6 seconds. The designer has
determined that a substantial increase in the clock rate is possible but this increase require 1.2 times
as many clock cycle as computer A for this program what clock rate should we tell the designer to
target

Solution

.
Let’s first find the number of clock cycle required for the program A

CPU TimeA = (Clock CycleA)/clock rateA


10s = CCA/2*109
CCA = 10*2*109
= 20*109
CPU TimeB = (Clock CycleB)/clock rateB
6s = 1.2(20*109)/6
CCA = (24*109)/6
= 4*109
= 4GHZ
Example 5
Consider three different processor P1, P2, and P3 executing the same instruction set. P1 has a 3GHZ
clock rate, and a CPI of 1.5. P2 has a 2.5GHZ clock rate and CPI of 1.0. P3 has a 4.0GHZ clock rate and
CPI of 2.2
a) Which processor has the highest performance expressed in instruction per seconds
b) If the processor execute a program in 10 seconds. Find the number of cycle and number of
instruction
c) We are trying to reduce the execution time by 30% but this lead to increase of 20% in the CPI.

.
What clock rate should we have to get this time reduction.

Solution
Performance = 1/execution time
= 1/CC/Clock rate
= clock rate/(Instruction * CPI)
A) Processor 1:
Performance = clock rate/(Instruction * CPI)
= (3*109)/1.5 = 2*109 = 2GHZ
Example 5 cont..
Processor 2:
Performance = clock rate/(Instruction * CPI)
= (2.5*109)/1 = 2.5*109 = 2.5GHZ

Processor 3:
Performance = clock rate/(Instruction * CPI)
= (4*109)/2.2 = 1.8*109 = 1.8GHZ

.
Therefore, processor 2 has the highest performance

(B)
P1:CPU Time = Clock cycle/clock rate
CC = CPU Time * Clock rate
= 10 * 3*109 = 30*109
CC = Instruction *CPI
Instruction = CC/CPI
Instruction = (30*109)/1.5 = 20*109
Example 5 cont..
P2:CPU Time = Clock cycle/clock rate
CC = CPU Time * Clock rate
= 10 * 2.5*109 = 25*109
CC = Instruction *CPI
Instruction = CC/CPI
Instruction = (25*109)/1 = 25*109

.
P3:CPU Time = Clock cycle/clock rate
CC = CPU Time * Clock rate
= 10 * 4*109 = 40*109
CC = Instruction *CPI
Instruction = CC/CPI
Instruction = (40*109)/2.2 = 18.18*109
Example 5 cont..
(C)
P1:CPInew = CPIold * 1.2
= 1.5 *1.2
= 1.8
clock rate = ((20*109) * 1.8)/7
= 5.14GHZ

.
P2:CPInew = CPIold * 1.2
= 1 *1.2
= 1.2
clock rate = ((25*109) * 1.2)/7
= 4.29GHZ

P3:CPInew = CPIold * 1.2


= 2.2 *1.2
= 2.64
clock rate = ((18.18*109) * 2.64)/7
= 6.86GHZ
Example 6
Consider having a program that runs in 50s on Computer A, which has a 500MHZ clock, we would
like to run the same program on another machine B in 20s. If machine B requires 2.5times as many
clock cycles as machine A for the same program, what clock rate must machine B have in MHZ?

Solution
Lets first find the CPU Time for machine A
CPUA = Clock Cycle/Clock rate

.
50s = CC/500*106
CC = 50 * 500*106
= 25*109
Lets get the clock rate of machine B
CPUB = Clock Cycle/Clock rate
20s = 2.5*(25*109)/clock rate
Clock rate = 2.5 *(25*109)/20
= (62.5*109)/20
= 3.125 *109
= 312.5*106
Example 7
Consider having a program that runs in 50s on Computer A, which has a 500MHZ clock, we would
like to run the same program on another machine B in 20s. If machine B requires 2.5times as many
clock

You might also like