COIN-OR::LEMON - Graph Library

Changeset 2243:5deb7b22a0ec in lemon-0.x


Ignore:
Timestamp:
10/17/06 12:31:20 (18 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())

Files:
2 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 
  • test/time_measure_test.cc

    r1972 r2243  
    4444{
    4545  Timer T;
    46   int n;
     46  unsigned int n;
    4747  for(n=0;T.realTime()<1.0;n++) ;
    4848  std::cout << T << " (" << n << " time queries)\n";
Note: See TracChangeset for help on using the changeset viewer.