cancel
Showing results for 
Search instead for 
Did you mean: 

Code performance profiling

CTabo.1
Senior

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

2 REPLIES 2
TDK
Guru

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
Senior

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

@davidlora 
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