This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] 【分享】CCS中如何查看程序运行时间

想要在查看一段程序的运行时间,大致有以下几种方法:

1、 最简单的,使用CCS自带的Clock Cycle功能(run->clock->enable, clock 清零,需要CCS5以上版本),以Example_2833xGpioSetup例程为例:

程序从InitSysCtrl()到InitPieCtrl()这段时间花费的Clock Cycle如上图所示。

2、 CCS里面的功能不是很准确,如果只是想确定一段代码的运行时间(绝对值),最准确也是最简单直接的方法是在前后加GPIO翻转,通过示波器量测。

3、 如果是想知道对应CPU时钟,则可以反汇编计算对应的指令周期数。

注:CCS中的clock不准确,指的是程序在FLASH中运行的时候,可能会涉及到flash pipeline,或者在外部ram中运行碰到CPU stall.