Embedded Design Handbook

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

4.4.4.8.4. Performance Counter Example with Nios® II SBT for Eclipse

This section describes how to create and run the profiler_performance_counter software example with the Nios® II SBT for Eclipse.

  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 the <project_directory> directory and selecting the .sopcinfo.
  4. Give your project a name, for example profiler_performance_counter.
  5. Under Templates, select Blank Project.
  6. Click Finish to create your new project.
  7. Locate the <profiler_software_examples> /eclipse_source_files/profiler_performance_counter 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. Set the hal.sys_clk_timer to the peripheral_subsystem_sys_clk_timer component.
  11. Set hal.timestamp_timer to the peripheral_subsystem_high_res_timer component.
  12. Generate your BSP project and exit.
  13. Right click your project in the Project Explorer view, point to Build Project.
  14. To run the profiler_performance_counter software, right click your application project, point to Run As and click Nios® II Hardware.

The figure below shows the Nios® II Console output after running profiler_performance_counter. The data are similar to the command-line example in unresolvable-reference.html#iga1464371381525__fig_zt3_bc3_fw. For more information, refer to “Analyzing the Performance Counter Report”.

Figure 45. Performance Counter Report on Nios® II Console