CS 230 - Spring 2020 3-1
Computer Systems Lecture 14 Performance Measures CS 230 - Spring - - PowerPoint PPT Presentation
Computer Systems Lecture 14 Performance Measures CS 230 - Spring - - PowerPoint PPT Presentation
CS 230 Introduction to Computers and Computer Systems Lecture 14 Performance Measures CS 230 - Spring 2020 3-1 CPU Clocking Clock period also called cycle time duration of a clock cycle in units of time SI units of time
CS 230 - Spring 2020 3-2
CPU Clocking
Clock period
also called cycle time duration of a clock cycle in units of time SI units of time in seconds per clock cycle
ps = 10-12s ns = 10-9s μs = 10-6s ms = 10-3s
example
250ps = 0.25ns = 250*10-12s
CS 230 - Spring 2020 3-3
CPU Clocking
Clock frequency
inverse of clock period measured in cycles per second: Hertz (Hz)
SI units of Hz:
THz = 1012Hz
GHz = 109Hz
MHz = 106Hz
KHz = 103Hz
example
processor with a clock period of 250ps = 250*10-12s Inverse(250*10-12s) = 0.004*1012Hz = 0.004THz = 4GHz
CS 230 - Spring 2020 3-4
Instruction Count and CPI
Cycles per instruction
abbreviated CPI determined by instruction set architecture (ISA) different CPUs/programs might have different CPI different instruction types can take different
numbers of cycles
not all ISAs use the 5-stage pipeline
Instruction count
total number of instructions run in a program
CS 230 - Spring 2020 3-5
Instruction Count and CPI
CPU Time
time spent executing instructions in a program
only the instructions that actually run
does not include waiting for input or other devices
Performance equation:
CPU Time = Instruction count CPI Clock period
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA?
Example
Instruction Type Branch Memory Everything Else Cycles 5 13 3
CS 230 - Spring 2020 3-6
addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA?
Example
Instruction Type Branch Memory Everything Else Cycles 5 13 3
CS 230 - Spring 2020 3-7
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA?
Example
Instruction Type Branch Memory Everything Else Cycles 5 13 3
CS 230 - Spring 2020 3-8
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA?
Example
Instruction Type Branch Memory Everything Else Cycles 5 13 3
CS 230 - Spring 2020 3-9
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA?
Example
Instruction Type Branch Memory Everything Else Cycles 5 13 3
CS 230 - Spring 2020 3-10
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 jr $31
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA?
Example
Instruction Type Branch Memory Everything Else Cycles 5 13 3
CS 230 - Spring 2020 3-11
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 3
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA?
Example
Instruction Type Branch Memory Everything Else Cycles 5 13 3
CS 230 - Spring 2020 3-12
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles
What is the CPI for the processor on that program?
Example
CS 230 - Spring 2020 3-13
addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31
What is the CPI for the processor on that program?
Example
CS 230 - Spring 2020 3-14
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles
What is the CPI for the processor on that program?
Example
CS 230 - Spring 2020 3-15
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles 7 instructions
What is the CPI for the processor running that program?
Example
CS 230 - Spring 2020 3-16
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles 7 instructions 43 cycles 7 instructions
What is the CPI for the processor running that program?
Example
CS 230 - Spring 2020 3-17
addi $3, $0, 14 3 addi $30, $30, -8 3 sw $3, 0($30) 13 bne $3, $0, x 5 sw $2, 4($30) x: lw $2, 0($30) 13 addi $30, $30, 8 3 jr $31 + 3 43 cycles 7 instructions 43 cycles 7 instructions = 6.14 CPI
How long would this program take to execute if the processor was running at a clock frequency of 5GHz?
Example
CS 230 - Spring 2020 3-18
addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31
How long would this program take to execute if the processor was running at a clock frequency of 5GHz?
Example
CS 230 - Spring 2020 3-19
addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI
How long would this program take to execute if the processor was running at a clock frequency of 5GHz?
Example
CS 230 - Spring 2020 3-20
addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI 1 5GHz
How long would this program take to execute if the processor was running at a clock frequency of 5GHz?
Example
CS 230 - Spring 2020 3-21
addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI 1 5GHz = 0.2 ns/cycle
How long would this program take to execute if the processor was running at a clock frequency of 5GHz?
Example
CS 230 - Spring 2020 3-22
addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI 1 5GHz 7 instr. 6.14 CPI 0.2ns/cycle = 0.2 ns/cycle
How long would this program take to execute if the processor was running at a clock frequency of 5GHz?
Example
CS 230 - Spring 2020 3-23
addi $3, $0, 14 addi $30, $30, -8 sw $3, 0($30) bne $3, $0, x sw $2, 4($30) x: lw $2, 0($30) addi $30, $30, 8 jr $31 7 instructions 6.14 CPI 1 5GHz 7 instr. 6.14 CPI 0.2ns/cycle = 8.6ns = 0.2 ns/cycle
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI?
Try it Yourself
Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2
CS 230 - Spring 2020 3-24
addi $1, $0, 15 addi $2, $1, 3 mult $1, $2 mflo $3 bne $3, $1, x sw $2, 4($8) x: jr $31
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI?
Try it Yourself
Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2
CS 230 - Spring 2020 3-25
addi $1, $0, 15 2 addi $2, $1, 3 2 mult $1, $2 4 mflo $3 2 bne $3, $1, x 6 sw $2, 4($8) x: jr $31 2
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI?
Try it Yourself
Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2
CS 230 - Spring 2020 3-26
addi $1, $0, 15 2 addi $2, $1, 3 2 mult $1, $2 4 mflo $3 2 bne $3, $1, x 6 sw $2, 4($8) x: jr $31 + 2 18 cycles
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI?
Try it Yourself
Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2
CS 230 - Spring 2020 3-27
addi $1, $0, 15 2 1 addi $2, $1, 3 2 100MHz mult $1, $2 4 mflo $3 2 bne $3, $1, x 6 sw $2, 4($8) x: jr $31 + 2 18 cycles = 0.01 μs/cycle
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI?
Try it Yourself
Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2
CS 230 - Spring 2020 3-28
addi $1, $0, 15 2 1 addi $2, $1, 3 2 100MHz mult $1, $2 4 mflo $3 2 0.01μs/cycle 18cycles = 0.18μs bne $3, $1, x 6 sw $2, 4($8) x: jr $31 + 2 18 cycles = 0.01 μs/cycle
Consider the following cycle time table for some ISA: How many cycles does the below program take to execute on a processor built with that ISA? If that processor ran at 100MHz, how long would it take? What is the CPI?
Try it Yourself
Instruction Type Branch Memory Mult/Div Everything Else Cycles 6 9 4 2
CS 230 - Spring 2020 3-29
addi $1, $0, 15 2 1 addi $2, $1, 3 2 100MHz mult $1, $2 4 mflo $3 2 0.01μs/cycle 18cycles = 0.18μs bne $3, $1, x 6 sw $2, 4($8) 18 cycles x: jr $31 + 2 6 instr. 18 cycles = 0.01 μs/cycle = 3 CPI
CS 230 - Spring 2020 3-30
Speedup
How many times faster is some processor than
another processor?
depends on the program
Multiplicative comparison of execution time Example:
processor A takes 10ns to run program X processor B takes 2ns to run program X processor B is = 5 times faster than processor A
for program X.
10 ns 2 ns
CS 230 - Spring 2020 3-31
Try it Yourself
Consider two processors, both running the same program. Which is faster on that program? How much faster? Processor A: cycle time 250ps, CPI = 2.0 Processor B: cycle time 500ps, CPI = 1.2
CS 230 - Spring 2020 3-32
Try it Yourself
Consider two processors, both running the same program. Which is faster on that program? How much faster? Processor A: cycle time 250ps, CPI = 2.0 Processor B: cycle time 500ps, CPI = 1.2
1.2 500ps I 600ps I A Time CPU B Time CPU 600ps I 500ps 1.2 I B Time Cycle B CPI Count n Instructio B Time CPU 500ps I 250ps 2.0 I A Time Cycle A CPI Count n Instructio A Time CPU
CS 230 - Spring 2020 3-33
Try it Yourself
Consider two processors, both running the same program. Which is faster on that program? How much faster? Processor A: cycle time 250ps, CPI = 2.0 Processor B: cycle time 500ps, CPI = 1.2
1.2 500ps I 600ps I A Time CPU B Time CPU 600ps I 500ps 1.2 I B Time Cycle B CPI Count n Instructio B Time CPU 500ps I 250ps 2.0 I A Time Cycle A CPI Count n Instructio A Time CPU
CS 230 - Spring 2020 3-34
Try it Yourself
Consider two processors, both running the same program. Which is faster on that program? How much faster? Processor A: cycle time 250ps, CPI = 2.0 Processor B: cycle time 500ps, CPI = 1.2
1.2 500ps I 600ps I A Time CPU B Time CPU 600ps I 500ps 1.2 I B Time Cycle B CPI Count n Instructio B Time CPU 500ps I 250ps 2.0 I A Time Cycle A CPI Count n Instructio A Time CPU
CS 230 - Spring 2020 3-35
Try it Yourself
Consider two processors, both running the same program. Which is faster on that program? How much faster? Processor A: cycle time 250ps, CPI = 2.0 Processor B: cycle time 500ps, CPI = 1.2
1.2 500ps I 600ps I A Time CPU B Time CPU 600ps I 500ps 1.2 I B Time Cycle B CPI Count n Instructio B Time CPU 500ps I 250ps 2.0 I A Time Cycle A CPI Count n Instructio A Time CPU
CS 230 - Spring 2020 3-36
Try it Yourself
Consider two processors, both running the same program. Which is faster on that program? How much faster? Processor A: cycle time 250ps, CPI = 2.0 Processor B: cycle time 500ps, CPI = 1.2
1.2 500ps I 600ps I A Time CPU B Time CPU 600ps I 500ps 1.2 I B Time Cycle B CPI Count n Instructio B Time CPU 500ps I 250ps 2.0 I A Time Cycle A CPI Count n Instructio A Time CPU
CS 230 - Spring 2020 3-37
Try it Yourself
Consider two processors, both running the same program. Which is faster on that program? How much faster? Processor A: cycle time 250ps, CPI = 2.0 Processor B: cycle time 500ps, CPI = 1.2
1.2 500ps I 600ps I A Time CPU B Time CPU 600ps I 500ps 1.2 I B Time Cycle B CPI Count n Instructio B Time CPU 500ps I 250ps 2.0 I A Time Cycle A CPI Count n Instructio A Time CPU
A is faster… …by this much
CS 230 - Spring 2020 3-38
Performance Summary
Performance depends on
algorithm: affects instruction count, possibly CPI programming language: affects instruction count, CPI compiler: affects instruction count, CPI instruction set architecture: affects instruction count, CPI hardware: affects clock cycle