%3C/text%3E%3C/svg%3E">
💻
💻 Tech & IT

Cache Average Memory Access Time Calculator

Results update as you type.

Your numbers

Understanding the cache average memory access time calculator — concept and principle

Average memory access time (AMAT) is the expected time for the processor to get a piece of data, taking into account how often each level of the cache hierarchy hits or misses. This calculator handles a two-level cache (L1 and L2) in front of main memory. It is a standard tool in computer-architecture courses and a quick way to see whether improving hit time, miss rate or memory latency matters most.

Average memory access time across cache levelsOf 100 reads all touch L1 at 1 ns, 5 miss to L2 at 4 ns, and 1 of those goes to memory at 80 ns: 200 ns over 100 reads is 2 ns.100 memory reads: where are they served?L11 ns100 reads100 × 1 = 100L24 ns5 reads5 × 4 = 20Memory80 ns1 read1 × 80 = 805% miss20% miss1 + 5% × (4 + 20% × 80)= 1 + 0.05 × 20AMAT = 2 ns(100 + 20 + 80) ns ÷ 100 reads
Rare trips to slow memory still double the average from 1 ns to 2 ns.

How it is calculated

AMAT = L1 hit time + L1 miss rate × (L2 hit time + L2 local miss rate × memory latency).

All times are in nanoseconds; you can also use clock cycles if you are consistent.

The principle

Every access pays the L1 hit time. Only the accesses that miss pay the penalty of going further, and that penalty is itself an average: the L2 hit time plus, for the fraction that also misses in L2, the memory latency. Writing AMAT = hit time + miss rate × miss penalty and substituting the next level's AMAT for the miss penalty gives the recursive formula. The global L2 miss rate, the share of all accesses that go to memory, equals L1 miss rate × L2 local miss rate.

Worked example

  1. Inputs: L1 hit 1 ns, L1 miss rate 5%, L2 hit 4 ns, L2 local miss rate 20%, memory 80 ns.
  2. L2 miss penalty: 0.20 × 80 = 16 ns.
  3. L1 miss penalty: 4 + 16 = 20 ns.
  4. AMAT: 1 + 0.05 × 20 = 1 + 1 = 2 ns.
How AMAT (ns) changes with L1 hit time (ns)How AMAT changes with L1 hit time11.522.530.250.50.7511.251.52Example: 2L1 hit time (ns)
Each point is the calculator re-run with only “L1 hit time (ns)” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
L1 hit time (ns)AMAT (ns)
0.251.25
0.51.5
0.751.75
12
1.252.25
1.52.5
23

How to read the result

An AMAT close to the L1 hit time means the caches are working well. Here half of the 2 ns comes from misses, even though only 1% of accesses (5% × 20%) reach memory, because memory is 80 times slower than L1. To improve AMAT, look for the largest product: reduce the L1 miss rate with better data locality, or reduce the penalty with a larger or faster L2 or an L3.

Common mistakes

Keep in mind: AMAT is an average for a simple blocking model. Out-of-order execution, prefetching, multiple outstanding misses and TLB misses mean real stall time can differ; measure with hardware performance counters for real systems.

Frequently asked questions

What is the difference between local and global miss rate?

The local rate counts misses among accesses that reach that cache; the global rate counts them among all processor accesses.

How do I add an L3 cache?

Replace the memory latency with L3 hit time + L3 local miss rate × memory latency.

Can I calculate in cycles instead of nanoseconds?

Yes. Use cycles for every time input and the result is in cycles; divide by the clock frequency to convert.

Sources: J. L. Hennessy and D. A. Patterson, Computer Architecture: A Quantitative Approach, Morgan Kaufmann, Appendix B (Review of Memory Hierarchy) · D. A. Patterson and J. L. Hennessy, Computer Organization and Design, Morgan Kaufmann, Chapter 5

Checked 8 Nov 2026. Standard formulas and RFC/IEEE definitions, computed locally in your browser — nothing you type is sent anywhere.

💻 All tech & IT tools →🌍 Calculators by country →