inputsh
Posts: 1
Joined: Wed Aug 05, 2020 2:27 pm

Using Perf in C on RPi3

Wed Aug 05, 2020 2:38 pm

Hello.
I am using Raspbian on RPi3 model B.
I was troubled with the OS bulletin board, but I wrote it here since it is C code. :roll:

I want to get the hardware information of PMU in C language. I wrote the necessary code

1) I want to import the CPU cycle, but in the Cortex A53 reference manual, the PMU event number is 0x11.
On the Linux kernel, the index is matched to PERF_COUNT_HW_BUS_CYCLES.
(https://github.com/raspberrypi/linux/bl ... event_v7.c)

In the kernel code, the CPU cycle matches ARMV7_PERFCTR_CPU_CYCLES(0x55), but the index is not listed in the reference manual.

Can I use 0x55?

2) I want to get MEM_ACCESS (0x13) PMU count, but it is not registered in perf of kernel code. It is defined as ARMV7_PERFCTR_MEM_ACCESS, but it is not mapped to perf. Is there any other way?

Regards.

Return to “C/C++”