#include "xtime_l.h"
/* Global Timer is always clocked at half of the CPU frequency */
#define COUNTS_PER_SECOND (XPAR_CPU_CORTEXA9_CORE_CLOCK_FREQ_HZ / 2)
int main() {
XTime tEnd, tCur;
u32 tUsed;
XTime_GetTime(&tCur); //获取开始时间
sleep(1); //
XTime_GetTime(&tEnd); //获取结束时间
tUsed = ((tEnd-tCur)*1000000)/(COUNTS_PER_SECOND); //计算得到计时us
printf("time elapsed is %d us\r\n",tUsed);
return 0;
}