[BOOST]学习使用点滴-2-Timer库

王朝other·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

#include <iostream>

#include <string>

#include <cstdlib>

#include <boost/progress.hpp>

using namespace std;

using boost::progress_timer;

using boost::progress_display;

using boost::timer;

int main()

{

timer *t=new timer();

//新建一个timer类

//t->elapsed_max() 最大时长,约590小时

//t->elapsed() 最小精度,约0.001妙

//t->elapsed_min() 生存时长

progress_timer *pt=new progress_timer();

//新建一个progress_timer类,直接delele t的时候打印生存时间(S).

progress_display show_progress(1000000);

//新建一个progress_display类,++show_progress的时候打印%比

for(int i=0 ; i<=1000000 ; i++)

{

if((i % 1000)==0) for(int j=0 ; j<=10000000 ; j++){}

++show_progress;

}

cout <<" "<<t->elapsed_max()<<" "<<t->elapsed_min() <<" "<<t->elapsed();

delete t;

delete pt;

return 0;

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航