Embedded Design Handbook

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

4.4.3.5.2. Profiler Example with Nios® II SBT for Eclipse

Creating and Running the Profiler Software Example

  1. Start the Nios® II SBT for Eclipse.
  2. Under File menu, point to New, and click Nios® II Application and BSP from template.
  3. Set Platform Designer Information File name by browsing to locate the Platform Designer Information File (.sopcinfo) in <project_directory>.
  4. Name your project, such as profiler_gnu.
  5. Under Templates, select Blank Project.
  6. Click Finish to create your new project.
  7. Locate the <profiler_software_examples> /eclipse_source_files/profiler_gnu folder and copy all the files in this directory. In Nios® II SBT for Eclipse, right click on profiler_gnu in Project Explorer view and select Paste.
  8. Right click your project in the Project Explorer view, point to Nios® II and click BSP Editor.
  9. In the Nios® II BSP Editor, turn on hal.enable_gprof to enable the GNU profiler in your project.
  10. Generate your BSP project and exit.
  11. Right click your project in the Project Explorer view and then click Build Project.
  12. To download and run the profiler_gnu software, right click your project, point to Run As, and then click Nios® II Hardware.
    Figure 43.  Nios® II Console After Running profiler_gnu

Viewing the GNU Profiler Report

The software creates the gmon.out in your project folder, which you can view in the Project Explorer view of the Nios® II SBT for Eclipse. If the gmon.out does not appear, right click on your project and select Refresh. When you open gmon.out, the Nios® II SBT for Eclipse switches to the Profiling view, in which you can view the report. For more information about the GNU profiler report, refer to “Analyzing the GNU Profiler Report”.