#inlcude<sys/time.h>
struct timval tv_begin,tv_end;
UINT32 ulTime1 = 0,ulTime2 =0;
gettimeofday(&tv_begin,NULL);
code
gettimeofday(&tv_end,NULL);
ulTime1 = tv_end.tv_tv_sec*1000 + tv_end.tv_usec/1000;//毫秒
ulTime2 = tv_begin.tv_tv_sec*1000 + tv_begin.tv_usec/1000;//毫秒
printf("Used Time: %d\n",ulTime1-ulTime2);