→ leslieha:clock_gettime 就可以了 (自問自答) 01/09 16:00
計算執行時間
clock_t t1, t2;
double diff;
t1 = clock();
funciton();
t2 = clock();
diff = (double)(t2 - t1)/CLOCL_PER_SEC;
精準度可到 msec
windows 有
QueryPerfromance
得到CPU clock數 以及 CPU的頻率
精準可以到 0.xxxxxx msec
想請問
UNIX有其它計算時間的函式
可以到 usec 或是 nsec的嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.129.36.80