COMPUTER SYSTEM
Week 2
COMPUTER PERFORMANCE
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 1
Performance
Objectives:
Understand the definition and how to determine the
performance of a computer.
Reference book:
Computer Organization and Design: The Hardware/Software Interface,
Patterson, D. A., and J. L. Hennessy, Morgan Kaufman, Revised Fourth Edition,
2011.
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 2
Defining Performance
Which airplane has the best performance
Boeing 777 Boeing 777
Boeing 747 Boeing 747
BAC/ Sud BAC/ Sud
Concorde Concorde
Douglas Douglas DC-
DC-8-50 8-50
0 100 200 300 400 500 0 2000 4000 6000 8000 10000
Passenger Capacity Cruising Range (miles)
Boeing 777 Boeing 777
Boeing 747 Boeing 747
BAC/ Sud BAC/ Sud
Concorde Concorde
Douglas Douglas DC-
DC-8-50 8-50
0 500 1000 1500 0 100000 200000 300000 400000
Cruising Speed (mph) Passengers x mph
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 3
Response Time and Throughput
Response time
How long it takes to do a task
Throughput
Total work done per unit time
e.g., tasks/transactions/… per hour
How are response time and throughput affected by
Replacing the processor with a faster version?
Adding more processors?
We’ll focus on response time for now…
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 4
Relative Performance
Define Performance = 1/Execution Time
“X is n time faster than Y”
Performanc e X Performanc e Y
Execution time Y Execution time X n
Example: time taken to run a program
10s on A, 15s on B. Which is faster? How much is faster?
Execution TimeB / Execution TimeA
= 15s / 10s = 1.5
So A is 1.5 times faster than B
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 5
Measuring Excution Time
Elapsed time
Total response time, including all aspects
Processing, I/O, OS overhead, idle time
Determines system performance
CPU time
Time spent processing a given job
Discounts I/O time, other jobs’ shares
Comprises user CPU time and system CPU time
Different programs are affected differently by CPU and system
performance
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 6
CPU Clocking
Operation of digital hardware governed by a constant-
rate clock
Clock period
Clock (cycles)
Data transfer
and computation
Update state
Clock period: duration of a clock cycle
e.g., 250ps = 0.25ns = 250×10–12s
Clock frequency (rate): cycles per second
e.g., 4.0GHz = 4000MHz = 4.0×109Hz
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 7
CPU Time
CPU Time CPU Clock CyclesClock Cycle Time
CPU Clock Cycles
Clock Rate
Performance improved by
Reducing number of clock cycles
Increasing clock rate
Hardware designer must often trade off clock rate against
cycle count
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 8
CPU Time Example
Computer A: 2GHz clock, 10s CPU time
Designing Computer B
Aim for 6s CPU time
Can do faster clock, but causes 1.2 × clock cycles
How fast must Computer B clock be?
Clock CyclesB 1.2 Clock CyclesA
Clock RateB
CPU Time B 6s
Clock CyclesA CPU Time A Clock Rate A
10s 2GHz 20 10 9
1.2 20 109 24 109
Clock RateB 4GHz
6s 6s
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 9
Instruction Count and CPI
Clock Cycles Instructio n Count Cycles per Instructio n
CPU Time Instructio n Count CPI Clock Cycle Time
Instructio n Count CPI
Clock Rate
Instruction Count (IC) for a program
Determined by program, ISA and compiler
Average cycles per instruction (CPI)
Determined by CPU hardware
If different instructions have different CPI
Average CPI affected by instruction mix
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 10
CPI Example
Computer A: Cycle Time = 250ps, CPI = 2.0
Computer B: Cycle Time = 500ps, CPI = 1.2
Same ISA (Instruction Set Architecture)
Run same program, which is faster, and by how much?
CPU Time Instructio n Count CPI Cycle Time
A A A
I 2.0 250ps I 500ps
CPU Time Instructio n Count CPI Cycle Time
B B B
I 1.2 500ps I 600ps
CPU Time
B I 600ps 1.2
CPU Time I 500ps
A
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 11
CPI in More Detail
If different instruction classes take different numbers of
cycles
n
Clock Cycles (CPIi Instructio n Counti )
i1
Weighted average CPI
n
Clock Cycles Instructio n Count i
CPI CPIi
Instructio n Count i1 Instructio n Count
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 12
CPI Example
Alternative compiled code sequences using instructions
in classes A, B, C. Let calculate CPI of Sequence 1, 2
Sequence 1: IC = 5 Sequence 2: IC = 6
Clock Cycles Clock Cycles
= 2×1 + 1×2 + 2×3 = 4×1 + 1×2 + 1×3
= 10 =9
Avg. CPI = 10/5 = 2.0 Avg. CPI = 9/6 = 1.5
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 13
Performance Summary
Instructio ns Clock cycles Seconds
CPU Time
Program Instructio n Clock cycle
Performance depends on
Algorithm: affects IC, possibly CPI
Programming language: affects IC, CPI
Compiler: affects IC, CPI
Instruction set architecture: affects IC, CPI, T c
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 14
Performance
Reference
• Section 1.4
• Book: Computer Organization and Design:
The Hardware/Software Interface, Patterson,
D. A., and J. L. Hennessy, Morgan
Kaufman, Revised Fourth Edition, 2011.
Exercise: Attached file
03/2017 Copyrights 2017 CE-UIT. All Rights Reserved. 15