Performance Analysis

A program's instruction mix is 50% integer ALU (CPI 1), 30% loads and stores (CPI 2) and 20% branches (CPI 5). What is the average CPI?

  1. A2.1
  2. B2.67
  3. C8
Show answer and explanation

Answer: A. 2.1

Average CPI is the sum of each instruction class's CPI weighted by its share of the mix: 0.5 × 1 + 0.3 × 2 + 0.2 × 5 = 0.5 + 0.6 + 1.0 = 2.1. Here branches are only 20% of instructions yet account for nearly half the total CPI. Seeing which instruction classes consume the most time points to where improvement should focus.

  • A. Correct. 0.5 × 1 + 0.3 × 2 + 0.2 × 5 = 2.1.
  • B. That simply averages the CPI values without weighting.
  • C. That just adds the CPI values.