This application note describes how to use PMU hardware events of ARM architecture on HiKey960.
Written by: Jumana MP Jumana.MP@arm.com
CONFIG_HW_PERF_EVENTSmust be enabled in the kernel config when you build the kernel.
- Add dts node for armv8 pmu. Example for v4.4 kernel can be found here. You can do similar for other kernel versions.
For testing, get
perf binary for ARM on the target device. Perf binary can be obtained from: https://github.com/ARM-software/workload-automation/tree/master/wlauto/instrumentation/perf/bin
Example test would be checking if PMU events get counted on the device. To make sure that kernel supports generating perf data, run the following on the device as root:
echo -1 > /proc/sys/kernel/perf_event_paranoid echo 0 > /proc/sys/kernel/kptr_restrict
perf from device at the location where perf is copied to:
perf stat -a -e r8,r11 sleep 10 r8 is the PMU event for INSTRUCTION COUNT and r11 is the hardware event for CPU_CYCLES on ARM CPUs.
This should give the event count numbers once perf run finishes. Expected output gives the counters if the patch is applied correctly, as shown below:
Performance counter stats for ‘system wide’:
21663586606 r8 14839358570 r11