C++ boost类库timer测试程序运行时间

#include <Windows.h>
#include <iostream>
#include <boost/timer.hpp>
using namespace boost;
using namespace std;


int main()
{


 timer tm;

 double sum = 0;
 for (int i=0; i<1000000000; i++)
 {
  sum += i;
 }


 cout << sum << "OK" << endl;


 double duration = tm.elapsed();
 cout << duration << endl;
 int wait;
 cin >> wait;
 return 0;
}

posted @ 2013-06-20 20:40  Predator  阅读(752)  评论(0编辑  收藏  举报