计算程序运行时间
方法一:
方法二:
方法一:
int64 now,then;
double elapsed_seconds, tickspersecond=cvGetTickFrequency() * 1.0e6;
while(1) {
then = cvGetTickCount();
doSomeStuff();
now = cvGetTickCount();
elapsed_seconds = (double)(now - then) / tickspersecond;
cout<<"运行时间为:"<<elapsed_seconds<<"秒"<<endl;
}方法二:
double time0 = static_cast<double>(getTickCount());
doSomeStuff();
time0 = ((double)getTickCount() - time0)/getTickFrequency();
cout<<"运行时间为:"<<time0<<"秒"<<endl;


被折叠的 条评论
为什么被折叠?



