blob: d9646d96d499f5ca652c45c3cdcfa5cd462d1a9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
This is a toy program to play with cache line alignment.
The program iterates over a 2D array and modify the elements, and record
the time it takes for the traversal.
Each array row has a tailing padding of OFF*4 bytes (i.e. OFF x sizeof(int)).
The padding elements are NOT traversed, they are only there to make the array
misaligned.
The makefile builds 17x binaries with OFF = 0...16. The testall.sh script
runs each of them 100 times and print the averaged output.
Build:
$make
run:
$sh testall.sh
Play around: change the demensions of the array and the loop operations.
|