Changeset 2243:5deb7b22a0ec in lemon-0.x
- Timestamp:
- 10/17/06 12:31:20 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2993
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/time_measure.h
r2028 r2243 518 518 519 519 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, 521 521 TimeStamp *full_time=NULL) 522 522 { 523 TimeStamp full; 524 unsigned int total=0; 523 525 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) { 527 527 for(;total<tn;total++) f(); 528 528 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; 536 533 } 537 534 -
test/time_measure_test.cc
r1972 r2243 44 44 { 45 45 Timer T; 46 int n;46 unsigned int n; 47 47 for(n=0;T.realTime()<1.0;n++) ; 48 48 std::cout << T << " (" << n << " time queries)\n";
Note: See TracChangeset
for help on using the changeset viewer.