Linux perf tools on ARM64
Kai Wolf 26 May 2020
For a current client project I need to get a thorough understanding of the performance bottlenecks for several target architectures, including ARM64. For this, I’ve already ordered an ODROID-C2 development board. This is currently the only ARM64 development board available that also supports Android as far as I am aware.
When doing a performance analysis (especially under Linux) I really like using perf as it supports a wide range of options such as hw/sw performance counters and has several useful subcommands. However, getting perf to run on a host system also requires the kernel sources as perf will emit a warning in any other case. Usually this can be achieved by simply fetching the sources for the current kernel by using a package manager such as apt:
In the case of ODROID-C2 things are a bit more complicated, which is the main motivation for this blog post. First of all, the kernel for this board is quite old (August 2014). Hence, we probably won’t find the kernel sources from within the package sources of our distribution, which turned out to be the case. In this case, we need to fetch the original sources provided by ODROID and also checkout the correct branch for the current version of this dev board:
If we change into the subdirectory of perf from within the kernel sources and try to compile the correct version ourselves, we receive another error though:
As already mentioned, this board is using a rather old kernel version. Thus, we need to fix this error ourselves by adding another define
Afterwards perf can be compiled with a simple make && make install and we should be good to go.
I’m also available for software consultancy, training and mentoring. Please contact me, if you are interested in my services.