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.

c6678时钟周期与运行时间的关系



我用TSCL测程序运行的时间,大体流程如下:

TSCL = 0;

TSCH = 0;

timeStart = _itoll(TSCH,TSCL);

for(i = 0;i<100000000;i++);

timeEnd = _itoll(TSCH,TSCL);

period= timeEnd - timeStart;

得到 period= 900,000,000,实际运行时间约为10秒,有两个问题:

①我的时钟频率为1GHZ,那么这个时间不是应该约为0.9秒吗?是不是跟仿真器有关啊?我用的XDS100仿真器;

②将这个空循环换为我的一段程序以后,period= 30,000,000左右,可是这段程序实际运行的时间却为40秒以上,请问这和什么因素有关呢?

希望能够得到解答,非常感谢!