How to use the CPU Performance (CPI, MIPS, Execution Time) Calculator
- 1. Enter the mixOne instruction class per line: name, count (or percent) and CPI.
- 2. Enter the clockGive the clock rate in GHz or MHz, or the cycle time in ns or ps.
- 3. Compare if neededAdd machine B's clock and CPI to see which is faster and by how much.
The CPU performance equation
CPU time = instruction count × CPI × clock cycle time = instruction count × CPI ÷ clock rate.
With several instruction classes, average CPI = Σ(counti × CPIi) ÷ Σ counti. MIPS = instruction count ÷ (CPU time × 106) = clock rate ÷ (CPI × 106). Performance is 1 ÷ CPU time, so "A is n times faster than B" means timeB ÷ timeA = n.
Worked example (Patterson–Hennessy)
Classes A, B, C have CPI 1, 2 and 3. Code sequence 1 uses 2, 1 and 2 instructions of each class; sequence 2 uses 4, 1 and 1.
- Sequence 1: 2×1 + 1×2 + 2×3 = 10 cycles for 5 instructions, CPI = 2.0.
- Sequence 2: 4×1 + 1×2 + 1×3 = 9 cycles for 6 instructions, CPI = 1.5.
Sequence 2 runs more instructions but is faster. Another example: machine A has a 250 ps cycle and CPI 2.0; B has 500 ps and CPI 1.2. Time A = I × 2.0 × 250 = 500I ps, time B = I × 1.2 × 500 = 600I ps, so A is 1.2 times faster.
Why MIPS can mislead
MIPS ignores how much work each instruction does. A machine with simple instructions may show higher MIPS but need more of them. Always compare CPU time for the same program.
Frequently asked questions
What is CPI?
Clock cycles per instruction: the average number of clock cycles an instruction takes. Lower is better for the same clock and instruction count.
Can I enter percentages instead of counts?
Yes. Choose % of instructions, enter each class's share and the total instruction count.
How do I convert a cycle time to a clock rate?
Clock rate = 1 ÷ cycle time. A 250 ps cycle is 4 GHz; a 2 ns cycle is 500 MHz.