1 使能时钟计数功能
在菜单栏
Run->Clock->Enable.
2 设置时钟计数方式
在菜单栏 Run->Clock->Setup. 有两种工作方式手动和自动
3 复位时钟计数为0
双加黄色时钟即可
4 计数方法
To measure cycles between two lines of code using profile clock:
- Set breakpoints at the lines between which you want to measure cycle count
- Run to the first breakpoint
- Double click on the clock to reset its value
- Run to the second breakpoint
- The clock will display the cycle count between those two points in the code
5 转换为所得值
The profile clock displays the direct CPU cycle count, therefore its value must be multiplied by 1/CLK to convert it to seconds.
For example, if the target is running at 300MHz and the Profile clock cycle count for a routine is 1000, then the time consumed by the routine would be:
- 1000 * ( 1/ 300,000,000) = 3.3 μs