測試程序運行時間
精度:us 級別
#include <QDebug>
#include <sys/time.h>
struct timeval tpstart,tpend;
float timeuse;
//獲取start的當前時間
gettimeofday(&tpstart,NULL);
function();//程序
//獲取end的當前時間
gettimeofday(&tpend,NULL);
timeuse=(1000000*(tpend.tv_sec-tpstart.tv_sec) + tpend.tv_usec-tpstart.tv_usec)/1000000.0;
qDebug("Time:%f S", timeuse);