test/time_measure_test.cc
author hegyi
Thu, 05 Jan 2006 12:30:09 +0000
changeset 1878 409a31271efd
parent 1847 7cbc12e42482
child 1956 a055123339d5
permissions -rw-r--r--
Several changes. \n If new map is added to mapstorage it emits signal with the name of the new map. This was important, because from now on not only tha mapwin should be updated. \n Furthermore algobox gets a pointer to mapstorage instead of only the mapnames from it. This is important because without it it would be complicated to pass all of the required maps to algobox.
     1 /* -*- C++ -*-
     2  * test/time_measure_test.cc - Part of LEMON, a generic C++ optimization library
     3  *
     4  * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     5  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     6  *
     7  * Permission to use, modify and distribute this software is granted
     8  * provided that this copyright notice appears in all copies. For
     9  * precise terms see the accompanying LICENSE file.
    10  *
    11  * This software is provided "AS IS" with no warranty of any kind,
    12  * express or implied, and with no claim as to its suitability for any
    13  * purpose.
    14  *
    15  */
    16 
    17 #include <lemon/time_measure.h>
    18 
    19 ///\file \brief Test cases for time_measure.h
    20 ///
    21 ///\todo To be extended
    22 
    23 
    24 using namespace lemon;
    25 
    26 void f() 
    27 {
    28   double d=0;
    29   for(int i=0;i<10000;i++)
    30     d+=0.1;
    31 }
    32 
    33 int main()
    34 {
    35   Timer T;
    36   int n;
    37   for(n=0;T.realTime()<1.0;n++) ;
    38   std::cout << T << " (" << n << " time queries)\n";
    39   T.restart();
    40   while(T.realTime()<2.0) ;
    41   std::cout << T << '\n';
    42   TimeStamp full;
    43   TimeStamp t=runningTimeTest(f,1,&n,&full);
    44   std::cout << t << " (" << n << " tests)\n";
    45   std::cout << "Total: " << full << "\n";
    46   
    47   return 0;
    48 }