- Increased max. number of iteration
authoralpar
Mon, 06 Feb 2006 09:11:53 +0000
changeset 1960a60b681d0825
parent 1959 264811b995f3
child 1961 8e19ca944727
- Increased max. number of iteration
- Better tests.
lemon/time_measure.h
test/time_measure_test.cc
     1.1 --- a/lemon/time_measure.h	Mon Feb 06 09:10:43 2006 +0000
     1.2 +++ b/lemon/time_measure.h	Mon Feb 06 09:11:53 2006 +0000
     1.3 @@ -515,7 +515,7 @@
     1.4      Timer t;
     1.5      TimeStamp full;
     1.6      int total=0;
     1.7 -    for(int tn=1;tn < 1<<24; tn*=2) {
     1.8 +    for(int tn=1;tn < 1<<30; tn*=2) {
     1.9        for(;total<tn;total++) f();
    1.10        full=t;
    1.11        if(full.realTime()>min_time) {
     2.1 --- a/test/time_measure_test.cc	Mon Feb 06 09:10:43 2006 +0000
     2.2 +++ b/test/time_measure_test.cc	Mon Feb 06 09:11:53 2006 +0000
     2.3 @@ -28,10 +28,19 @@
     2.4  void f() 
     2.5  {
     2.6    double d=0;
     2.7 -  for(int i=0;i<10000;i++)
     2.8 +  for(int i=0;i<1000;i++)
     2.9      d+=0.1;
    2.10  }
    2.11  
    2.12 +void g() 
    2.13 +{
    2.14 +  static Timer T;
    2.15 +  
    2.16 +  double d=0;
    2.17 +  for(int i=0;i<1000;i++)
    2.18 +    TimeStamp x(T);
    2.19 +}
    2.20 +
    2.21  int main()
    2.22  {
    2.23    Timer T;
    2.24 @@ -42,7 +51,12 @@
    2.25    while(T.realTime()<2.0) ;
    2.26    std::cout << T << '\n';
    2.27    TimeStamp full;
    2.28 -  TimeStamp t=runningTimeTest(f,1,&n,&full);
    2.29 +  TimeStamp t;
    2.30 +  t=runningTimeTest(f,1,&n,&full);
    2.31 +  std::cout << t << " (" << n << " tests)\n";
    2.32 +  std::cout << "Total: " << full << "\n";
    2.33 +  
    2.34 +  t=runningTimeTest(g,1,&n,&full);
    2.35    std::cout << t << " (" << n << " tests)\n";
    2.36    std::cout << "Total: " << full << "\n";
    2.37