Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59336 - sandbox/chrono/libs/chrono/perf
From: vicente.botet_at_[hidden]
Date: 2010-01-28 18:13:06


Author: viboes
Date: 2010-01-28 18:13:06 EST (Thu, 28 Jan 2010)
New Revision: 59336
URL: http://svn.boost.org/trac/boost/changeset/59336

Log:
Boost.Chrono: Version 0.4.0,
* improve perf/stopclock_perf.cpp with non-recursive calls

Text files modified:
   sandbox/chrono/libs/chrono/perf/stopclock_perf.cpp | 680 ++++++++++++++++++++++++++++++++++++---
   1 files changed, 621 insertions(+), 59 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-01-28 18:13:06 EST (Thu, 28 Jan 2010)
@@ -18,113 +18,676 @@
 using namespace boost::chrono;
 double res;
 
-template <typename Clock>
-void f1(long j)
-{
- for ( long i = 0; i < j; ++i )
- res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) {
- f1<Clock>(j-1);
+
+namespace rep_none {
+ template <typename Clock>
+ void f1(long v) {
+ // burn some time
+ for ( long i = 0; i < v; ++i )
+ res+=std::sqrt( res+123.456L+i ); // burn some time
+ }
+
+ template <typename Clock>
+ void f2(long v) {
+ // burn some time
+ for ( long i = 0; i < v; ++i )
+ res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (v==0) return;
+
+ f1<Clock>(v-1);
+ }
+
+ template <typename Clock>
+ void f3(long v) {
+ // 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==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f4(long v) {
+ // 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==0) f3<Clock>(v-1);
+ if (v%2==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f5(long v) {
+ // 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==0) f4<Clock>(v-1);
+ if (v%3==0) f3<Clock>(v-1);
+ if (v%2==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f6(long v) {
+ // 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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f7(long v) {
+ // 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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f8(long v) {
+ // 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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f9(long v) {
+ // 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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f10(long v) {
+ // 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f(long j)
+ {
+ for ( long i = 0; i < j; ++i )
+ res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (j!=0) {
+ f<Clock>(j-1);
+ }
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
     }
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
 }
 
-template <typename Clock>
-void f2(long j)
-{
- stopclock<Clock> b(9);
 
- for ( long i = 0; i < j; ++i )
- res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) {
- //std::cout << "f1("<<j-1<<")\n";
- f2<Clock>(j-1);
+namespace rep_basic {
+ 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
+ }
+
+ template <typename Clock>
+ void f2(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==0) return;
+
+ f1<Clock>(v-1);
+ }
+
+ template <typename Clock>
+ void f3(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==0) return;
+
+ if (v%2==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f4(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==0) return;
+
+ if (v%3==0) f3<Clock>(v-1);
+ if (v%2==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f5(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f6(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f7(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f8(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f9(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f10(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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f(long j)
+ {
+ stopclock<Clock> b(9);
+
+ for ( long i = 0; i < j; ++i )
+ res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (j!=0) {
+ //std::cout << "f1("<<j-1<<")\n";
+ f<Clock>(j-1);
+ }
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
     }
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
 }
 
-template <typename Clock>
-void f3(long j)
-{
- stopclock<suspendible_clock<Clock> > a(9);
+namespace rep_suspendible {
+ 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
+ }
+
+ template <typename Clock>
+ void f2(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==0) return;
+
+ f1<Clock>(v-1);
+ }
+
+ template <typename Clock>
+ void f3(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==0) return;
+
+ if (v%2==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f4(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==0) return;
+
+ if (v%3==0) f3<Clock>(v-1);
+ if (v%2==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f5(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f6(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f7(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f8(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f9(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==0) 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f10(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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f(long j)
+ {
+ stopclock<suspendible_clock<Clock> > a(9);
 
- for ( long i = 0; i < j; ++i )
- res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) {
- //std::cout << "f1("<<j-1<<")\n";
- f3<Clock>(j-1);
+ for ( long i = 0; i < j; ++i )
+ res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (j!=0) {
+ //std::cout << "f1("<<j-1<<")\n";
+ f<Clock>(j-1);
+ }
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
     }
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
 }
 
-template <typename Clock>
-void f4(long j)
-{
- static stopclock_accumulator<Clock> acc(9);
- typename stopclock_accumulator<Clock>::scoped_run c(acc);
+namespace rep_accu {
+ template <typename Clock>
+ void f1(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // burn some time
+ for ( long i = 0; i < v; ++i )
+ res+=std::sqrt( res+123.456L+i ); // burn some time
+ }
 
- for ( long i = 0; i < j; ++i )
- res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) {
- //std::cout << "f1("<<j-1<<")\n";
- f4<Clock>(j-1);
+ template <typename Clock>
+ void f2(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // burn some time
+ for ( long i = 0; i < v; ++i )
+ res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (v==0) return;
+
+ f1<Clock>(v-1);
+ }
+
+ template <typename Clock>
+ void f3(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // 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==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f4(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // 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==0) f3<Clock>(v-1);
+ if (v%2==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f5(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // 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==0) f4<Clock>(v-1);
+ if (v%3==0) f3<Clock>(v-1);
+ if (v%2==0) f2<Clock>(v-1);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f6(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // 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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f7(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // 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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f8(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // 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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f9(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // 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==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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f10(long v) {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+ // 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);
+ f1<Clock>(v-1);
+ }
+ template <typename Clock>
+ void f(long j)
+ {
+ static stopclock_accumulator<Clock> acc(9);
+ typename stopclock_accumulator<Clock>::scoped_run c(acc);
+
+ for ( long i = 0; i < j; ++i )
+ res+=std::sqrt( res+123.456L+i ); // burn some time
+ if (j!=0) {
+ //std::cout << "f1("<<j-1<<")\n";
+ f<Clock>(j-1);
+ }
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
     }
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
 }
 
 template <typename Clock, long SIZE>
 void test_clock_size()
 {
- std::cout << ">>> test_clock_size() " << SIZE << std::endl;
- //stopclock<> _(BOOST_CHRONO_TIME_FUNCTION_FORMAT);
- //stopclock<> _(9);
- //stopclock<suspendible_clock<high_resolution_clock> > a(9);
+ std::cout << ">>> test_clock_size " << SIZE << std::endl;
+ {
+ res=0;
+ stopclock<Clock> b(9, std::string(">>> REC NONE ")+ stopwatch_formatter::default_format());
+
+ for (long i =1; i<= 3; ++i)
+ rep_none::f<Clock>(i*SIZE);
+ std::cout<< res << std::endl;
+ }
+ {
+ res=0;
+ stopclock<Clock> b(9, std::string(">>> REC BASIC ") + stopwatch_formatter::default_format());
+
+ for (long i =1; i<= 3; ++i)
+ rep_basic::f<Clock>(i*SIZE);
+ std::cout<< res << std::endl;
+ }
     {
         res=0;
- stopclock<Clock> b(9, std::string(">>> NONE ")+ stopwatch_formatter::default_format());
+ stopclock<suspendible_clock<Clock> > a(9, std::string(">>> REC SUSPEND ") + stopwatch_formatter::default_format());
 
         for (long i =1; i<= 3; ++i)
- f1<Clock>(i*SIZE);
+ rep_suspendible::f<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
     {
         res=0;
- stopclock<Clock> b(9, std::string(">>> HIGH ") + stopwatch_formatter::default_format());
+ stopclock<Clock> b(9, std::string(">>> REC ACCU ") + stopwatch_formatter::default_format());
 
         for (long i =1; i<= 3; ++i)
- f2<Clock>(i*SIZE);
+ rep_accu::f<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
     {
         res=0;
- stopclock<suspendible_clock<high_resolution_clock> > a(9, std::string(">>> SUSPEND ") + stopwatch_formatter::default_format());
+ stopclock<Clock> b(9, std::string(">>> NON_REC NONE ")+ stopwatch_formatter::default_format());
 
         for (long i =1; i<= 3; ++i)
- f3<Clock>(i*SIZE);
+ rep_none::f10<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
     {
         res=0;
- stopclock<Clock> b(9, std::string(">>> ACCU ") + stopwatch_formatter::default_format());
+ stopclock<Clock> b(9, std::string(">>> NON_REC BASIC ") + stopwatch_formatter::default_format());
 
         for (long i =1; i<= 3; ++i)
- f4<Clock>(i*SIZE);
+ rep_basic::f10<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
     {
         res=0;
- stopclock<Clock> b(9, std::string(">>> NONE ")+ stopwatch_formatter::default_format());
+ stopclock<suspendible_clock<Clock> > a(9, std::string(">>> NON_REC SUSPEND ") + stopwatch_formatter::default_format());
 
         for (long i =1; i<= 3; ++i)
- f1<Clock>(i*SIZE);
+ rep_suspendible::f10<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
     {
         res=0;
- stopclock<Clock> b(9, std::string(">>> ACCU ") + stopwatch_formatter::default_format());
+ stopclock<Clock> b(9, std::string(">>> NON_REC ACCU ") + stopwatch_formatter::default_format());
 
         for (long i =1; i<= 3; ++i)
- f4<Clock>(i*SIZE);
+ rep_accu::f10<Clock>(i*SIZE);
         std::cout<< res << std::endl;
     }
 }
@@ -132,7 +695,6 @@
 template <typename Clock>
 void test_clock()
 {
- std::cout << ">>> test_clock() " << std::endl;
     test_clock_size<Clock, 100>();
     test_clock_size<Clock, 200>();
     test_clock_size<Clock, 400>();
@@ -144,13 +706,13 @@
 
 int main() {
 #ifdef BOOST_CHRONO_HAS_THREAD_CLOCK
- std::cout << ">>> main()-thread_clock" << std::endl;
+ std::cout << ">>> main thread_clock" << std::endl;
     test_clock<thread_clock>();
 #endif
- std::cout << ">>> main()-high_resolution_clock" << std::endl;
+ std::cout << ">>> main high_resolution_clock" << std::endl;
     test_clock<high_resolution_clock>();
 #ifdef BOOST_CHRONO_HAS_THREAD_CLOCK
- std::cout << ">>> main()-thread_clock" << std::endl;
+ std::cout << ">>> main thread_clock" << std::endl;
     test_clock<thread_clock>();
 #endif
 


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