Week 13 14 - Performance Evaluation
Week 13 14 - Performance Evaluation
HNDIT24012
Computer Architecture
1
Outline
2
Why Measure Performance?
4
Performance and Speed
5
Measuring Time
6
Execution Time
Elapsed Time
(real time)
• 1 bit
• 8 bits = 1 byte
• 1024bytes = 1 kilobyte = 1KByte = 1K = 210
• 1024KBytes = 1 megabyte = 1MB = 220
• 1024MB = 1 gigabyte = 1GB = 230
• 1024GB = 1 terrabyte = 240
• and on to infinity
Aside - 1 decade ago my home computer had 32K memory.
Today it has 32MB, and needs to be upgraded to at least 64MB! 8
Measuring Times
• Duration
• 1 second
• 1/1000 second = 1 millisec = 1ms = 10-3 s
• 1/1,000,000 s = 1 microsec = 10-6 s
• 1/1,000,000,000s = 1 nanosec = 10-9 s
• Frequency
• 1 Herz = 1 cycle per second
• 1 MHz = 1,000,000 cycles per sec
• 100MHz = 100,000,000 cycles per sec.
9
Computer Clock Times
• Computers run according to a clock that runs
at a steady rate
• The time interval is called a clock cycle (eg,
10ns).
• The clock rate is the reciprocal of clock cycle
- a frequency, how many cycles per sec (eg,
100MHz).
• 10 ns = 1/100,000,000 (clock cycle), same as:-
• 1/10ns = 100,000,000 = 100MHz (clock rate).
10
Purchasing Decision
• Computer A has a 100MHz processor
• Computer B has a 300MHz processor
• So, B is faster, right?
•WRONG!
• Now, let’s get it right…..
11
Measuring Performance
13
Example
• Machine A • Machine B
• clock cycle time • clock cycle time
• 30ns/cycle
• 10ns/cycle
• CPI = 0.5 for prog X
• CPI = 2.0 for prog X
CPU clock cycles (A) = I * 2.0 CPU clock cycles (B) = I * 0.5
CPU time (A) = CPU clock cycles * CPU time (B) = CPU clock cycles *
clock cycle time clock cycle time
= I * 2.0 * 10 = I * 0.5 * 30
= I * 20 ns = I * 15 ns
P e r fo r m a n c e ( A ) E x e c u tio n ( B )
0 .7 5
P e r fo r m a n c e ( B ) E x e c u tio n ( A )
14
Basic Performance Equation
• CPU Time = I * CPI * T
• I = number of instructions in program
• CPI = average cycles per instruction
• T = clock cycle time
• CPU Time = I * CPI / R
• R = 1/T the clock rate
• T or R are usually published as performance measures for a processor
• I requires special profiling software
• CPI depends on many factors (including memory).
15
Other “tricks of the trade”
• MIPS
• Million Instructions Per Second
• MFLOPS
• Million Floating Point Operations Per Second
• Benchmarks: SPECs
• Average Performance over a set of example
programs
• Are any of these accurate? or even useful?
16
Marketing Metrics (Patterson)
MIPS = Instruction Count / Time * 10^6
= Clock Rate / CPI * 10^6
•machines with different instruction sets ?
•programs with different instruction mixes ?
• dynamic frequency of instructions
• uncorrelated with performance
Speedup(with E) = ExTime(without E) ÷
((1-F) + F/S) X ExTime(without E)
Summary
• Dealt with issues of measuring performance
• Considered terminology for measuring performance
• bits
• bytes
• megabytes
• nanoseconds
• MHz
• Seen the basic formulae for execution time.
19