CPU Performance Numericals for GATE: CPI, MIPS and Amdahl's Law Solved

Build every CPU performance answer from one equation. Then use it to solve weighted CPI, execution time, MIPS and Amdahl speedup without mixing the units.

KnowledgeGate Team

Exam prep & CS education

Updated 17 Aug 20266 min read

The CPU performance equation is short, but its questions punish one careless substitution. Students mix instruction count with cycle count, treat MIPS as execution speed, or put the enhanced fraction into Amdahl's law backwards.

The fix is to return to one identity, keep the units beside every value, and calculate in a fixed order. That identity is CPU time = instruction count x average CPI x clock cycle time. Weighted CPI supplies its middle term, MIPS is the same identity rearranged, and Amdahl's law divides the time it produces into an affected part and an unaffected one.

1. The one CPU performance equation everything hangs off

For one program running on one processor:

CPU time = Instruction count x Average CPI x Clock cycle time

Since clock cycle time is the reciprocal of clock rate:

CPU time = (Instruction count x Average CPI) / Clock rate

The three quantities describe different parts of the system:

  • Instruction count depends mainly on the program, compiler and instruction set.

  • CPI, or cycles per instruction, depends on the instruction mix and microarchitecture.

  • Clock rate tells you how many cycles the processor can complete per second.

Do not cancel a term just because two processors run the same source program. A new compiler or instruction set can change the instruction count. A new pipeline or cache can change CPI. A higher clock rate reduces cycle time, but it does not guarantee a lower CPI.

A useful unit check is:

instructions x cycles/instruction x seconds/cycle = seconds

If your units do not collapse to seconds, the setup is wrong.

2. Weighted average CPI from an instruction mix

Different instruction classes can take different numbers of cycles. The CPI used in the performance equation is therefore a weighted average:

Average CPI = sum of (instruction-class fraction x class CPI)

Take this instruction mix:

Instruction class

Fraction

Class CPI

CPI contribution

ALU

0.50

1

0.50 x 1 = 0.50

Load/Store

0.30

4

0.30 x 4 = 1.20

Branch

0.20

2

0.20 x 2 = 0.40

First check that the fractions add to 1:

0.50 + 0.30 + 0.20 = 1.00

Now add the weighted contributions:

Average CPI = 0.50 + 1.20 + 0.40 = 2.10

Notice that Load/Store instructions are only 30% of the mix but contribute 1.20 of the total 2.10 CPI. That is why a costly instruction class can be an important optimisation target even when it is not the most frequent class. This same idea sits behind the CPI changes discussed in Pipelining in Computer Architecture.

Stacked bar of weighted CPI contributions from ALU, Load/Store and Branch summing to average CPI 2.10.

3. Worked example: CPU time and MIPS

Continue with average CPI 2.10. Suppose the program executes 10^9 instructions on a processor with a 2 GHz clock.

Convert the clock rate first:

2 GHz = 2 x 10^9 cycles/second

Now substitute into the CPU-time equation:

CPU time = (10^9 instructions x 2.10 cycles/instruction) / (2 x 10^9 cycles/second)

CPU time = 2.10 / 2 seconds = 1.05 seconds

The powers of ten cancel cleanly. You can verify the answer another way. The program needs 2.10 x 10^9 cycles, and the processor supplies 2 x 10^9 cycles each second. Dividing gives the same 1.05 seconds.

MIPS means millions of instructions per second:

MIPS = Clock rate / (Average CPI x 10^6)

For this processor:

MIPS = (2 x 10^9) / (2.10 x 10^6)

MIPS = 2000 / 2.10 = 952.38, or about 952.4 MIPS.

Check it from the completed program: 10^9 instructions divided by 1.05 seconds is about 952.4 x 10^6 instructions per second. Both routes agree.

MIPS is still a poor metric for comparing different instruction sets because it hides instruction count. A machine can execute more simple instructions per second and still take longer to finish the same job. Use CPU time for the final comparison.

4. Amdahl's law and the speedup ceiling

Amdahl's law asks how much the whole program improves when only one part becomes faster:

Overall speedup = 1 / ((1 - f) + f/s)

Here f is the fraction of the original execution time affected by the improvement, and s is the speedup of that part.

Suppose a routine originally consumes 30% of execution time and is made four times as fast. Then f = 0.30 and s = 4.

Keep the unaffected and enhanced parts separate:

New normalised time = (1 - 0.30) + 0.30/4

New normalised time = 0.70 + 0.075 = 0.775

Overall speedup = 1/0.775 = 1.2903

So the program becomes about 1.29 times as fast, not four times as fast.

There is also a hard ceiling. Even if the enhanced part became infinitely fast, the unaffected 70% would remain:

Maximum speedup = 1/(1 - f) = 1/0.70 = 1.4286

The maximum is therefore about 1.43x. No improvement confined to that 30% can cross it. Memory delays can create a similar ceiling, which is why Cache Write Policies and Multi-Level Cache Numericals for GATE is a useful next numerical topic.

Time bars comparing original 100 units with improved 77.5 units, a 1.29x speedup under the 1.43x ceiling.

5. Traps GATE plants in CPU performance questions

  • Amdahl's f is a fraction of original time, not automatically a fraction of instructions. Convert instruction counts to cycle or time contributions when CPIs differ.

  • CPU time is inversely proportional to clock rate. Doubling the clock rate halves CPU time only if instruction count and CPI stay unchanged.

  • MIPS uses average CPI. Substituting the CPI of one instruction class gives the wrong rate.

  • “30% faster” means a speedup factor of 1.30. “Four times as fast” means a speedup factor of 4.

  • Clock period is 1/clock rate. A 2 GHz clock has a period of 0.5 ns, since 1/(2 x 10^9) s = 0.5 x 10^-9 s.

  • Performance and execution time are reciprocals. If machine A takes 8 seconds and B takes 10 seconds, A is 10/8 = 1.25x as fast as B.

6. How GATE tests these equations

Typical questions ask for average CPI from a mix, execution time, speedup between two designs, MIPS, or an Amdahl ceiling. The two-design comparison is where MIPS does the most damage, so work one through. Both processors below run the same job on a 2 GHz clock.

Design A executes 5 x 10^9 instructions at an average CPI of 1.0. Design B executes 2 x 10^9 instructions at an average CPI of 2.0. Take execution time first:

A: (5 x 10^9 x 1.0) / (2 x 10^9) = 2.5 seconds

B: (2 x 10^9 x 2.0) / (2 x 10^9) = 2.0 seconds

Now the MIPS ratings, from the same formula used above:

A: (2 x 10^9) / (1.0 x 10^6) = 2000 MIPS

B: (2 x 10^9) / (2.0 x 10^6) = 1000 MIPS

Design A rates twice the MIPS of Design B and still finishes half a second later. Judged on execution time, B is 2.5/2.0 = 1.25 times as fast. That reversal is why the final comparison always belongs to CPU time.

More than 1,700 Computer Organization questions in the KnowledgeGate question bank cover these performance-equation and speedup shapes, so practise the setup as well as the arithmetic.

The equations are stable. Subject weightage and paper details can change, so confirm those on the official GATE portal rather than carrying an old number into a new attempt.

7. Short version and next step

Write CPU time = IC x CPI / clock rate first. Build average CPI from weighted contributions, judge processors by execution time rather than MIPS alone, and give Amdahl the original time fraction.

Now make the setup automatic. Use a timed Computer Organization set in the GATE Test Series, revisit the wider derivations in GATE Guidance by Sanchit Sir, and use the GATE preparation category to connect this numerical with the rest of Computer Architecture.