Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59626 - in sandbox/chrono/libs/chrono: perf test
From: vicente.botet_at_[hidden]
Date: 2010-02-10 16:32:40


Author: viboes
Date: 2010-02-10 16:32:39 EST (Wed, 10 Feb 2010)
New Revision: 59626
URL: http://svn.boost.org/trac/boost/changeset/59626

Log:
Boost.Chrono: Version 0.4.0,
* ratio test update
* perf improvements
Text files modified:
   sandbox/chrono/libs/chrono/perf/stopclock_perf.cpp | 473 +++++++++++++++++++++++----------------
   sandbox/chrono/libs/chrono/test/ratio_test.cpp | 2
   2 files changed, 275 insertions(+), 200 deletions(-)

Modified: sandbox/chrono/libs/chrono/perf/stopclock_perf.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/perf/stopclock_perf.cpp (original)
+++ sandbox/chrono/libs/chrono/perf/stopclock_perf.cpp 2010-02-10 16:32:39 EST (Wed, 10 Feb 2010)
@@ -20,137 +20,168 @@
 
 
 namespace rep_none {
+ std::size_t count[11];
+
+ template <typename Clock>
+ void f10(long v);
+
     template <typename Clock>
     void f1(long v) {
+ std::cout<< ">>> f1 " << v << "\n";
+ ++count[1];
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (v<=10) return;
+ f10<Clock>(v-1);
     }
 
     template <typename Clock>
     void f2(long v) {
+ std::cout<< ">>> f2 " << v << "\n";
+ ++count[2];
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=2) return;
         
         f1<Clock>(v-1);
     }
     
     template <typename Clock>
     void f3(long v) {
+ std::cout<< ">>> f3 " << v << "\n";
+ ++count[3];
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=3) return;
         
- if (v%2==0) f2<Clock>(v-1);
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
     void f4(long v) {
+ std::cout<< ">>> f4 " << v << "\n";
+ ++count[4];
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=4) return;
         
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%3==0) {f3<Clock>(v-1); return;}
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
     void f5(long v) {
+ std::cout<< ">>> f5 " << v << "\n";
+ ++count[5];
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=5) return;
         
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%4==0) {f4<Clock>(v-1); return;}
+ if (v%3==0) {f3<Clock>(v-1); return;}
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
     void f6(long v) {
+ std::cout<< ">>> f6 " << v << "\n";
+ ++count[6];
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=6) return;
         
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%5==0) {f5<Clock>(v-1); return;}
+ if (v%4==0) {f4<Clock>(v-1); return;}
+ if (v%3==0) {f3<Clock>(v-1); return;}
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
     void f7(long v) {
+ std::cout<< ">>> f7 " << v << "\n";
+ ++count[7];
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=7) return;
         
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%6==0) {f6<Clock>(v-1); return;}
+ if (v%5==0) {f5<Clock>(v-1); return;}
+ if (v%4==0) {f4<Clock>(v-1); return;}
+ if (v%3==0) {f3<Clock>(v-1); return;}
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
     void f8(long v) {
+ std::cout<< ">>> f8 " << v << "\n";
+ ++count[8];
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=8) return;
         
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%7==0) {f7<Clock>(v-1); return;}
+ if (v%6==0) {f6<Clock>(v-1); return;}
+ if (v%5==0) {f5<Clock>(v-1); return;}
+ if (v%4==0) {f4<Clock>(v-1); return;}
+ if (v%3==0) {f3<Clock>(v-1); return;}
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
     void f9(long v) {
+ std::cout<< ">>> f9 " << v << "\n";
+ ++count[9];
+ //std::cout<< ">>> COUNT NONE " << " " << rep_none::count[9] << std::endl;
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=9) return;
         
