0% found this document useful (0 votes)
3 views35 pages

Lec 03 - Computer Performance

The document discusses computer performance metrics, including definitions and examples of performance, such as clock frequency and MIPS. It highlights the importance of measuring performance to make informed decisions and understand hardware capabilities, focusing on factors like response time, throughput, and execution time. The document also introduces key performance equations and metrics, including CPU time, CPI, and MIPS, and provides examples to illustrate these concepts.

Uploaded by

abdohmoimg
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)
3 views35 pages

Lec 03 - Computer Performance

The document discusses computer performance metrics, including definitions and examples of performance, such as clock frequency and MIPS. It highlights the importance of measuring performance to make informed decisions and understand hardware capabilities, focusing on factors like response time, throughput, and execution time. The document also introduces key performance equations and metrics, including CPU time, CPI, and MIPS, and provides examples to illustrate these concepts.

Uploaded by

abdohmoimg
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

CS 222 : Computer Organization

Lecture 3: Computer Performance

1
Defining
Computer Performance

2
What is Performance?

➢ Different users have different definitions of performance

➢ You are already familiar with some performance metrics

➢ Clock Frequency:
My computer runs at 500MHz, yours only at 300MHz, so my computer is better
than yours!

➢ Millions of Instructions Per Second (MIPS):


In a second, my computer can execute 5 million instructions, while yours only 3
million instructions, so my computer is better than yours

3
Defining Performance: Airplane Example
Airplane Passengers Range (mi) Speed (mph)

Boeing 737-100 101 630 598


Boeing 747 470 4150 610
BAC/Sud Concorde 132 4000 1350
Douglas DC-8-50 146 8720 544

• How much faster is the Concorde compared to the 747?


• How much bigger is the Boeing 747 than the Douglas DC-8?

• So which of these airplanes has the best performance?!


4
Which Airplane performs better?

"X is n times faster than Y" means

➢ As faster means both increased performance and decreased execution


time, to reduce confusion will use “improve performance” or
“improve execution time”

5
Why measure performance?
➢ Make intelligent choices
➢ See through the marketing hype
➢ Key to understanding underlying organizational motivation

➢ We are interested in answering questions like:

– Why is some hardware better than others for different programs?

– What factors of system performance are hardware related? (e.g., Do we


need a new machine, or a new OS?)

– How does the machine's instruction set affect performance?

6
Performance
Metrics

7
Computer Performance
➢ Response Time (Latency)

✓ How long does it take for my job to run?


✓ How long does it take to execute a job? Individual user
concerns…
✓ How long must I wait for the database query?

➢ Throughput

✓ How many jobs can the machine run at once?


✓ What is the average execution rate? Systems manager
concerns…
✓ How much work is getting done?

➢ If we upgrade a machine with a new processor what do we increase?

➢ If we add a new machine to the lab what do we increase?

8
Program Execution Time

➢ Elapsed Time
✓ counts everything (disk and memory accesses, I/O , etc.)
✓ a useful number, but often not good for comparison purposes
✓ elapsed time = CPU time + wait time (I/O, other programs, etc.)
➢ CPU time
✓ doesn't count I/O or time spent running other programs
✓ can be broken up into system time, and user time
✓ CPU time = user CPU time + system CPU time
➢ Our focus: user CPU time (CPU execution time or, simply, execution time)
✓ time spent executing the lines of code that are "in" our program

9
Program Execution Time

10
Understanding Performance

➢ Algorithm
➢ Determines number of operations executed
➢ Programming language, compiler, architecture
➢ Determine number of machine instructions executed
per operation
➢ Processor and memory system
➢ Determine how fast instructions are executed
➢ I/O system
➢ Determines how fast I/O operations are executed

11
Relative Performance

12
Relative Performance

• Example: For a given program:


– Execution time on machine A: Execution(A) = 10 second
– Execution time on machine B: Execution(B) = 15 seconds
Speedup = Performance(A)/ Performance(B) =
Execution_Time(B) /Execution_Time(A)=15 /10 = 1.5
• The performance of machine A is 1.5 times the performance
of machine B when running this program, or Machine A is
said to be 1.5 times faster than machine B when running this
program

13
Definition of Performance

• Performance means how quickly it can execute programs.


• Three factors affect performance:
➢ Compiler
➢ Instruction set architecture
➢ Hardware design

14
Performance Metrics

• CPU_time = T

• Clock rate (cycles per second) = R

• Clock cycle time (seconds per cycle) = 1/R

• CPI (avg. no. of cycles per instruction)


– a floating point intensive application might have a higher CPI

