Xilinx SDK获取代码运行时间
一、API
- 头文件 “xtime_l.h”
- 函数XTime_GetTime(XTime * xtime),获取周期数
- 时钟频率宏 COUNTS_PER_SECOND
二、使用
#include "xtime_l.h"int main(){XTime tBegin, tEnd;unsigned int t_us;unsigned long long cycles;XTime_GetTime(&tBegin);/*do something*/XTime_GetTime(&tEnd);cycles = tEnd - tBegin;t_us = ( cycles * 1000000 ) / COUNTS_PER_SECOND;
}
COUNTS_PER_SECOND
是使用的计数时钟的频率XTime_GetTime()
读取计数器的时钟节拍数