- if (v%8==0) f8<Clock>(v-1);
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%8==0) {f8<Clock>(v-1); return;}
+ if (v%7==0) {f7<Clock>(v-1); return;}
+ if (v%6==0) {f6<Clock>(v-1); return;}
+ if (v%5==0) {f5<Clock>(v-1); return;}
+ if (v%4==0) {f4<Clock>(v-1); return;}
+ if (v%3==0) {f3<Clock>(v-1); return;}
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
     void f10(long v) {
+ std::cout<< ">>> f10 " << v << "\n";
+ ++count[10];
+ //std::cout<< ">>> COUNT NONE 10 " << " " << rep_none::count[10] << std::endl;
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
-
- if (v%9==0) f9<Clock>(v-1);
- if (v%8==0) f8<Clock>(v-1);
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v<=10) return;
+
+ if ((v%9)==0) {f9<Clock>(v-1); return;}
+ if ((v%8)==0) {f8<Clock>(v-1); return;}
+ if ((v%7)==0) {f7<Clock>(v-1); return;}
+ if ((v%6)==0) {f6<Clock>(v-1); return;}
+ if ((v%5)==0) {f5<Clock>(v-1); return;}
+ if ((v%4)==0) {f4<Clock>(v-1); return;}
+ if ((v%3)==0) {f3<Clock>(v-1); return;}
+ if ((v%2)==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
+
     template <typename Clock>
     void f(long j)
     {
+ ++count[0];
         for ( long i = 0; i < j; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) {
+ if (j>1) {
             f<Clock>(j-1);
         }
         //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
@@ -159,12 +190,19 @@
 
 
 namespace rep_basic {
+ std::size_t count[11];
+
+ template <typename Clock>
+ void f10(long v);
+
     template <typename Clock>
     void f1(long v) {
         stopclock<Clock> b(9);
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (v<=10) return;
+ f10<Clock>(v-1);
     }
 
     template <typename Clock>
@@ -173,7 +211,7 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=2) return;
         
         f1<Clock>(v-1);
     }
@@ -184,9 +222,9 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=3) return;
         
- if (v%2==0) f2<Clock>(v-1);
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -195,10 +233,10 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=4) return;
         
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%3==0) {f3<Clock>(v-1); return;}
+ if (v%2==0) {f2<Clock>(v-1); return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -207,11 +245,11 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=5) return;
         
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -220,12 +258,12 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=6) return;
         
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -234,13 +272,13 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=7) return;
         
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -249,14 +287,14 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=8) return;
         
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -265,15 +303,15 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=9) return;
         
- if (v%8==0) f8<Clock>(v-1);
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%8==0) {f8<Clock>(v-1);return;}
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -282,16 +320,16 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=10) return;
         
- if (v%9==0) f9<Clock>(v-1);
- if (v%8==0) f8<Clock>(v-1);
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%9==0) {f9<Clock>(v-1);return;}
+ if (v%8==0) {f8<Clock>(v-1);return;}
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -301,7 +339,7 @@
 
         for ( long i = 0; i < j; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) {
+ if (j>1) {
             //std::cout << "f1("<<j-1<<")\n";
             f<Clock>(j-1);
         }
@@ -310,12 +348,19 @@
 }
 
 namespace rep_suspendible {
+ std::size_t count[11];
+
+ template <typename Clock>
+ void f10(long v);
+
     template <typename Clock>
     void f1(long v) {
         stopclock<suspendible_clock<Clock> > a(9);
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (v<=1) return;
+ f10<Clock>(v-1);
     }
 
     template <typename Clock>
@@ -324,7 +369,7 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=2) return;
         
         f1<Clock>(v-1);
     }
@@ -335,9 +380,9 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=3) return;
         
- if (v%2==0) f2<Clock>(v-1);
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -346,10 +391,10 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=4) return;
         
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -358,11 +403,11 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=5) return;
         
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -371,12 +416,12 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=6) return;
         
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -385,13 +430,13 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=7) return;
         
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -400,14 +445,14 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=8) return;
         
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -416,15 +461,15 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=9) return;
         
- if (v%8==0) f8<Clock>(v-1);
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%8==0) {f8<Clock>(v-1);return;}
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -433,16 +478,16 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=10) return;
         
