How to measure
Do not guess. Wall time (monotonic clock) vs CPU time (clock/getrusage): waiting is wall without CPU; threads can make CPU > wall. Repeat, report min/median, drop warm-up. Profilers find the hotspot; rdcycle/rdinstret give cycles and CPI.
Worked example (simulated). A fully associative cache of 8 KiB with 128-byte lines, 64 lines in all, and n=128, so that one column of BBB touches 128 lines and cannot stay. The Code section’s simulator counts the misses per multiply-add: 1.070 for i, j, k, 0.0635 for i, k, j (the 1/161/161/16 of row kkk of BBB), and 0.0083 for blocks of b=16. The blocked count has a short explanation: for one block of AAA, all n/bn/bn/b blocks of BBB and CCC in its row pass through the cache while the block of AAA stays, so each b3b^3b3 multiply-adds load two blocks of b2/16b^2/16b2/16 lines, 2/(16b)=0.00782/(16b) = 0.00782/(16b)=0.0078 misses per multiply-add. With b=32 three blocks need 24 KiB, more than the cache, and the count jumps back to 0.066.
Worked example. Suppose a program spends 3.871 s in the baseline matrix product and 1 s on everything else (a hypothetical figure). Then f=3.871/4.871=0.795f = 3.871/4.871 = 0.795f=3.871/4.871=0.795. Replacing the product by the blocked -O2 version makes that part s=3.871/0.147=26.3s = 3.871/0.147 = 26.3s=3.871/0.147=26.3 times faster, and the whole program