Skip to main content
CTabo.1
Senior
September 21, 2023
Question

Code performance profiling

  • September 21, 2023
  • 2 replies
  • 3882 views

Hello,
Is there an integrated tool in STM32CubeIDE that I can use to measure how long a block of code lasts?

I was used to use a similar tool on TI CodeComposer, that measured the elapsed clocks from a breakpoint to another.

Thank you,
Carlo

    This topic has been closed for replies.

    2 replies

    TDK
    Super User
    September 21, 2023

    No, there's nothing built in like this in STM32CubeIDE. You can use DWT->CYCCNT on chips that have it to get an idea of code performance, or make your own profiling measurement.

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    CTabo.1
    CTabo.1Author
    Senior
    September 22, 2023

    Hello everyone,

    @TDK 
    I am using a STM32G0x1 and, standing on what is written in the reference manual, this MCU should have the Data Watchpoin Unit. 
    Anyway, if I try to write DWT in the expression window, the symbol is unknown and it seems that is not possible to add watchpoints (the menù entry is disabled).

    CTabo1_0-1695380055482.png

    @unknown 
    If I right-click on a breakpoint, the "Profile Instruction Counter" option isn't present in the context menù.

    CTabo1_1-1695380538419.png

    Could it be that "Profile Instruction Counter" is an external plug-in or that my IDE version (v.1.11.2) is too old?
    Or that "Profile Instruction Counter" is a watchpoint context menu option, instead of a breakpoint one?

    Thank you,
    Carlo