Pointer chasing (PMU events)

The program chase measures the elapsed time and key memory-related performance events for a linked list pointer chasing loop. The linked list is laid down in a dynamically allocated, contiguous array. Each linked list item is an ARM11 cache line (32 bytes). The list is traversed multiple times to increase run time. The size of the list (the array) determines the level in the memory hierarchy to be exercised. The user specifies run parameters on the command line including the list length (array size), number of test iterations (traversals) and kind of performance events to be measured.

The program uses the Broadcom BCM2835 (ARM1176) performance counters. The Raspbian Wheezy aprofile kernel module must be loaded before running this program. Otherwise, the instructions that read/write the counters will cause an illegal instruction exception.

Here is the program usage information. Some command line options have not yet been implemented and/or tested on Raspberry Pi (multi-core features).

> ./chase -h
Usage: ./chase
  -a N  Allocate/initialize array on core N
  -c    Measure L1 data cache events
  -d    Display debugging information
  -e    Measure explicit external data access events
  -h    Display usage information
  -i    Measure instruction and cycle events
  -l N  Set the cache line size to N bytes
  -n N  Set the number of tests (iteration count)
  -p N  Perform pointer chasing on core N
  -s N  Allocate an array with N * 1024 elements
  -t    Measure TLB events
  -v    Display more information (verbose output)

The program writes its results to a file named “chase.txt”.