equal
deleted
inserted
replaced
515 ///\retval full_time if it is not \c NULL, then the actual |
515 ///\retval full_time if it is not \c NULL, then the actual |
516 /// total running time will be written into <tt>*full_time</tt>. |
516 /// total running time will be written into <tt>*full_time</tt>. |
517 ///\return The average running time of \c f. |
517 ///\return The average running time of \c f. |
518 |
518 |
519 template<class F> |
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 TimeStamp *full_time=NULL) |
521 TimeStamp *full_time=NULL) |
522 { |
522 { |
|
523 TimeStamp full; |
|
524 unsigned int total=0; |
523 Timer t; |
525 Timer t; |
524 TimeStamp full; |
526 for(unsigned int tn=1;tn <= 1<<31 && full.realTime()<=min_time; tn*=2) { |
525 int total=0; |
|
526 for(int tn=1;tn < 1<<30; tn*=2) { |
|
527 for(;total<tn;total++) f(); |
527 for(;total<tn;total++) f(); |
528 full=t; |
528 full=t; |
529 if(full.realTime()>min_time) { |
529 } |
530 if(num) *num=total; |
530 if(num) *num=total; |
531 if(full_time) *full_time=full; |
531 if(full_time) *full_time=full; |
532 return full/total; |
532 return full/total; |
533 } |
|
534 } |
|
535 return TimeStamp(); |
|
536 } |
533 } |
537 |
534 |
538 /// @} |
535 /// @} |
539 |
536 |
540 |
537 |