170 likes | 312 Views
Chapter 2: Performance. CS 447 Jason Bakos. Introduction. Performance measures are important Factors that contribute to performance Instruction utilization in software How well the hardware implements the instructions How well the memory and I/O system perform
E N D
Chapter 2: Performance CS 447 Jason Bakos CS 447
Introduction • Performance measures are important • Factors that contribute to performance • Instruction utilization in software • How well the hardware implements the instructions • How well the memory and I/O system perform • What are the best metrics to use for determining performance? CS 447
Defining Performance • How do we define performance? • response (or execution) time • the time between the start and the finish of a task • throughput • total amount of work done in a given time • Almost just an inverse relationship, but throughput can be increased with parallelism CS 447
Execution Time • For now, we are only concerned with execution Time • For two machines, X and Y… CS 447
Execution Time • If X is n times faster than Y… CS 447
Execution Time • Execution time is measured in seconds • Program execution time – “wall-clock time” to execute a program • CPU execution time – amount of time the CPU spends executing a program (on a time-shared system) • Extra time passes while other programs are being executed • Extra time passes while a program waits for I/O • User CPU time – CPU time spent executing a program • System CPU time – amount of CPU time the operating system spends on behalf of a program • Ex. system calls, such as I/O, synchronization, etc. CS 447
More Terminology • System performance – elapsed time on an unloaded system • CPU performance – CPU time CS 447
Clock Cycles • CPUs use a clock to synchronize events that occur in hardware • Events occur on the rising or falling edge of the clock signal • The clock is a global signal • Has a discrete time intervals called clock cycles • Has cycle time or clock rate (inverses) • Ex. 500MHz or 2 ns • This is the PERIOD of the clock (compare to duty cycle) CS 447
Relating the Metrics • This is why a CPU clock rate doesn’t give a direct indication of CPU performance… CS 447
Example • Our favorite program runs in 10 seconds on computer A, which has a 400 MHz clock. We are trying to help a computer designer build a machine, B, that 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 machine B to require 1.2 times as many clock cycles as machine A for this program. What clock rate should we tell the designer to target? CS 447
Cycles per Instruction • CPI = cycles per instruction • Average number of clock cycles to execute an instruction • For each architecture, different instructions take different amounts of clock cycles to execute • CPI provides one way of comparing two different implementations of the same instruction set architecture • This is because in this case, the instruction count for any given program will be the same CS 447
Basic Peformance Equation (Revisited) • Three key factors that affect performance • Instruction count • CPI • Clock cycle time CS 447
Considerations • We get CPU execution time from running a program • The clock cycle time is published • Instruction count and CPI are more difficult to get • Why is it difficult to get the instruction count? • Some processors actually keep track of this • CPI depends on I/O and memory system • We only need one of these CS 447
More Considerations • Use this equation when there are different classes of instructions that require different numbers of clock cycles CS 447
Benchmarks • Benchmarks are a set of programs that are used to evaluate a machine’s performance • Ex. SPEC95 int/fp benchmarks • Processor companies may target the hot code segments in the benchmarks for optimization in order to make their product look better CS 447
Amdahl’s Law for Improving Performance • Suppose a program runs in 100 seconds on a machine, with multiply operations responsible for 80 seconds of this time • How much do I have to improve the speed of multiplication if I want my program to run five times faster? • Answer? Cannot be done! • Amdahl’s Law dictates that we should make the common case fast… • The opportunity for improvement is affected by how much time the event occurs CS 447
MIPS • There are 3 problems with using MIPS as a measure for comparing machines • MIPS specifies the instruction execution rate but does not take into account the capabilities of the instructions • Affects instruction count • MIPS varies between programs on the same computer! • Depends on average CPI of the instruction mix • MIPS can vary inversely with performance! • This occurs when CPI is higher on a machine with a higher MIPS CS 447