The Formula Toolkit

Memorize every one of these. They are all just ways to compute execution time.

1. Performance & "n times faster"
Performance = 1 / Execution time
X is n× faster than Y ⟶ PerfX/PerfY = TimeY/TimeX = n (the slower machine's time goes on top)
2. Clock
Cycle time (period) T = 1 / F  |  Clock rate F = 1 / T
1 MHz = 10⁶ Hz, 1 GHz = 10⁹ Hz
3. CPU Execution Time — Equation I
CPU time = (CPU clock cycles) × (cycle time) = (CPU clock cycles) / (clock rate)
4. CPI (Cycles Per Instruction)
CPI = total clock cycles / instruction count
Total clock cycles = Instruction count × CPI
5. CPU Execution Time — Equation II (master equation)
CPU time = IC × CPI × T = (IC × CPI) / clock rate
Three levers: instruction count, CPI, clock rate.
6. Weighted / Average CPI
Total cycles = Σ (CPIi × Ci)
Average CPI = Σ (CPIi × Ci) / Σ Ci
With percentages: Average CPI = Σ (fractioni × CPIi)
7. MIPS (Million Instructions Per Second)
MIPS = Instruction count / (Execution time × 10⁶)
⚠ Higher MIPS does NOT always mean faster. Trust execution time.
8. Amdahl's Law
New time = Unaffected + Affected / r  ;  Speedup = Old / New
If fraction f sped up by r:  Speedup = 1 / ((1 − f) + f/r)
Max speedup (r → ∞) = 1 / (1 − f) = Old / Unaffected.  Make the common case fast.
Unit cheat sheet: ps = 10⁻¹² · ns = 10⁻⁹ · µs = 10⁻⁶ · ms = 10⁻³ · MHz = 10⁶ · GHz = 10⁹. If you're given GHz (a rate) divide by it; if given ps/ns (a time) multiply.