Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

4.4.2.1. GNU Profiler

You must make minimal changes to the source code to take measurements for analysis with the GNU profiler. To implement the required changes, follow these steps:

  1. In the Nios® II SBT, enable the GNU profiler in your project by turning on the hal.enable_gprof and hal.enable_exit board support package (BSP) settings.
    Note: If you use the Nios® II SBT for Eclipse, the software enables hal.enable_exit by default.
  2. Verify that your main() function returns.
    Note: When main() calls return() or terminates, alt_main() calls exit() as appropriate for profiling. The exit() function runs the BREAK 2 instruction, which causes the profiling data to write to the gmon.out on the host computer.
  3. Rebuild the BSP and the application project.