In many real-time applications, the CPU can spend 95% (or more) of its time in less than 5% of the code. This is the case for motor control, engine control, wireless communications and many other time-sensitive applications.
These embedded systems are typically written in C, and often developers are forced to hand-optimize the code, possibly reverting to assembly language, to meet tight deadlines.
Measuring the actual execution time of portions of code can help you find the hot-spots in your code. This article will show how you can easily measure and display the execution time of code on live Cortex-M-based MCUs.