lemon/time_measure.h
changeset 2243 5deb7b22a0ec
parent 2028 d0e8a86a1ff2
child 2250 b8fbffd35445
     1.1 --- a/lemon/time_measure.h	Sat Oct 14 15:26:05 2006 +0000
     1.2 +++ b/lemon/time_measure.h	Tue Oct 17 10:31:20 2006 +0000
     1.3 @@ -517,22 +517,19 @@
     1.4    ///\return The average running time of \c f.
     1.5    
     1.6    template<class F>
     1.7 -  TimeStamp runningTimeTest(F f,double min_time=10,int *num = NULL,
     1.8 +  TimeStamp runningTimeTest(F f,double min_time=10,unsigned int *num = NULL,
     1.9                              TimeStamp *full_time=NULL)
    1.10    {
    1.11 +    TimeStamp full;
    1.12 +    unsigned int total=0;
    1.13      Timer t;
    1.14 -    TimeStamp full;
    1.15 -    int total=0;
    1.16 -    for(int tn=1;tn < 1<<30; tn*=2) {
    1.17 +    for(unsigned int tn=1;tn <= 1<<31 && full.realTime()<=min_time; tn*=2) {
    1.18        for(;total<tn;total++) f();
    1.19        full=t;
    1.20 -      if(full.realTime()>min_time) {
    1.21 -	if(num) *num=total;
    1.22 -	if(full_time) *full_time=full;
    1.23 -      return full/total;
    1.24 -      }
    1.25      }
    1.26 -    return TimeStamp();
    1.27 +    if(num) *num=total;
    1.28 +    if(full_time) *full_time=full;
    1.29 +    return full/total;
    1.30    }
    1.31    
    1.32    /// @}