• MIPS (millions of instructions per second)

15
Basic Performance Equation

• CPU_time (T) – processor time required to execute a program that


has been prepared in high-level language

• N – number of actual machine language instructions needed to


complete the execution (note: loop)

• S – average number of basic steps needed to execute one machine


instruction. Each step completes in one clock cycle

• R – clock rate (frequency) = cycles per second (1 Hz. = 1 cycle/sec)

N S
T=
R

16
Example

• For the following processor, obtain the performance.

➢ Clock rate = 800 MHz

➢ No. of instructions executed = 1000

➢ Average no of steps needed / machine instruction = 20

N S
T = = (1000 ×20) / (800 ×106)= 25 µ sec
R
or 25 × 10 sec
-6

17
Example

• A program contains 1000 instructions. Out of that 25%


instructions require 4 clock cycles, 40% instructions require 5
clock cycles and remaining require 3 clock cycles for
execution. Find the total time required to execute the program
running in a 1 GHz machine.

18
Solution

• N = 1000

• 25% of N = 250 instructions require 4 clock cycles.

• 40% of N = 400 instructions require 5 clock cycles.

• 35% of N = 350 instructions require 3 clock cycles.

• T = (N×S)/R = (250×4+400×5+350×3)/1×109 =
(1000+2000+1050)/1×109 = 4.05 μs.

19
Clock Cycle

• Processor circuits are controlled by a timing signal


called clock.

• The execution of each instruction is divided into several


steps, each of which completes in one clock cycle.

• Hertz – cycles per second

20
Clock Cycle

➢ Instead of reporting execution time in seconds, we often use number of


CPU clock cycles needed for executing the program.

➢ Clock “ticks” indicate start and end of cycles :


➢ clock cycle time = time between ticks = seconds per cycle
➢ e.g., 250ps, 0.25ns = 250×10-12 s

➢ clock rate (frequency) = cycles per second (1 Hz. = 1 cycle/sec)

A 200 MHz, clock has a


1
 10 9 = 5 nanoseconds
200  10 6

21
How to Improve Performance

CPU_time (T) = CPU clock cycles × Clock cycle time


= CPU clock cycles / Clock rate (R)

• So, to improve performance one can either:

– reduce the number of cycles for a program, or

– reduce the clock cycle time, or, equivalently,

– increase the clock rate

22
Example

• A program runs in 10 seconds on computer A, which has a 2


GHz 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 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?

• To run the program in 6 seconds, B must have twice the clock


rate of A.

23
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?

24
CPI

• It may be easier to count the number of instructions executed in a given


program as compared to counting the number of CPU clock cycles needed
for executing that program.

• Therefore, the average number of clock cycles per instruction (CPI) has
been used as an alternate performance measure.

• The CPI is given by:

CPU clock cycles for the program


CPI =
Instructio n count

25
Overall CPI

 CPI  I
i i
CPI = i =1

Instructio n count

where:

I i: number of times an instruction of type i is executed in the program

CPIi: average number of clock cycles needed to execute such instruction

26
CPI Example

• 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 200 MHz.

• Assuming the execution of 100 instructions, the overall CPI can be


computed as

27
CPI Example

• Suppose we have two implementations of the same


instruction set architecture.

• Computer A has a clock cycle time of 250 ps and a CPI of 2.0


for some program, and computer B has a clock cycle time of
500 ps and a CPI of 1.2 for the same program.

• Which computer is faster for this program and by how much?

28
CPI Example

• Computer A: Cycle Time = 250ps, CPI = 2.0


• Computer B: Cycle Time = 500ps, CPI = 1.2
• Which is faster, and by how much?

29
MIPS

• A different performance measure is MIPS(million


instructions-per-second (the rate of instruction execution per
unit time)):

30
MIPS Example

• Suppose that the same set of benchmark programs considered above were
executed on another machine, call it machine B, for which the following
measures were recorded.

What is the MIPS rating for the machine considered in the previous
example (machine A) and machine B assuming a clock rate of 200 MHz?

31
Solution

• Thus MISPb > MISPa

32
Performance Equations

CPU execution time = Instruction count  average CPI  Clock cycle time
for a program for a program

= Instructio n count  CPI


Clock rate

CPU time = Seconds = Instructions x Cycles x Seconds


Program Program Instruction Cycle
n

 CPI  I i i
CPI = i =1

Instructio n count

33
Example

• Consider the following measurement made on two different machines


running a given set of benchmark programs.

34
Solution

• The example shows that although machine B has a higher MIPS compared to
machine A, it requires longer CPU time to execute the same set of benchmark
programs.
35

You might also like