Most software developers are used to execution time profiling, where the execution time of different C functions are measured and visualized - usually as bar graphs with timing information added to the bars. But what if you want to measure the execution time of a code-block that is not exactly one complete function - and one function only?
Say, you want to measure the execution time of a block of code (for example, 15 lines of C code) somewhere deep within a function, or the time it takes from a push-button is clicked to some result is achieved. In the first example, you only want to measure the execution time of a small part of a C function, and in the latter example, you want to measure the execution time between two events across many functions. In neither of these cases, traditional execution time profiling is of any help. Luckily, you can easily do this using SWV/ITM tracing on Cortex-M microcontrollers. This free video tutorial show you how!