Computer Systems Lecture 14 Performance Measures CS 230 - Spring - - PowerPoint PPT Presentation

computer systems
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

CS 230 - Spring 2020 3-1

CS 230 – Introduction to Computers and Computer Systems Lecture 14 – Performance Measures

slide-2
SLIDE 2

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

slide-3
SLIDE 3

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

slide-4
SLIDE 4

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

slide-5
SLIDE 5

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

slide-6
SLIDE 6

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

slide-7
SLIDE 7

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

slide-8
SLIDE 8

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

slide-9
SLIDE 9

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

slide-10
SLIDE 10

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

slide-11
SLIDE 11

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

slide-12
SLIDE 12

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

slide-13
SLIDE 13

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

slide-14
SLIDE 14

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

slide-15
SLIDE 15

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

slide-16
SLIDE 16

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

slide-17
SLIDE 17

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

slide-18
SLIDE 18

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

slide-19
SLIDE 19

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

slide-20
SLIDE 20

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

slide-21
SLIDE 21

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

slide-22
SLIDE 22

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

slide-23
SLIDE 23

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

slide-24
SLIDE 24

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

slide-25
SLIDE 25

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

slide-26
SLIDE 26

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

slide-27
SLIDE 27

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

slide-28
SLIDE 28

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

slide-29
SLIDE 29

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

slide-30
SLIDE 30

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

slide-31
SLIDE 31

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

slide-32
SLIDE 32

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                    

slide-33
SLIDE 33

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                    

slide-34
SLIDE 34

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                    

slide-35
SLIDE 35

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                    

slide-36
SLIDE 36

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                    

slide-37
SLIDE 37

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

slide-38
SLIDE 38

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