Embedded Design Handbook

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

4.4.2. Tools

You can use the GNU profiler without making any hardware changes to your Nios® II system. This tool directs the compiler to add calls to profiler library functions into your application code.

The performance counter component and the timestamp component are minimally intrusive hardware methods for measuring the performance of a Nios® II system. This chapter describes and compares the two components. To use these methods, you add the hardware components to your system, and you add macro invocations to your source code to start and stop the components. The hardware components perform the measurements.

Compiler speed optimizations affect functions to widely varying degrees. Compiler size optimizations also affect functions in different ways. These differences impact the cache usage and the resource contention, which can change the relative start times and therefore increase the execution times of functions. For these reasons, you must optimize your code with the -O3 compiler switch, and then perform profiling on the code to gain the most insight on how to improve an application in its final form.

The tutorials use three tools to measure the performance of a Nios® II system, as described in the following sections:

  • GNU Profiler
  • Intel Performance Counter
  • High-Resolution Timer

In addition, the program counter trace collection tool is available for some Nios® II processors. However, the tutorials do not use this tool.

You use the GNU profiler to identify the areas of code that consume the most CPU time, and a performance counter or a timer component to analyze functional bottlenecks.