#include <pcl/console/time.h>
int main()
{
pcl::console::TicToc tt;
tt.tic();
.........................
....................
std::cout << "[time: " << tt.toc() << " ms ]" << std::endl;
}
第二种方法:
#include <ctime>
int main(int argc, char** argv)
{
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;
}