記錄一些心得。
#include <sys/time.h> #include <stdio.h> int main(){ struct timeval tv1, tv2; gettimeofday(&tv1,NULL); usleep(1000); gettimeofday(&tv2,NULL); printf("Time Cost is %d ms\n", (tv1.tv_sec - tv2.tv_sec) * 1000 ); }
沒有留言:
張貼留言