test/time_measure_test.cc
changeset 1741 7a98fe2ed989
parent 1435 8e85e6bbefdf
child 1847 7cbc12e42482
equal deleted inserted replaced
0:e9a44e0b3561 1:ef8addc98f5a
    21 ///\todo To be extended
    21 ///\todo To be extended
    22 
    22 
    23 
    23 
    24 using namespace lemon;
    24 using namespace lemon;
    25 
    25 
       
    26 void f() 
       
    27 {
       
    28   double d=0;
       
    29   for(int i=0;i<10000;i++)
       
    30     d+=0.1;
       
    31 }
       
    32 
    26 int main()
    33 int main()
    27 {
    34 {
    28   Timer T;
    35   Timer T;
    29   while(T.getRealTime()<1.0) ;
    36   int n;
       
    37   for(n=0;T.realTime()<1.0;n++) ;
       
    38   std::cout << T << " (" << n << " time queries)\n";
       
    39   T.reset();
       
    40   while(T.realTime()<2.0) ;
    30   std::cout << T << '\n';
    41   std::cout << T << '\n';
    31   T.reset();
    42   TimeStamp full;
    32   while(T.getRealTime()<2.0) ;
    43   TimeStamp t=runningTimeTest(f,1,&n,&full);
    33   std::cout << T << '\n';
    44   std::cout << t << " (" << n << " tests)\n";
       
    45   std::cout << "Total: " << full << "\n";
    34   
    46   
    35   return 0;
    47   return 0;
    36 }
    48 }