rpistat performance monitoring

Rpistat launches a workload and monitors system activity through the Raspberry Pi (BCM2835) performance counters. Rpistat needs user-space access to the ARM1176JZF-S performance counters. The aprofile kernel module must be loaded before running rpistat. The aprofile kernel module enables user-space access when it is load and disables access when it is unloaded.

Rpistat does not take command line arguments per se. It uses the rest of the command line as the command and arguments to launch the workload via fork/exec.

Rpistat measures nine different ARM1176 performance events. It uses performance counter multiplexing to switch the counters between four event sets. (The processor cycles event is measured by all four sets.) When rpistat switches to a new event set, it accumulates the running event counts for the current set into 64-bit virtual counters, which are maintained in uint64_t variables. It then reconfigures the hardware counters to the new event set.

Rpistat switches to a new event set every 100 milliseconds (the measurement period). Rpistat switches through the four event sets in round-robin fashion until the workload (the child process) terminates. When the workload terminates, rpistat writes raw and scales event counts, rates and ratios to a file named rpistat.txt.

Rpistat keeps track of the number of measurement periods that each event is measured. It uses the period counts to scale the raw counts into full-duty cycle event counts.