COIN-OR::LEMON - Graph Library

Changeset 2243:5deb7b22a0ec in lemon-0.x for lemon/time_measure.h


Ignore:
Timestamp:
10/17/06 12:31:20 (13 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2993
Message:

Change for better measurement very fast operations (enable a higher
number of iterations in runningTimeTest())

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/time_measure.h

    r2028 r2243  
    518518 
    519519  template<class F>
    520   TimeStamp runningTimeTest(F f,double min_time=10,int *num = NULL,
     520  TimeStamp runningTimeTest(F f,double min_time=10,unsigned int *num = NULL,
    521521                            TimeStamp *full_time=NULL)
    522522  {
     523    TimeStamp full;
     524    unsigned int total=0;
    523525    Timer t;
    524     TimeStamp full;
    525     int total=0;
    526     for(int tn=1;tn < 1<<30; tn*=2) {
     526    for(unsigned int tn=1;tn <= 1<<31 && full.realTime()<=min_time; tn*=2) {
    527527      for(;total<tn;total++) f();
    528528      full=t;
    529       if(full.realTime()>min_time) {
    530         if(num) *num=total;
    531         if(full_time) *full_time=full;
    532       return full/total;
    533       }
    534     }
    535     return TimeStamp();
     529    }
     530    if(num) *num=total;
     531    if(full_time) *full_time=full;
     532    return full/total;
    536533  }
    537534 
Note: See TracChangeset for help on using the changeset viewer.