Embedded Design Handbook

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

4.4.2.2. Intel Performance Counter

A performance counter is a block of counters in the hardware that measures the execution time of the code sections that you choose. A performance counter component can track up to seven code sections. By default, the component tracks three code sections. A pair of counters tracks each code section:

  • Time—A 64-bit time (clock tick) counter that counts the number of clock ticks during code section runs.
  • Occurrences—A 32-bit event counter that counts the number of times the code section runs.
Note: You can change the maximum number of measured code sections by editing the performance counter component in Platform Designer.

These counters enable you to measure the execution time of the designated sections of C/C++ code. Macros enable you to mark the start and the end of the code sections in your program. The performance counter component has up to seven pairs of counters, supporting as many as seven measured sections of C/C++ code. You must add macros to your code at the start and end of each measured section. An additional, built-in pair of counters aggregates the individual code section counters, enabling you to measure each section as a fraction of a larger program.

You can use performance counters for analyzing determinism and other runtime issues.

Note: The performance counter component occupies a substantial number of logic elements (LEs) on your device, and requires software implementation to obtain performance measurements.