Main Content

Execution Profiler

Profile execution time of functions using either DWT Timer, GPIO or Timer measurement modes

Since R2025a

  • Execution Profiler Block

Description

The Execution Profile block enables you to profile the execution time of functions using either Data Watchpoint Trace (DWT) Timer, GPIO, or Timer measurement modes.

  • DWT Timer: Measure timing of tasks by recording the cycle count at the start and end of a function.

  • GPIO: Set and clear GPIO pins before and after the execution of downstream function-call subsystems.

  • Timer: Measure execution time of events by calculating the duration between pre-execution and post-execution timer counts.

These techniques enable you to accurately profile and optimize the performance of your code running on STM32 processors.

Examples

Ports

Output

expand all

Connect a function call subsystem to this port. When the subsystem executes, it is profiled using the selected measurement technique.

Displays the execution time in number of cycles.

Dependencies

To enable this port, set the Measurement mode parameter to either Data Watchpoint Trace (DWT) Timer or Timer.

Data Types: uint32

Parameters

expand all

Select the measurement techniques to profile function-call subsystem on the target hardware.

  • Data Watchpoint Trace (DWT) Timer: Measure and analyze the execution times of start-to-end downstream function-call subsystems.

  • Digital Port Write (GPIO): Utilize GPIO pins to set and clear signals before and after executing downstream function-call subsystems.

  • Timer: Use timers to measure execution time by calculating the duration between pre-execution and post-execution timer counts. When you select Timer measurement, Timer 2 is used for timer based profiling.

Specify the GPIO port name for the block.

Dependencies

To enable this parameter, set the Measurement mode parameter to Digital Port Write (GPIO).

Specify the GPIO pin number for the block.

Dependencies

To enable this parameter, set the Measurement mode parameter to Digital Port Write (GPIO).

Select the timer module for the block.

Dependencies

To enable this parameter, set the Measurement mode parameter to Timer.

Sample time at which the Execution Profiler blocks triggers downstream function-call subsystem.

Use this parameter to specify the time interval between 2 function-call triggers. The count data is also updated at the mentioned sample time. To inherit sample time, set this parameter to -1.

Version History

Introduced in R2025a