Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ch4a- 2 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Performance What differences do we see in performance? Almost all computers.

Similar presentations


Presentation on theme: "Ch4a- 2 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Performance What differences do we see in performance? Almost all computers."— Presentation transcript:

1

2 Ch4a- 2 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Performance What differences do we see in performance? Almost all computers operate correctly (within reason) Most computers implement useful operations This is a matter of taste... Computers all operate at different speeds Speed is the most important performance metric The entire point of computer hardware is to “perform” Operate correctly Implement useful operations Do so as fast as possible

3 Ch4a- 3 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Measuring speed Raw speed Ferrari wins Which is faster? School Bus: 57 MPH, 40 people Ferrari: 170 MPH, 2 people Throughput Ferrari: 340 passenger- MPH School Bus: 2280 passenger-MPH Other issues... Range, reliability, cost

4 Ch4a- 4 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Performance of computers How long does it take to run my favorite program? To compare two computers, we compare the execution time of the same program on the two computers Faster one wins Lower execution time is better Batch throughput Response time

5 Ch4a- 5 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University A little background... The compiler converts this code into machine- language instructions Computer programs are (usually) written in a high- level language (e.g. C) The performance of a program depends on: The number and types of instructions executed How fast the CPU can execute those instructions The CPU interprets machine-language instructions and executes them

6 Ch4a- 6 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Tick-tock Almost all modern computers are based on a clock Period All events are controlled by and synchronized to a regular clock Clocks are just regular periodic waveforms Cycle time: time for the waveform to repeat itself Also known as the clock period Frequency: 1/Period Example: 10ns clock cycle --> period = 10 -8 s Frequency 1/10ns = 1/10 -8 s = 10 8 cycles/sec

7 Ch4a- 7 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Execution time Performance can be improved by: Decreasing the cycle time Hardware solution: Use faster technology Decreasing the number of cycles for the program Software: Write a better program Hardware: Re-design CPU Time = cycles * cycle time Time = cycles / clock frequency Since the cycle time of a computer is constant, we can express time in terms of CPU cycles

8 Ch4a- 8 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Instruction execution time Every instruction takes time to execute Some instructions may take more or less time than others The time for an instruction is expressed in terms of clock cycles InstructionCycles ADD1 MULT4 CMP1 SUB2 Example: The time to run a program depends on: How many instructions What type of instructions 30 ADDs and 4 MULTs --> 46 cycles

9 Ch4a- 9 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Average CPI The Cycles-Per-Instruction (CPI) varies depending on what instructions are used Take an Average CPI Cycles = Number of Instructions * Average CPI Average CPI should reflect the mix of instructions in the program A large proportion of 4-cycle MULTs should raise the CPI, a large proportion of 1-cycle ADDs should lower it The average should be the weighted average

10 Ch4a- 10 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Weighting the average InstructionCycles% ADD140 MULT410 CMP120 SUB230 Average CPI = 1 * 40% + 4 * 10% + 1 * 20% + 2 * 30% =.4 +.4 +.2 +.6 = 1.6 Average CPI = 1 * 40% + 4 * 10% + 1 * 20% + 2 * 30% =.4 +.4 +.2 +.6 = 1.6 Notice: The average CPI depends on the code we’re executing! Example mix of instructions

11 Ch4a- 11 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University How long? Remember, lower is better Reducing any one of the three components reduces execution time Execution time = Cycles * Cycle Time Cycles = Average CPI * Instruction Count Execution time = Instruction Count * CPI * Cycle Time Cycle time - Reduced through technology change, change in CPU design CPI - Reduced through better code, better compiler, change in CPU design Instruction count - Reduced through better code, better compiler, change in CPU design

12 Ch4a- 12 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Examples  Time = CPI x Period x Instructions = 1.10 x 22ns x 4 x 10 8 = 9.68s System A: 400,000,000 instr., 22ns clock and a CPI of 1.10. How long does it take to run the program on system A? System B: 10s to run a program, 20ns clock, 400,000,000 instr. What is the CPI?  CPI = Time / (Period x Instr C ) = 10s / (20 x 10 -9 x 4 x 10 8 ) = 1.25 System C: 3,000,000,000 instr., 2GHz clock and a CPI of 1.25. How long does it take to run the program on system C?  Period = 1/Frequency = 1/2GHz = 0.5ns = 0.5 x 10 -9  Time = CPI x Period x Instructions = 1.25 x 0.5 x 10 -9 x 3 x 10 9 = 1.875s

13 Ch4a- 13 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Examples Assume an add takes 1 cycle, a mult 4 cycles, and a sub 2 cycles Two different compilers produce the following loops for the same code: add add mult sub add add mult add mult sub A:B: loop 1000000 times What’s the CPI? CPI A = (4 + 1 + 4 + 2)/4 = 2.75 CPI B = (1 + 1 + 4 + 2 + 1 + 1)/6 = 1.667 How long does it take to run each program on a 200MHz CPU? Time A = CPI A x Period A x Instructions A = 2.75 x 5ns x 4000000 =.0055s Time B = CPI B x Period B x Instructions B = 1.667 x 5ns x 6000000 =.0050s


Download ppt "Ch4a- 2 EE/CS/CPE 3760 - Computer Organization  Seattle Pacific University Performance What differences do we see in performance? Almost all computers."

Similar presentations


Ads by Google