云起工作室 15711107967
11-boost-timer
2022-10-09 17:14:39

#include <boost/timer.hpp>


timer t;

获取timer 能够表示的最大时间精度

cout << "最大时间" << t.elapsed_max()/3600 << "h" << endl;

获取timer 能够表示的最小时间精度

cout << "最小时间" << t.elapsed_min() << "s " << endl; 打印构造到打印时的时间间隔


cout << "时间流逝" << t.elapsed() << "s" << endl;


#include<Windows.h>

Sleep(2000) 睡眠2秒


#include<boost/progress.hpp>

progress_timer pt; 继承自timer 析构时自动打印时间间隔


以上将启用


cpu_time

#include<boost/timer/timer.hpp>

using namespace boost::timer


auto_cpu_timer 析构时自动打印时间间隔