How to use the Arm Performance Monitoring Unit and System Counter
Introduction
Counter access options
Use a system counter
Use PAPI for counting
Use perf_event_open for counting
Next Steps
How to use the Arm Performance Monitoring Unit and System Counter
Review frequently asked questions
These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
The program should report a positive difference in system counter ticks between the two reads that bracket the target function. A zero or negative value usually means the reads are not placed correctly around the region being measured.
Use
MRS to read a system register and MSR to write a system register. These two instructions are sufficient for the system counter example.Set
PAPI_DIR to the location where PAPI is installed. Depending on your system, you might also need LD_LIBRARY_PATH to include $PAPI_DIR/lib.Run the
sudo command in the steps that writes the recommended value to the file under /proc/sys/kernel. This enables user-space access to the counters for the examples.Use the group example to read several counters together without multiplexing. The single-counter example configures just one event, and
perf_event_open in this Learning Path does not support multiplexing.