- if (v%9==0) f9<Clock>(v-1);
- if (v%8==0) f8<Clock>(v-1);
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%9==0) {f9<Clock>(v-1);return;}
+ if (v%8==0) {f8<Clock>(v-1);return;}
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -452,7 +497,7 @@
 
         for ( long i = 0; i < j; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) {
+ if (j>1) {
             //std::cout << "f1("<<j-1<<")\n";
             f<Clock>(j-1);
         }
@@ -461,6 +506,11 @@
 }
 
 namespace rep_accu {
+ std::size_t count[11];
+
+ template <typename Clock>
+ void f10(long v);
+
     template <typename Clock>
     void f1(long v) {
         static stopclock_accumulator<Clock> acc(9);
@@ -468,6 +518,8 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (v<=10) return;
+ f10<Clock>(v-1);
     }
 
     template <typename Clock>
@@ -477,7 +529,7 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=2) return;
         
         f1<Clock>(v-1);
     }
@@ -489,9 +541,9 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=3) return;
         
- if (v%2==0) f2<Clock>(v-1);
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -501,10 +553,10 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=4) return;
         
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -514,11 +566,11 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=5) return;
         
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -528,12 +580,12 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=6) return;
         
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -543,13 +595,13 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=7) return;
         
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -559,14 +611,14 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=8) return;
         
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -576,15 +628,15 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=9) return;
         
- if (v%8==0) f8<Clock>(v-1);
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%8==0) {f8<Clock>(v-1);return;}
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -594,16 +646,16 @@
         // burn some time
         for ( long i = 0; i < v; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (v==0) return;
+ if (v<=10) return;
         
- if (v%9==0) f9<Clock>(v-1);
- if (v%8==0) f8<Clock>(v-1);
- if (v%7==0) f7<Clock>(v-1);
- if (v%6==0) f6<Clock>(v-1);
- if (v%5==0) f5<Clock>(v-1);
- if (v%4==0) f4<Clock>(v-1);
- if (v%3==0) f3<Clock>(v-1);
- if (v%2==0) f2<Clock>(v-1);
+ if (v%9==0) {f9<Clock>(v-1);return;}
+ if (v%8==0) {f8<Clock>(v-1);return;}
+ if (v%7==0) {f7<Clock>(v-1);return;}
+ if (v%6==0) {f6<Clock>(v-1);return;}
+ if (v%5==0) {f5<Clock>(v-1);return;}
+ if (v%4==0) {f4<Clock>(v-1);return;}
+ if (v%3==0) {f3<Clock>(v-1);return;}
+ if (v%2==0) {f2<Clock>(v-1);return;}
         f1<Clock>(v-1);
     }
     template <typename Clock>
