comp 180
Lecture 03
Outline of Lecture
1. The Role of Computer Performance
2. Measuring Performance
 
	
 
       
comp 180
Lecture 03
The Role of Computer
Performance
 Designing high performance computers is one of
the major goals of any computer architect.
 As a result, assessing the performance of computer hardware is at the heart of computer design
- and greatly affect the demand and market value
of the computer.
 However, measuring performance of a computer
system is not a straight-forward task:
 Which application to use to measure performance?
 What component of computer to measure (e.g.,
processor, I/O, cache)?
 How do other parameters affect performance (e.g.,
OS, compiler).
 
	
 
       
comp 180
Lecture 03
 How do you define performance (e.g., faster, or
most completed jobs during a certain period of
time) - execution time vs. throughput.
Example
Do the following changes to a computer system increase
throughput, decrease response time, or both?
1) Replacing the processor in a computer with a faster version
2) Adding additional processors to a system that uses multiple
processors for separate tasks - for example handling an airline reservation system.
Answer
1) Both response time and throughput are improved
2) Only throughput increases.
 
	
 
       
comp 180
Lecture 03
In this class, we will be primarily interested
!#"%$'&#( "%$*)+
in
as a measure of
performance.
 To maximize performance of an application, we
need to minimize its execution time - the relationship between performance and execution time on
a computer X is given by:
1
Performanc e X = -------------------------------------------------Execution time X
 If the performance of computer X is better than the
performance of computer Y, then:
Performanc e X > Performanc e Y
 
	
 
       
comp 180
Lecture 03
1
1
-------------------------------------------------- > -------------------------------------------------Execution time X Execution time Y
Execution time Y > Execution time X
 We say that computer X is n times faster than
computer Y to mean:
Execution time Y
Performanc e X
------------------------------------------- = -------------------------------------------------- = n
Execution time X
Performanc e Y
 
	
 
       
comp 180
Lecture 03
How to Measure Performance?
 In order to get an accurate measure of performance, we use CPU time instead of using
response time.
 CPU time is the time the CPU spends computing a
program and does not include time spent waiting
for I/O or running other programs.
 CPU time can also be divided into user CPU time
(program) and system CPU time (OS).
 In our performance measurements, we use user
CPU time - because of its independence on the
OS and other factors.
 
	
 
       
comp 180
Lecture 03
CPU Time Performance
 All computers are constructed using a clock to
operate its circuits. It is typically measured by its
period (e.g., 10 nsec) or by its rate (e.g., 100
MHz).
 The CPU time performance is probably the most
accurate and fair measure of performance.
 The CPU time for a program is given by:
CPU time = CPU clock cyles for a program
 Clock cycle time
Alternatively the CPU time can be measured as:
CPU clock cycles for a program
CPU time = -------------------------------------------------------------------------------------------------Clock rate
 
	
 
       
comp 180
Lecture 03
A computer designer can improve the computer performance by either reducing the
length of the clock cycle or the number of
clock cycles required for a program.
In this class, we will understand how a computer designer achieves these goals, and
what trade-offs the designer faces to achieve
that.
 
	
 
       
comp 180
Lecture 03
Example
A given program runs in 10 sec on computer A, which has a
100 MHz clock. We are trying to help a computer designer build
a computer B, that will run this program in 6 sec. The designer
has determined that a substantial increase in the clock rate is
possible, but this increase will affect the rest of the CPU design,
causing computer B to require 1.2 times as many clock cycles
as computer A for this program.
What clock rate should we tell the designer to target?
Answer
First, we find the number of clock cycles required for the program on computer A:
CPU clock cycles A
CPU time A = ----------------------------------------------------------Clock rat e A
CPU clock cycles A = 10 sec  100  10
 
6 cycles
-----------------sec
	
 
       
comp 180
Lecture 03
The CPU time for computer B can be found as follows:
1.2  CPU clock cycles A
CPU time B = -------------------------------------------------------------------------Clock rat e B
6 sec
6
1.2  1000  10 cycles
= -----------------------------------------------------------------Clock rat e B
Clock rat e B = 200  10
cycles = 200 MHz
Computer B must have twice the clock rate of
computer A to run the program in 6 seconds.
 
1
	
 
       
comp 180
Lecture 03
 The CPU time for a program directly depends on
the number of instructions in that program.
CPU clock cycles = Instructions for a program
 Average clock cycles per instruction
 The term clock cycles per instruction is often
abbreviated as CPI.
The CPI of a program depends on the instruction set of the computer and on its compiler.
 
	
 
       
comp 180
Lecture 03
Example
Suppose we have 2 implementations of the same instruction
set architecture. Computer A has a clock cycle time of 10 nsec
and a CPI of 2.0 for some program, and computer B has a clock
cycle time of 20 nsec and a CPI of 1.2 for the same program.
Which machine is faster for this program?
Answer
Assume the program requires I instructions to be executed:
CPU clock cycles A = I  2.0
CPU clock cycles B = I  1.2
CPU time A = I  2.0  10 n sec
= 20  I n sec
CPU time B = I  1.2  20 n sec
= 24  I n sec
 Computer A is faster than computer B.
 
	
 
       
comp 180
Lecture 03
 The CPU time for a program, which is our main
measure of performance, can be written as:
CPU time = Instruction count  CP I  Clock cycle time
Instruction count  CPI
CPU time = --------------------------------------------------------------------Clock rate
 The performance of the CPU is directly dependent on the clock speed, the number of cycles
per instruction, and the number of instructions
per program, known as instruction count (IC).
 It is equally dependent on each one of them.
IC
Program
Compiler
Instr. Set
Microarchitecture
Technology
 
CPI
Clock
rate
X
X
	
 
       
comp 180
Lecture 03
 In order to take into account the frequency of
instructions in a program, then the CPU performance can be expressed as:
n
CPU clock cycles =
 CPI i  IC i
i=1
where ICi is the number of times instruction i is executed in a program and CPIi represents the average
number of clock cycles for instruction i.
 n
CPU time =   CPI i  IC i  Clock cycle time
i = 1
 The overall CPI can be expressed as:
n
IC i
CPI =  CPI i  --------------------------------------------------
 Instruction count
i=1