用PCL处理点云数据时,由于数据量太大,为了方便选择最佳算法与参数,需要进行计时。本文用https://www.cnblogs.com/21207-iHome/p/6103354.html#undefined代码中的计时算法试验了,很准,也很方便。
#include <ctime> int main() { srand(time(NULL)); //seeds rand() with the system time time_t begin, end; begin = clock(); //开始计时 //------------------------------------------------------------------------------- 中间是自己的代码 //-------------------------------------------------------------------------------------------- end = clock(); //结束计时 double Times = double(end - begin) / CLOCKS_PER_SEC; //将clock()函数的结果转化为以秒为单位的量 std::cout << "time: " << Times << "s" << std::endl; return 0; }