@@ -614,7 +666,7 @@
 
         for ( long i = 0; i < j; ++i )
             res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) {
+ if (j>1) {
             //std::cout << "f1("<<j-1<<")\n";
             f<Clock>(j-1);
         }
@@ -625,20 +677,24 @@
 template <typename Clock, long SIZE>
 void test_clock_size()
 {
+ long K =1;
     std::cout << ">>> test_clock_size " << SIZE << std::endl;
     {
+ rep_none::count[0]=0;
         res=0;
         stopclock<Clock> b(9, std::string(">>> REC NONE ")+ stopwatch_formatter::default_format());
 
- for (long i =1; i<= 3; ++i)
+ for (long i =1; i<= K; ++i)
             rep_none::f<Clock>(i*SIZE);
- std::cout<< res << std::endl;
+ std::cout<< res << std::endl;
+ std::cout<< ">>> COUNT REC NONE " << SIZE << " " << rep_none::count[0] << std::endl;
+
     }
     {
         res=0;
         stopclock<Clock> b(9, std::string(">>> REC BASIC ") + stopwatch_formatter::default_format());
 
- for (long i =1; i<= 3; ++i)
+ for (long i =1; i<= K; ++i)
             rep_basic::f<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
@@ -646,7 +702,7 @@
         res=0;
         stopclock<suspendible_clock<Clock> > a(9, std::string(">>> REC SUSPEND ") + stopwatch_formatter::default_format());
 
- for (long i =1; i<= 3; ++i)
+ for (long i =1; i<= K; ++i)
             rep_suspendible::f<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
@@ -654,23 +710,28 @@
         res=0;
         stopclock<Clock> b(9, std::string(">>> REC ACCU ") + stopwatch_formatter::default_format());
 
- for (long i =1; i<= 3; ++i)
+ for (long i =1; i<= K; ++i)
             rep_accu::f<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
     {
         res=0;
+ for (int i=1;i<=10;i++) rep_none::count[i]=0;
         stopclock<Clock> b(9, std::string(">>> NON_REC NONE ")+ stopwatch_formatter::default_format());
 
- for (long i =1; i<= 3; ++i)
+ for (long i =1; i<= K; ++i)
             rep_none::f10<Clock>(i*SIZE);
         std::cout<< res << std::endl;
+ std::size_t c=0;
+ for (int i=1;i<=10;i++)
+ c+= rep_none::count[i];
+ std::cout<< ">>> COUNT NON_REC NONE " << SIZE << " " << c << std::endl;
     }
     {
         res=0;
         stopclock<Clock> b(9, std::string(">>> NON_REC BASIC ") + stopwatch_formatter::default_format());
 
- for (long i =1; i<= 3; ++i)
+ for (long i =1; i<= K; ++i)
             rep_basic::f10<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
@@ -678,7 +739,7 @@
         res=0;
         stopclock<suspendible_clock<Clock> > a(9, std::string(">>> NON_REC SUSPEND ") + stopwatch_formatter::default_format());
 
- for (long i =1; i<= 3; ++i)
+ for (long i =1; i<= K; ++i)
             rep_suspendible::f10<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
@@ -686,21 +747,35 @@
         res=0;
         stopclock<Clock> b(9, std::string(">>> NON_REC ACCU ") + stopwatch_formatter::default_format());
 
- for (long i =1; i<= 3; ++i)
+ for (long i =1; i<= K; ++i)
             rep_accu::f10<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
+#if 0
+#endif
 }
 
 template <typename Clock>
 void test_clock()
 {
+ //test_clock_size<Clock, 3200>();
+ //test_clock_size<Clock, 1600>();
+ //test_clock_size<Clock, 800>();
+ //test_clock_size<Clock, 400>();
+ //test_clock_size<Clock, 200>();
+ test_clock_size<Clock, 1050>();
+ test_clock_size<Clock, 1040>();
+ test_clock_size<Clock, 1030>();
+ test_clock_size<Clock, 1020>();
+ test_clock_size<Clock, 1010>();
+ test_clock_size<Clock, 1000>();
     test_clock_size<Clock, 100>();
- test_clock_size<Clock, 200>();
- test_clock_size<Clock, 400>();
- test_clock_size<Clock, 800>();
- test_clock_size<Clock, 1600>();
- test_clock_size<Clock, 3200>();
+
+
+
+
+
+
 }
 
 

Modified: sandbox/chrono/libs/chrono/test/ratio_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/ratio_test.cpp (original)
+++ sandbox/chrono/libs/chrono/test/ratio_test.cpp 2010-02-10 16:32:39 EST (Wed, 10 Feb 2010)
@@ -223,7 +223,7 @@
     std::cout << "* testUser1 *\n";
     std::cout << "*************\n";
     User1::Distance d( User1::mile(110) );
- User1::Time t( boost::chrono::hours(2) );
+ User1::Time t(( boost::chrono::hours(2) ));
     
     //typedef User1::quantity<boost::ratio_subtract<User1::Distance::time_dim, User1::Time::time_dim >::type,
     // boost::ratio_subtract<User1::Distance::distance_dim, User1::Time::distance_dim >::type > R;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk