Introduction to backtraces in Arm Code Advisor

Collecting backtrace information with Arm Code Advisor. The information in this topic is for an experimental feature, that is a feature under development which has undergone limited testing.

This optional feature within Arm Code Advisor enables you to collect additional backtrace information for each sample when running armcadvisor collect.

Collecting additional backtrace information allows you to identify where hot functions are called from, at almost no additional run-time cost. For example, it is useful to identify where hot functions that cannot be changed are being called, such as the malloc or memcpy C library functions.

Collecting backtrace information with Arm Code Advisor

To collect backtrace information using Arm Code Advisor:

  1. Compile your program with insights enabled.
  2. Enable the collection of backtrace information using the -b flag when gathering dynamic performance information with Arm Code Advisor:

    armcadvisor collect -b -- ./program
  3. Analyze the insights together with the performance data using armcadvisor analyze, using:
    armcadvisor analyze --redist-bin-samples <library_name>
    The --redist-bin-samples flag will attribute all the samples in <library_name> to the caller’s binary, giving an accurate report on the hotness of functions.

For more information on using Arm Code Advisor see the Getting Started with Arm Code Advisor tutorial.

Running notes

Points to note about using the backtrace feature in Arm Code Advisor:

  • Backtrace data is not collected by default, it needs to be enabled using the command line flag or through changing the default options in the configuration file. For more information on configuring Arm Code Advisor, see Configuring Arm Code Advisor.
  • Backtrace collection is not yet compatible with binaries incorporating emulated architectural features such as SVE. Attempting to collect the backtrace information of an SVE binary will cause an error to be produced and the run to abort.
  • Backtraces will only be accurate if a program is compiled with frame pointers. For example, C programs compiled omitting frame pointers by using the flag "-fomit-frame-pointer" will be unreliable and are not advised.
  • Backtrace collection will involve writing more data to disk, both in temporary files and in the resulting advice file. The size of these files will depend on the number of frames contained in the backtrace.

Related Topics