Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74425 - in sandbox/stopwatches: boost/chrono/stopwatches libs/chrono/stopwatches/example libs/chrono/stopwatches/perf libs/chrono/stopwatches/test
From: vicente.botet_at_[hidden]
Date: 2011-09-16 18:33:15


Author: viboes
Date: 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
New Revision: 74425
URL: http://svn.boost.org/trac/boost/changeset/74425

Log:
Stopwatches: indent
Text files modified:
   sandbox/stopwatches/boost/chrono/stopwatches/lightweight_stopwatch.hpp | 400 ++++---
   sandbox/stopwatches/boost/chrono/stopwatches/scoped_stopclock.hpp | 191 +-
   sandbox/stopwatches/boost/chrono/stopwatches/stopclock.hpp | 557 ++++++----
   sandbox/stopwatches/boost/chrono/stopwatches/stopclock_accumulator.hpp | 588 ++++++----
   sandbox/stopwatches/boost/chrono/stopwatches/stopwatch.hpp | 97 +
   sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator.hpp | 120 +
   sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator_formatter.hpp | 252 ++--
   sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator_time_formatter.hpp | 312 +++--
   sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_formatter.hpp | 172 +-
   sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_reporter.hpp | 636 +++++++-----
   sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_scoped.hpp | 153 +-
   sandbox/stopwatches/boost/chrono/stopwatches/suspendible_clock.hpp | 344 +++--
   sandbox/stopwatches/boost/chrono/stopwatches/t24_hours.hpp | 90
   sandbox/stopwatches/boost/chrono/stopwatches/t24_hours_formatter.hpp | 232 ++-
   sandbox/stopwatches/boost/chrono/stopwatches/time_formatter.hpp | 252 ++--
   sandbox/stopwatches/libs/chrono/stopwatches/example/loop_stopclock_accumulator_example.cpp | 13
   sandbox/stopwatches/libs/chrono/stopwatches/example/nested_stopclock_accumulator_example.cpp | 50
   sandbox/stopwatches/libs/chrono/stopwatches/example/scoped_stopclock_example.cpp | 4
   sandbox/stopwatches/libs/chrono/stopwatches/example/scoped_stopwatch_example.cpp | 78
   sandbox/stopwatches/libs/chrono/stopwatches/example/sleep_for.hpp | 24
   sandbox/stopwatches/libs/chrono/stopwatches/example/specific_stopwatch_accumulator_example.cpp | 132 +-
   sandbox/stopwatches/libs/chrono/stopwatches/example/stopclock_accumulator_example.cpp | 19
   sandbox/stopwatches/libs/chrono/stopwatches/example/stopclock_example.cpp | 8
   sandbox/stopwatches/libs/chrono/stopwatches/example/stopwatch_accumulator_example.cpp | 126 +-
   sandbox/stopwatches/libs/chrono/stopwatches/example/stopwatch_example.cpp | 6
   sandbox/stopwatches/libs/chrono/stopwatches/example/suspendible_stopclock_example.cpp | 31
   sandbox/stopwatches/libs/chrono/stopwatches/example/t24_hours_example.cpp | 10
   sandbox/stopwatches/libs/chrono/stopwatches/example/timex.cpp | 19
   sandbox/stopwatches/libs/chrono/stopwatches/perf/stopclock_perf.cpp | 2094 ++++++++++++++++++++++++++-------------
   sandbox/stopwatches/libs/chrono/stopwatches/test/stopclock_constructor_overload_test.cpp | 62
   sandbox/stopwatches/libs/chrono/stopwatches/test/test_minmax.cpp | 8
   sandbox/stopwatches/libs/chrono/stopwatches/test/wstopclock_constructor_overload_test.cpp | 171 +-
   32 files changed, 4264 insertions(+), 2987 deletions(-)

Modified: sandbox/stopwatches/boost/chrono/stopwatches/lightweight_stopwatch.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/lightweight_stopwatch.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/lightweight_stopwatch.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -18,209 +18,243 @@
   namespace chrono
   {
 
- struct dont_start_t{};
- static const dont_start_t dont_start = {};
+ struct dont_start_t
+ {
+ };
+ static const dont_start_t dont_start =
+ { };
 
     // forward declaration
- template <
- typename Clock,
- typename Traits
- >
+ template<typename Clock, typename Traits>
     class lightweight_stopwatch;
 
-
- template <typename Clock, typename Traits>
+ template<typename Clock, typename Traits>
     class lightweight_stopwatch
     {
     public:
- typedef typename Traits::template apply<typename Clock::duration>::type traits;
- typedef typename traits::storage_type storage_type;
- typedef Clock clock;
- typedef typename Clock::duration duration;
- typedef typename Clock::time_point time_point;
- typedef typename Clock::rep rep;
- typedef typename Clock::period period;
-
- explicit lightweight_stopwatch( storage_type& acc, system::error_code & ec = BOOST_CHRONO_THROWS )
- : running_(false), suspended_(false),
- start_(duration::zero()), level_(0), partial_(duration::zero()), suspend_level_(0)
- , storage_(&acc), construction_(clock::now( ))
- {
- start(ec);
- }
-
- lightweight_stopwatch( storage_type& acc, const dont_start_t& )
- : running_(false), suspended_(false),
- start_(duration::zero()), level_(0), partial_(duration::zero()), suspend_level_(0)
- , storage_(&acc), construction_(clock::now( ))
- {
- }
-
- ~lightweight_stopwatch() {
- system::error_code ec;
- stop(ec);
- }
-
-
- std::pair<duration, time_point> restart( system::error_code & ec = BOOST_CHRONO_THROWS )
- {
- time_point tmp=clock::now( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return time_point();
+ typedef typename Traits::template apply<typename Clock::duration>::type
+ traits;
+ typedef typename traits::storage_type storage_type;
+ typedef Clock clock;
+ typedef typename Clock::duration duration;
+ typedef typename Clock::time_point time_point;
+ typedef typename Clock::rep rep;
+ typedef typename Clock::period period;
+
+ explicit lightweight_stopwatch(storage_type& acc, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ running_(false), suspended_(false), start_(duration::zero()),
+ level_(0), partial_(duration::zero()), suspend_level_(0),
+ storage_(&acc), construction_(clock::now())
+ {
+ start(ec);
+ }
+
+ lightweight_stopwatch(storage_type& acc, const dont_start_t&) :
+ running_(false), suspended_(false), start_(duration::zero()),
+ level_(0), partial_(duration::zero()), suspend_level_(0),
+ storage_(&acc), construction_(clock::now())
+ {
+ }
+
+ ~lightweight_stopwatch()
+ {
+ system::error_code ec;
+ stop(ec);
+ }
+
+ std::pair<duration, time_point> restart(system::error_code & ec =
+ BOOST_CHRONO_THROWS)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return time_point();
+ }
+ if (running_ && (level_ == 1))
+ {
+ partial_ += tmp - start_;
+ traits::set_duration(get_storage(), partial_);
+ partial_ = duration::zero();
+ } else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ return std::make_pair(traits::get_duration(get_storage()), start_);
+ }
+
+ time_point start(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ if (!running_)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ {
+ return time_point();
+ }
           }
- if (running_&&(level_==1)) {
- partial_ += tmp - start_;
- traits::set_duration(get_storage(),partial_);
- partial_=duration::zero();
- } else {
- running_=true;
+ start_ = tmp;
+ ++level_;
+ running_ = true;
+ return start_;
+ } else
+ {
+ ++level_;
+ ec.clear();
+ return time_point();
+ }
+ }
+
+ duration stop(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ if (running_ && (--level_ == 0))
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return duration::zero();
           }
- start_=tmp;
- return std::make_pair(traits::get_duration(get_storage()),start_);
- }
-
- time_point start( system::error_code & ec = BOOST_CHRONO_THROWS )
- {
- if (!running_) {
- time_point tmp = clock::now( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) {
- return time_point();
- }
- }
- start_ = tmp;
- ++level_;
- running_ = true;
- return start_;
- } else {
- ++level_;
- ec.clear();
- return time_point();
- }
- }
-
- duration stop( system::error_code & ec = BOOST_CHRONO_THROWS )
- {
- if (running_ && (--level_==0)) {
- time_point tmp=clock::now( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return duration::zero();
- }
- partial_ += tmp - start_;
- traits::set_duration(get_storage(),partial_);
- partial_=duration::zero();
- running_=false;
- return traits::get_duration(get_storage());
- } else {
- ec.clear();
- return duration::zero();
- }
- }
-
- duration suspend( system::error_code & ec = BOOST_CHRONO_THROWS )
- {
- if (running_) {
- if (!suspended_) {
- time_point tmp=clock::now( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return duration::zero();
- }
- ++suspend_level_;
- partial_ += tmp - start_;
- suspended_=true;
- return traits::get_duration(get_storage());
- } else {
- ++suspend_level_;
- ec.clear();
- return duration::zero();
- }
- } else {
- ec.clear();
+ partial_ += tmp - start_;
+ traits::set_duration(get_storage(), partial_);
+ partial_ = duration::zero();
+ running_ = false;
+ return traits::get_duration(get_storage());
+ } else
+ {
+ ec.clear();
+ return duration::zero();
+ }
+ }
+
+ duration suspend(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ if (running_)
+ {
+ if (!suspended_)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
                 return duration::zero();
             }
- }
-
- time_point resume( system::error_code & ec = BOOST_CHRONO_THROWS )
+ ++suspend_level_;
+ partial_ += tmp - start_;
+ suspended_ = true;
+ return traits::get_duration(get_storage());
+ } else
+ {
+ ++suspend_level_;
+ ec.clear();
+ return duration::zero();
+ }
+ } else
         {
- if (suspended_&&(--suspend_level_==0)) {
- time_point tmp = clock::now( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return time_point();
- }
- start_ = tmp;
- suspended_=false;
- return start_;
- } else {
- ec.clear();
- return time_point();
- }
+ ec.clear();
+ return duration::zero();
         }
+ }
 
- duration elapsed( system::error_code & ec = BOOST_CHRONO_THROWS )
- {
- if (running_) {
- if (suspended_)
- return traits::get_duration(get_storage());
- else {
- time_point tmp = clock::now( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return duration::zero();
- }
- return traits::get_duration(get_storage())+tmp - start_;
- }
- } else {
- return traits::get_duration(get_storage());
+ time_point resume(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ if (suspended_ && (--suspend_level_ == 0))
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return time_point();
+ }
+ start_ = tmp;
+ suspended_ = false;
+ return start_;
+ } else
+ {
+ ec.clear();
+ return time_point();
+ }
+ }
+
+ duration elapsed(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ if (running_)
+ {
+ if (suspended_)
+ return traits::get_duration(get_storage());
+ else
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return duration::zero();
             }
- }
-
- time_point now( system::error_code & ec = BOOST_CHRONO_THROWS )
+ return traits::get_duration(get_storage()) + tmp - start_;
+ }
+ } else
         {
- return time_point(elapsed( ec ));
+ return traits::get_duration(get_storage());
         }
+ }
 
- void reset( system::error_code & ec = BOOST_CHRONO_THROWS )
- {
- construction_=clock::now( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- traits::reset(get_storage());
- running_=false;
- suspended_=false;
- partial_ = duration::zero();
- start_ = time_point(duration::zero());
- level_=0;
- suspend_level_=0;
- }
-
- storage_type& get_storage( )
- {
- return *storage_;
- }
-
- duration lifetime( system::error_code & ec = BOOST_CHRONO_THROWS )
- {
- //std::cout << "construction_:" << construction_ << std::endl;
- //std::cout << "now:" << clock::now( ec ) << std::endl;
- return clock::now( ec ) - construction_;
- }
-
- typedef stopwatch_runner<lightweight_stopwatch<Clock,Traits> > scoped_run;
- typedef stopwatch_stopper<lightweight_stopwatch<Clock,Traits> > scoped_stop;
- typedef stopwatch_suspender<lightweight_stopwatch<Clock,Traits> > scoped_suspend;
- typedef stopwatch_resumer<lightweight_stopwatch<Clock,Traits> > scoped_resume;
- private:
- bool running_;
- bool suspended_;
- time_point start_;
- std::size_t level_;
- duration partial_;
- std::size_t suspend_level_;
- storage_type* storage_;
- time_point construction_;
+ time_point now(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ return time_point(elapsed(ec));
+ }
+
+ void reset(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ construction_ = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
+ }
+ traits::reset(get_storage());
+ running_ = false;
+ suspended_ = false;
+ partial_ = duration::zero();
+ start_ = time_point(duration::zero());
+ level_ = 0;
+ suspend_level_ = 0;
+ }
+
+ storage_type& get_storage()
+ {
+ return *storage_;
+ }
+
+ duration lifetime(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ //std::cout << "construction_:" << construction_ << std::endl;
+ //std::cout << "now:" << clock::now( ec ) << std::endl;
+ return clock::now(ec) - construction_;
+ }
+
+ typedef stopwatch_runner<lightweight_stopwatch<Clock, Traits> >
+ scoped_run;
+ typedef stopwatch_stopper<lightweight_stopwatch<Clock, Traits> >
+ scoped_stop;
+ typedef stopwatch_suspender<lightweight_stopwatch<Clock, Traits> >
+ scoped_suspend;
+ typedef stopwatch_resumer<lightweight_stopwatch<Clock, Traits> >
+ scoped_resume;
+ private:
+ bool running_;
+ bool suspended_;
+ time_point start_;
+ std::size_t level_;
+ duration partial_;
+ std::size_t suspend_level_;
+ storage_type* storage_;
+ time_point construction_;
     };
 
-
   } // namespace chrono
 } // namespace boost
 

Modified: sandbox/stopwatches/boost/chrono/stopwatches/scoped_stopclock.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/scoped_stopclock.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/scoped_stopclock.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -14,99 +14,108 @@
 #include <boost/chrono/stopwatches/stopwatch_accumulator_time_formatter.hpp>
 #include <boost/chrono/stopwatches/stopclock.hpp>
 
-namespace boost { namespace chrono {
-
-//--------------------------------------------------------------------------------------//
-//~ provides a everything a Timer provides and it adds reporting capabilities that can be invoked in a single line of code. The reporting is controleed by two parameters:
-
- //~ * format : The output format
- //~ * places(precission): the number of decimal placess used.
-
-//~ The default places is given by default_places and is 3. The default format is "\n%ts\n", where
-
- //~ * %t : the result of elapsed() when the reporting is done.
-
-//~ The time is given using the suffix "s" following the System International d'Unites Std.
-
-/* void f1()
- * {
- * stopclock<> _;
- * // ...
- * }
- */
-//--------------------------------------------------------------------------------------//
-
- template <class Clock=chrono::process_cpu_clock, class Formatter=typename stopwatch_reporter_default_formatter<chrono::stopwatch<Clock> >::type >
- class scoped_stopclock
- : public stopwatch_reporter<chrono::stopwatch<Clock>, Formatter> {
- typedef stopwatch_reporter<chrono::stopwatch<Clock>, Formatter> base_type;
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class Clock = chrono::process_cpu_clock,
+ class Formatter = typename stopwatch_reporter_default_formatter<
+ chrono::stopwatch<Clock> >::type>
+ class scoped_stopclock: public stopwatch_reporter<chrono::stopwatch<Clock>,
+ Formatter>
+ {
+ typedef stopwatch_reporter<chrono::stopwatch<Clock>, Formatter> base_type;
     public:
- typedef Clock clock;
- typedef chrono::stopwatch<Clock> stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- explicit scoped_stopclock( const string_type& func, system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(ec), func_(func)
- { begin(); }
- scoped_stopclock( const string_type& func, ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec), func_(func)
- { begin(); }
-
- scoped_stopclock( const string_type& func, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec), func_(func)
- { begin(); }
-
- scoped_stopclock( const string_type& func, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec), func_(func)
- { begin(); }
-
- scoped_stopclock( const string_type& func, ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec), func_(func)
- { begin(); }
-
- scoped_stopclock( const string_type& func, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec), func_(func)
- { begin(); }
-
- scoped_stopclock( const string_type& func, ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec), func_(func)
- { begin(); }
-
- scoped_stopclock( const string_type& func, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec), func_(func)
- { begin(); }
-
- scoped_stopclock( const string_type& func, ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec), func_(func)
- { begin(); }
-
- scoped_stopclock( const string_type& func, ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec), func_(func)
- { begin(); }
-
- ~scoped_stopclock() {
- this->m_os << "}}} " << func_ << " : ";
- }
- typedef typename base_type::scoped_run scoped_run;
- typedef typename base_type::scoped_suspend scoped_suspend;
- typedef typename base_type::scoped_resume scoped_resume;
+ typedef Clock clock;
+ typedef chrono::stopwatch<Clock> stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ explicit scoped_stopclock(const string_type& func, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(ec), func_(func)
+ {
+ begin();
+ }
+ scoped_stopclock(const string_type& func, ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec), func_(func)
+ {
+ begin();
+ }
+
+ scoped_stopclock(const string_type& func, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec), func_(func)
+ {
+ begin();
+ }
+
+ scoped_stopclock(const string_type& func, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec), func_(func)
+ {
+ begin();
+ }
+
+ scoped_stopclock(const string_type& func, ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec), func_(func)
+ {
+ begin();
+ }
+
+ scoped_stopclock(const string_type& func, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec), func_(func)
+ {
+ begin();
+ }
+
+ scoped_stopclock(const string_type& func, ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec), func_(func)
+ {
+ begin();
+ }
+
+ scoped_stopclock(const string_type& func, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec), func_(func)
+ {
+ begin();
+ }
+
+ scoped_stopclock(const string_type& func, ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec), func_(func)
+ {
+ begin();
+ }
+
+ scoped_stopclock(const string_type& func, ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec), func_(func)
+ {
+ begin();
+ }
+
+ ~scoped_stopclock()
+ {
+ this->m_os << "}}} " << func_ << " : ";
+ }
+ typedef typename base_type::scoped_run scoped_run;
+ typedef typename base_type::scoped_suspend scoped_suspend;
+ typedef typename base_type::scoped_resume scoped_resume;
     private:
- void begin() {
- this->m_os << "{{{ " << func_ << std::endl;
- }
- string_type func_;
+ void begin()
+ {
+ this->m_os << "{{{ " << func_ << std::endl;
+ }
+ string_type func_;
 
     };
 

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopclock.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopclock.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopclock.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -17,249 +17,342 @@
 #include <boost/chrono/process_cpu_clocks.hpp>
 #include <boost/type_traits/is_same.hpp>
 
-namespace boost { namespace chrono {
-
-
- template <class Clock>
- struct stopwatch_reporter_default_formatter<stopwatch<Clock> > {
- typedef stopwatch_formatter type;
- };
-
- template <class Clock>
- struct wstopwatch_reporter_default_formatter<stopwatch<Clock> > {
- typedef wstopwatch_formatter type;
- };
-
- template <>
- struct stopwatch_reporter_default_formatter<stopwatch<chrono::process_cpu_clock> > {
- typedef time_formatter type;
- };
-
- template <>
- struct wstopwatch_reporter_default_formatter<stopwatch<chrono::process_cpu_clock> > {
- typedef wtime_formatter type;
- };
-
- template <>
- struct stopwatch_reporter_default_formatter<stopwatch<chrono::suspendible_clock<chrono::process_cpu_clock> > > {
- typedef stopwatch_reporter_default_formatter<stopwatch<chrono::process_cpu_clock> >::type type;
- };
-
- template <>
- struct wstopwatch_reporter_default_formatter<stopwatch<chrono::suspendible_clock<chrono::process_cpu_clock> > > {
- typedef wstopwatch_reporter_default_formatter<stopwatch<chrono::process_cpu_clock> >::type type;
- };
-
-
- template <class Clock, class Formatter>
- class basic_stopclock : public basic_stopwatch_reporter<chrono::stopwatch<Clock>, Formatter> {
- typedef basic_stopwatch_reporter<chrono::stopwatch<Clock>, Formatter> base_type;
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class Clock>
+ struct stopwatch_reporter_default_formatter<stopwatch<Clock> >
+ {
+ typedef stopwatch_formatter type;
+ };
+
+ template<class Clock>
+ struct wstopwatch_reporter_default_formatter<stopwatch<Clock> >
+ {
+ typedef wstopwatch_formatter type;
+ };
+
+ template<>
+ struct stopwatch_reporter_default_formatter<stopwatch<
+ chrono::process_cpu_clock> >
+ {
+ typedef time_formatter type;
+ };
+
+ template<>
+ struct wstopwatch_reporter_default_formatter<stopwatch<
+ chrono::process_cpu_clock> >
+ {
+ typedef wtime_formatter type;
+ };
+
+ template<>
+ struct stopwatch_reporter_default_formatter<stopwatch<
+ chrono::suspendible_clock<chrono::process_cpu_clock> > >
+ {
+ typedef stopwatch_reporter_default_formatter<stopwatch<
+ chrono::process_cpu_clock> >::type type;
+ };
+
+ template<>
+ struct wstopwatch_reporter_default_formatter<stopwatch<
+ chrono::suspendible_clock<chrono::process_cpu_clock> > >
+ {
+ typedef wstopwatch_reporter_default_formatter<stopwatch<
+ chrono::process_cpu_clock> >::type type;
+ };
+
+ template<class Clock, class Formatter>
+ class basic_stopclock: public basic_stopwatch_reporter<chrono::stopwatch<
+ Clock>, Formatter>
+ {
+ typedef basic_stopwatch_reporter<chrono::stopwatch<Clock>, Formatter>
+ base_type;
     public:
- typedef Clock clock;
- typedef chrono::stopwatch<Clock> stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- explicit basic_stopclock( system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(ec) { }
- explicit basic_stopclock( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec) { }
-
- explicit basic_stopclock( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec) { }
-
- explicit basic_stopclock( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec) { }
-
- basic_stopclock( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec) { }
-
- basic_stopclock( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec) { }
-
- basic_stopclock( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec) { }
-
- basic_stopclock( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec) { }
-
- basic_stopclock( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec) { }
-
- basic_stopclock( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec) { }
-
- typedef stopwatch_runner<basic_stopclock> scoped_run;
- typedef stopwatch_stopper<basic_stopclock> scoped_stop;
- typedef stopwatch_suspender<basic_stopclock> scoped_suspend;
- typedef stopwatch_resumer<basic_stopclock> scoped_resume;
-
- };
-
- template <class Clock, class Formatter>
- struct stopwatch_reporter_default_formatter<basic_stopclock<Clock,Formatter> > {
- typedef Formatter type;
- };
-
- template <class Clock=chrono::process_cpu_clock, class Formatter=typename stopwatch_reporter_default_formatter<stopwatch<Clock> >::type>
+ typedef Clock clock;
+ typedef chrono::stopwatch<Clock> stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ explicit basic_stopclock(system::error_code & ec = BOOST_CHRONO_THROWS) :
+ base_type(ec)
+ {
+ }
+ explicit basic_stopclock(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec)
+ {
+ }
+
+ explicit basic_stopclock(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec)
+ {
+ }
+
+ explicit basic_stopclock(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec)
+ {
+ }
+
+ basic_stopclock(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec)
+ {
+ }
+
+ basic_stopclock(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec)
+ {
+ }
+
+ basic_stopclock(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec)
+ {
+ }
+
+ basic_stopclock(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec)
+ {
+ }
+
+ basic_stopclock(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec)
+ {
+ }
+
+ basic_stopclock(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec)
+ {
+ }
+
+ typedef stopwatch_runner<basic_stopclock> scoped_run;
+ typedef stopwatch_stopper<basic_stopclock> scoped_stop;
+ typedef stopwatch_suspender<basic_stopclock> scoped_suspend;
+ typedef stopwatch_resumer<basic_stopclock> scoped_resume;
+
+ };
+
+ template<class Clock, class Formatter>
+ struct stopwatch_reporter_default_formatter<basic_stopclock<Clock,
+ Formatter> >
+ {
+ typedef Formatter type;
+ };
+
+ template<class Clock = chrono::process_cpu_clock,
+ class Formatter = typename stopwatch_reporter_default_formatter<
+ stopwatch<Clock> >::type>
     class stopclock;
 
- template <class Clock, class Formatter>
- struct stopwatch_reporter_default_formatter<stopclock<Clock,Formatter> > {
- typedef Formatter type;
+ template<class Clock, class Formatter>
+ struct stopwatch_reporter_default_formatter<stopclock<Clock, Formatter> >
+ {
+ typedef Formatter type;
     };
 
- template <class Clock, class Formatter>
- class stopclock : public basic_stopclock<Clock, Formatter> {
- typedef basic_stopclock<Clock, Formatter> base_type;
+ template<class Clock, class Formatter>
+ class stopclock: public basic_stopclock<Clock, Formatter>
+ {
+ typedef basic_stopclock<Clock, Formatter> base_type;
     public:
- typedef Clock clock;
- typedef chrono::stopwatch<Clock> stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- explicit stopclock( system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(ec) { }
- explicit stopclock( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec) { }
-
- explicit stopclock( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec) { }
-
- explicit stopclock( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec) { }
-
- stopclock( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec) { }
-
- stopclock( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec) { }
-
- stopclock( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec) { }
-
- stopclock( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec) { }
-
- stopclock( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec) { }
-
- stopclock( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec) { }
-
- typedef stopwatch_runner<stopclock> scoped_run;
- typedef stopwatch_stopper<stopclock> scoped_stop;
- typedef stopwatch_suspender<stopclock> scoped_suspend;
- typedef stopwatch_resumer<stopclock> scoped_resume;
-
- };
-
- typedef stopclock< boost::chrono::system_clock > system_stopclock;
- #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- typedef stopclock< boost::chrono::steady_clock > steady_stopclock;
- #endif
- typedef stopclock< boost::chrono::high_resolution_clock > high_resolution_stopclock;
- typedef stopclock< boost::chrono::process_real_cpu_clock > process_real_cpu_stopclock;
- typedef stopclock< boost::chrono::process_user_cpu_clock > process_user_cpu_stopclock;
- typedef stopclock< boost::chrono::process_system_cpu_clock > process_system_cpu_stopclock;
- typedef stopclock< boost::chrono::process_cpu_clock > process_cpu_stopclock;
-
- template <class Clock=chrono::process_cpu_clock, class Formatter=typename wstopwatch_reporter_default_formatter<stopwatch<Clock> >::type>
+ typedef Clock clock;
+ typedef chrono::stopwatch<Clock> stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ explicit stopclock(system::error_code & ec = BOOST_CHRONO_THROWS) :
+ base_type(ec)
+ {
+ }
+ explicit stopclock(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec)
+ {
+ }
+
+ explicit stopclock(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec)
+ {
+ }
+
+ explicit stopclock(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec)
+ {
+ }
+
+ stopclock(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec)
+ {
+ }
+
+ stopclock(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec)
+ {
+ }
+
+ stopclock(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec)
+ {
+ }
+
+ stopclock(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec)
+ {
+ }
+
+ stopclock(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec)
+ {
+ }
+
+ stopclock(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec)
+ {
+ }
+
+ typedef stopwatch_runner<stopclock> scoped_run;
+ typedef stopwatch_stopper<stopclock> scoped_stop;
+ typedef stopwatch_suspender<stopclock> scoped_suspend;
+ typedef stopwatch_resumer<stopclock> scoped_resume;
+
+ };
+
+ typedef stopclock<boost::chrono::system_clock> system_stopclock;
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ typedef stopclock<boost::chrono::steady_clock> steady_stopclock;
+#endif
+ typedef stopclock<boost::chrono::high_resolution_clock>
+ high_resolution_stopclock;
+ typedef stopclock<boost::chrono::process_real_cpu_clock>
+ process_real_cpu_stopclock;
+ typedef stopclock<boost::chrono::process_user_cpu_clock>
+ process_user_cpu_stopclock;
+ typedef stopclock<boost::chrono::process_system_cpu_clock>
+ process_system_cpu_stopclock;
+ typedef stopclock<boost::chrono::process_cpu_clock> process_cpu_stopclock;
+
+ template<class Clock = chrono::process_cpu_clock,
+ class Formatter = typename wstopwatch_reporter_default_formatter<
+ stopwatch<Clock> >::type>
     class wstopclock;
 
- template <class Clock, class Formatter>
- struct stopwatch_reporter_default_formatter<wstopclock<Clock,Formatter> > {
- typedef Formatter type;
+ template<class Clock, class Formatter>
+ struct stopwatch_reporter_default_formatter<wstopclock<Clock, Formatter> >
+ {
+ typedef Formatter type;
     };
 
- template <class Clock, class Formatter>
- class wstopclock : public basic_stopclock<Clock, Formatter> {
- typedef basic_stopclock<Clock, Formatter> base_type;
+ template<class Clock, class Formatter>
+ class wstopclock: public basic_stopclock<Clock, Formatter>
+ {
+ typedef basic_stopclock<Clock, Formatter> base_type;
     public:
- typedef Clock clock;
- typedef chrono::stopwatch<Clock> stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- explicit wstopclock( system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(ec) { }
- explicit wstopclock( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec) { }
-
- explicit wstopclock( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec) { }
-
- explicit wstopclock( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec) { }
-
- wstopclock( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec) { }
-
- wstopclock( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec) { }
-
- wstopclock( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec) { }
-
- wstopclock( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec) { }
-
- wstopclock( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec) { }
-
- wstopclock( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec) { }
-
- typedef stopwatch_runner<wstopclock> scoped_run;
- typedef stopwatch_stopper<wstopclock> scoped_stop;
- typedef stopwatch_suspender<wstopclock> scoped_suspend;
- typedef stopwatch_resumer<wstopclock> scoped_resume;
-
- };
-
- typedef wstopclock< boost::chrono::system_clock > system_wstopclock;
- #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- typedef wstopclock< boost::chrono::steady_clock > steady_wstopclock;
- #endif
- typedef wstopclock< boost::chrono::high_resolution_clock > high_resolution_wstopclock;
- typedef wstopclock< boost::chrono::process_real_cpu_clock > process_real_cpu_wstopclock;
- typedef wstopclock< boost::chrono::process_user_cpu_clock > process_user_cpu_wstopclock;
- typedef wstopclock< boost::chrono::process_system_cpu_clock > process_system_cpu_wstopclock;
- typedef wstopclock< boost::chrono::process_cpu_clock > process_cpu_wstopclock;
-
+ typedef Clock clock;
+ typedef chrono::stopwatch<Clock> stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ explicit wstopclock(system::error_code & ec = BOOST_CHRONO_THROWS) :
+ base_type(ec)
+ {
+ }
+ explicit wstopclock(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec)
+ {
+ }
+
+ explicit wstopclock(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec)
+ {
+ }
+
+ explicit wstopclock(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec)
+ {
+ }
+
+ wstopclock(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec)
+ {
+ }
+
+ wstopclock(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec)
+ {
+ }
+
+ wstopclock(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec)
+ {
+ }
+
+ wstopclock(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec)
+ {
+ }
+
+ wstopclock(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec)
+ {
+ }
+
+ wstopclock(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec)
+ {
+ }
+
+ typedef stopwatch_runner<wstopclock> scoped_run;
+ typedef stopwatch_stopper<wstopclock> scoped_stop;
+ typedef stopwatch_suspender<wstopclock> scoped_suspend;
+ typedef stopwatch_resumer<wstopclock> scoped_resume;
+
+ };
+
+ typedef wstopclock<boost::chrono::system_clock> system_wstopclock;
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ typedef wstopclock<boost::chrono::steady_clock> steady_wstopclock;
+#endif
+ typedef wstopclock<boost::chrono::high_resolution_clock>
+ high_resolution_wstopclock;
+ typedef wstopclock<boost::chrono::process_real_cpu_clock>
+ process_real_cpu_wstopclock;
+ typedef wstopclock<boost::chrono::process_user_cpu_clock>
+ process_user_cpu_wstopclock;
+ typedef wstopclock<boost::chrono::process_system_cpu_clock>
+ process_system_cpu_wstopclock;
+ typedef wstopclock<boost::chrono::process_cpu_clock> process_cpu_wstopclock;
 
   } // namespace chrono
 } // namespace boost

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopclock_accumulator.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopclock_accumulator.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopclock_accumulator.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -19,268 +19,354 @@
 #include <boost/chrono/process_cpu_clocks.hpp>
 #include <boost/type_traits/is_same.hpp>
 
-namespace boost { namespace chrono {
-
-//--------------------------------------------------------------------------------------//
-//~ provides a everything a Timer provides and it adds reporting capabilities that can be invoked in a single line of code. The reporting is controleed by two parameters:
-
- //~ * format : The output format
- //~ * places(precission): the number of decimal placess used.
-
-//~ The default places is given by default_places and is 3. The default format is "\n%ts\n", where
-
- //~ * %t : the result of elapsed() when the reporting is done.
-
-//~ The time is given using the suffix "s" following the System International d'Unites Std.
-
-/* void f1()
- * {
- * stopclock<> _;
- * // ...
- * }
- */
-//--------------------------------------------------------------------------------------//
-
- template <class Clock, typename Features, typename Weight>
- struct stopwatch_reporter_default_formatter<stopwatch_accumulator<Clock, Features,Weight> > {
- typedef stopwatch_accumulator_formatter type;
- };
-
- template <class Clock, typename Features, typename Weight>
- struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<Clock, Features,Weight> > {
- typedef wstopwatch_accumulator_formatter type;
- };
-
- template <typename Features, typename Weight>
- struct stopwatch_reporter_default_formatter<stopwatch_accumulator<chrono::process_cpu_clock,Features,Weight> > {
- typedef stopwatch_accumulator_time_formatter type;
- };
-
- template <typename Features, typename Weight>
- struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<chrono::process_cpu_clock, Features,Weight> > {
- typedef wstopwatch_accumulator_time_formatter type;
- };
-
- template <typename Features, typename Weight>
- struct stopwatch_reporter_default_formatter<stopwatch_accumulator<chrono::suspendible_clock<chrono::process_cpu_clock>, Features,Weight> > {
- typedef stopwatch_reporter_default_formatter<stopwatch_accumulator<chrono::process_cpu_clock> >::type type;
- };
-
- template <typename Features, typename Weight>
- struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<chrono::suspendible_clock<chrono::process_cpu_clock>, Features,Weight> > {
- typedef wstopwatch_reporter_default_formatter<stopwatch_accumulator<chrono::process_cpu_clock> >::type type;
- };
-
-
- template <class Clock, class Formatter>
- class basic_stopclock_accumulator : public basic_stopwatch_reporter<stopwatch_accumulator<Clock>, Formatter> {
- typedef basic_stopwatch_reporter<stopwatch_accumulator<Clock>, Formatter> base_type;
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class Clock, typename Features, typename Weight>
+ struct stopwatch_reporter_default_formatter<stopwatch_accumulator<Clock,
+ Features, Weight> >
+ {
+ typedef stopwatch_accumulator_formatter type;
+ };
+
+ template<class Clock, typename Features, typename Weight>
+ struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<Clock,
+ Features, Weight> >
+ {
+ typedef wstopwatch_accumulator_formatter type;
+ };
+
+ template<typename Features, typename Weight>
+ struct stopwatch_reporter_default_formatter<stopwatch_accumulator<
+ chrono::process_cpu_clock, Features, Weight> >
+ {
+ typedef stopwatch_accumulator_time_formatter type;
+ };
+
+ template<typename Features, typename Weight>
+ struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<
+ chrono::process_cpu_clock, Features, Weight> >
+ {
+ typedef wstopwatch_accumulator_time_formatter type;
+ };
+
+ template<typename Features, typename Weight>
+ struct stopwatch_reporter_default_formatter<stopwatch_accumulator<
+ chrono::suspendible_clock<chrono::process_cpu_clock>, Features, Weight> >
+ {
+ typedef stopwatch_reporter_default_formatter<stopwatch_accumulator<
+ chrono::process_cpu_clock> >::type type;
+ };
+
+ template<typename Features, typename Weight>
+ struct wstopwatch_reporter_default_formatter<stopwatch_accumulator<
+ chrono::suspendible_clock<chrono::process_cpu_clock>, Features, Weight> >
+ {
+ typedef wstopwatch_reporter_default_formatter<stopwatch_accumulator<
+ chrono::process_cpu_clock> >::type type;
+ };
+
+ template<class Clock, class Formatter>
+ class basic_stopclock_accumulator: public basic_stopwatch_reporter<
+ stopwatch_accumulator<Clock> , Formatter>
+ {
+ typedef basic_stopwatch_reporter<stopwatch_accumulator<Clock> , Formatter>
+ base_type;
     public:
- typedef Clock clock;
- typedef stopwatch_accumulator<Clock> stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- explicit basic_stopclock_accumulator( system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(ec) { }
- explicit basic_stopclock_accumulator( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec) { }
-
- explicit basic_stopclock_accumulator( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec) { }
-
- explicit basic_stopclock_accumulator( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec) { }
-
- basic_stopclock_accumulator( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec) { }
-
- basic_stopclock_accumulator( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec) { }
-
- basic_stopclock_accumulator( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec) { }
-
- basic_stopclock_accumulator( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec) { }
-
- basic_stopclock_accumulator( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec) { }
-
- basic_stopclock_accumulator( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec) { }
-
-
- typedef stopwatch_runner<basic_stopclock_accumulator> scoped_run;
- typedef stopwatch_stopper<basic_stopclock_accumulator> scoped_stop;
- typedef stopwatch_suspender<basic_stopclock_accumulator> scoped_suspend;
- typedef stopwatch_resumer<basic_stopclock_accumulator> scoped_resume;
- };
-
- template <class Clock, class Formatter>
- struct stopwatch_reporter_default_formatter<basic_stopclock_accumulator<Clock,Formatter> > {
- typedef Formatter type;
- };
-
- template <class Clock=chrono::high_resolution_clock, class Formatter=typename stopwatch_reporter_default_formatter<stopwatch_accumulator<Clock> >::type>
+ typedef Clock clock;
+ typedef stopwatch_accumulator<Clock> stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ explicit basic_stopclock_accumulator(system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(ec)
+ {
+ }
+ explicit basic_stopclock_accumulator(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec)
+ {
+ }
+
+ explicit basic_stopclock_accumulator(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec)
+ {
+ }
+
+ explicit basic_stopclock_accumulator(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec)
+ {
+ }
+
+ basic_stopclock_accumulator(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec)
+ {
+ }
+
+ basic_stopclock_accumulator(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec)
+ {
+ }
+
+ basic_stopclock_accumulator(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec)
+ {
+ }
+
+ basic_stopclock_accumulator(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec)
+ {
+ }
+
+ basic_stopclock_accumulator(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec)
+ {
+ }
+
+ basic_stopclock_accumulator(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec)
+ {
+ }
+
+ typedef stopwatch_runner<basic_stopclock_accumulator> scoped_run;
+ typedef stopwatch_stopper<basic_stopclock_accumulator> scoped_stop;
+ typedef stopwatch_suspender<basic_stopclock_accumulator> scoped_suspend;
+ typedef stopwatch_resumer<basic_stopclock_accumulator> scoped_resume;
+ };
+
+ template<class Clock, class Formatter>
+ struct stopwatch_reporter_default_formatter<basic_stopclock_accumulator<
+ Clock, Formatter> >
+ {
+ typedef Formatter type;
+ };
+
+ template<class Clock = chrono::high_resolution_clock,
+ class Formatter = typename stopwatch_reporter_default_formatter<
+ stopwatch_accumulator<Clock> >::type>
     class stopclock_accumulator;
 
- template <class Clock, class Formatter>
- struct stopwatch_reporter_default_formatter<stopclock_accumulator<Clock,Formatter> > {
- typedef Formatter type;
+ template<class Clock, class Formatter>
+ struct stopwatch_reporter_default_formatter<stopclock_accumulator<Clock,
+ Formatter> >
+ {
+ typedef Formatter type;
     };
 
- template <class Clock, class Formatter>
- class stopclock_accumulator : public basic_stopclock_accumulator<Clock, Formatter> {
- typedef basic_stopclock_accumulator<Clock, Formatter> base_type;
+ template<class Clock, class Formatter>
+ class stopclock_accumulator: public basic_stopclock_accumulator<Clock,
+ Formatter>
+ {
+ typedef basic_stopclock_accumulator<Clock, Formatter> base_type;
     public:
- typedef Clock clock;
- typedef stopwatch_accumulator<Clock> stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- explicit stopclock_accumulator( system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(ec) { }
- explicit stopclock_accumulator( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec) { }
-
- explicit stopclock_accumulator( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec) { }
-
- explicit stopclock_accumulator( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec) { }
-
- stopclock_accumulator( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec) { }
-
- stopclock_accumulator( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec) { }
-
- stopclock_accumulator( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec) { }
-
- stopclock_accumulator( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec) { }
-
- stopclock_accumulator( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec) { }
-
- stopclock_accumulator( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec) { }
-
-
- typedef stopwatch_runner<stopclock_accumulator> scoped_run;
- typedef stopwatch_stopper<stopclock_accumulator> scoped_stop;
- typedef stopwatch_suspender<stopclock_accumulator> scoped_suspend;
- typedef stopwatch_resumer<stopclock_accumulator> scoped_resume;
- };
-
- typedef stopclock_accumulator< boost::chrono::system_clock > system_stopclock_accumulator;
- #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- typedef stopclock_accumulator< boost::chrono::steady_clock > steady_stopclock_accumulator;
- #endif
- typedef stopclock_accumulator< boost::chrono::high_resolution_clock > high_resolution_stopclock_accumulator;
- typedef stopclock_accumulator< boost::chrono::process_real_cpu_clock > process_real_cpu_stopclock_accumulator;
- typedef stopclock_accumulator< boost::chrono::process_user_cpu_clock > process_user_cpu_stopclock_accumulator;
- typedef stopclock_accumulator< boost::chrono::process_system_cpu_clock > process_system_cpu_stopclock_accumulator;
- typedef stopclock_accumulator< boost::chrono::process_cpu_clock > process_cpu_stopclock_accumulator;
-
- template <class Clock=chrono::high_resolution_clock, class Formatter=typename wstopwatch_reporter_default_formatter<stopwatch_accumulator<Clock> >::type>
+ typedef Clock clock;
+ typedef stopwatch_accumulator<Clock> stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ explicit stopclock_accumulator(system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(ec)
+ {
+ }
+ explicit stopclock_accumulator(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec)
+ {
+ }
+
+ explicit stopclock_accumulator(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec)
+ {
+ }
+
+ explicit stopclock_accumulator(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec)
+ {
+ }
+
+ stopclock_accumulator(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec)
+ {
+ }
+
+ stopclock_accumulator(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec)
+ {
+ }
+
+ stopclock_accumulator(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec)
+ {
+ }
+
+ stopclock_accumulator(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec)
+ {
+ }
+
+ stopclock_accumulator(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec)
+ {
+ }
+
+ stopclock_accumulator(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec)
+ {
+ }
+
+ typedef stopwatch_runner<stopclock_accumulator> scoped_run;
+ typedef stopwatch_stopper<stopclock_accumulator> scoped_stop;
+ typedef stopwatch_suspender<stopclock_accumulator> scoped_suspend;
+ typedef stopwatch_resumer<stopclock_accumulator> scoped_resume;
+ };
+
+ typedef stopclock_accumulator<boost::chrono::system_clock>
+ system_stopclock_accumulator;
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ typedef stopclock_accumulator<boost::chrono::steady_clock>
+ steady_stopclock_accumulator;
+#endif
+ typedef stopclock_accumulator<boost::chrono::high_resolution_clock>
+ high_resolution_stopclock_accumulator;
+ typedef stopclock_accumulator<boost::chrono::process_real_cpu_clock>
+ process_real_cpu_stopclock_accumulator;
+ typedef stopclock_accumulator<boost::chrono::process_user_cpu_clock>
+ process_user_cpu_stopclock_accumulator;
+ typedef stopclock_accumulator<boost::chrono::process_system_cpu_clock>
+ process_system_cpu_stopclock_accumulator;
+ typedef stopclock_accumulator<boost::chrono::process_cpu_clock>
+ process_cpu_stopclock_accumulator;
+
+ template<class Clock = chrono::high_resolution_clock,
+ class Formatter = typename wstopwatch_reporter_default_formatter<
+ stopwatch_accumulator<Clock> >::type>
     class wstopclock_accumulator;
 
- template <class Clock, class Formatter>
- struct stopwatch_reporter_default_formatter<wstopclock_accumulator<Clock,Formatter> > {
- typedef Formatter type;
+ template<class Clock, class Formatter>
+ struct stopwatch_reporter_default_formatter<wstopclock_accumulator<Clock,
+ Formatter> >
+ {
+ typedef Formatter type;
     };
 
- template <class Clock, class Formatter>
- class wstopclock_accumulator : public basic_stopclock_accumulator<Clock, Formatter> {
- typedef basic_stopclock_accumulator<Clock, Formatter> base_type;
+ template<class Clock, class Formatter>
+ class wstopclock_accumulator: public basic_stopclock_accumulator<Clock,
+ Formatter>
+ {
+ typedef basic_stopclock_accumulator<Clock, Formatter> base_type;
     public:
- typedef Clock clock;
- typedef stopwatch_accumulator<Clock> stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- explicit wstopclock_accumulator( system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(ec) { }
- explicit wstopclock_accumulator( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec) { }
-
- explicit wstopclock_accumulator( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec) { }
-
- explicit wstopclock_accumulator( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec) { }
-
- wstopclock_accumulator( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec) { }
-
- wstopclock_accumulator( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec) { }
-
- wstopclock_accumulator( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec) { }
-
- wstopclock_accumulator( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec) { }
-
- wstopclock_accumulator( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec) { }
-
- wstopclock_accumulator( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec) { }
-
-
- typedef stopwatch_runner<wstopclock_accumulator> scoped_run;
- typedef stopwatch_stopper<wstopclock_accumulator> scoped_stop;
- typedef stopwatch_suspender<wstopclock_accumulator> scoped_suspend;
- typedef stopwatch_resumer<wstopclock_accumulator> scoped_resume;
- };
-
- typedef wstopclock_accumulator< boost::chrono::system_clock > system_wstopclock_accumulator;
- #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- typedef wstopclock_accumulator< boost::chrono::steady_clock > steady_wstopclock_accumulator;
- #endif
- typedef wstopclock_accumulator< boost::chrono::high_resolution_clock > high_resolution_wstopclock_accumulator;
- typedef wstopclock_accumulator< boost::chrono::process_real_cpu_clock > process_real_cpu_wstopclock_accumulator;
- typedef wstopclock_accumulator< boost::chrono::process_user_cpu_clock > process_user_cpu_wstopclock_accumulator;
- typedef wstopclock_accumulator< boost::chrono::process_system_cpu_clock > process_system_cpu_wstopclock_accumulator;
- typedef wstopclock_accumulator< boost::chrono::process_cpu_clock > process_cpu_wstopclock_accumulator;
-
+ typedef Clock clock;
+ typedef stopwatch_accumulator<Clock> stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ explicit wstopclock_accumulator(system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(ec)
+ {
+ }
+ explicit wstopclock_accumulator(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec)
+ {
+ }
+
+ explicit wstopclock_accumulator(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec)
+ {
+ }
+
+ explicit wstopclock_accumulator(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec)
+ {
+ }
+
+ wstopclock_accumulator(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec)
+ {
+ }
+
+ wstopclock_accumulator(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec)
+ {
+ }
+
+ wstopclock_accumulator(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec)
+ {
+ }
+
+ wstopclock_accumulator(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec)
+ {
+ }
+
+ wstopclock_accumulator(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec)
+ {
+ }
+
+ wstopclock_accumulator(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec)
+ {
+ }
+
+ typedef stopwatch_runner<wstopclock_accumulator> scoped_run;
+ typedef stopwatch_stopper<wstopclock_accumulator> scoped_stop;
+ typedef stopwatch_suspender<wstopclock_accumulator> scoped_suspend;
+ typedef stopwatch_resumer<wstopclock_accumulator> scoped_resume;
+ };
+
+ typedef wstopclock_accumulator<boost::chrono::system_clock>
+ system_wstopclock_accumulator;
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ typedef wstopclock_accumulator<boost::chrono::steady_clock>
+ steady_wstopclock_accumulator;
+#endif
+ typedef wstopclock_accumulator<boost::chrono::high_resolution_clock>
+ high_resolution_wstopclock_accumulator;
+ typedef wstopclock_accumulator<boost::chrono::process_real_cpu_clock>
+ process_real_cpu_wstopclock_accumulator;
+ typedef wstopclock_accumulator<boost::chrono::process_user_cpu_clock>
+ process_user_cpu_wstopclock_accumulator;
+ typedef wstopclock_accumulator<boost::chrono::process_system_cpu_clock>
+ process_system_cpu_wstopclock_accumulator;
+ typedef wstopclock_accumulator<boost::chrono::process_cpu_clock>
+ process_cpu_wstopclock_accumulator;
 
   } // namespace chrono
 } // namespace boost

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopwatch.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopwatch.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopwatch.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -19,62 +19,79 @@
   namespace chrono
   {
 
- struct lightweight_stopwatch_identity_traits {
- template <typename D>
- struct apply {
- struct type {
- typedef D duration_type;
- typedef duration_type storage_type;
- static duration_type get_duration(storage_type& acc_) { return acc_; }
- static void set_duration(storage_type& acc_, duration_type d) { acc_=d; }
- static void reset(storage_type& acc_) { acc_=storage_type(); }
- };
+ struct lightweight_stopwatch_identity_traits
+ {
+ template<typename D>
+ struct apply
+ {
+ struct type
+ {
+ typedef D duration_type;
+ typedef duration_type storage_type;
+ static duration_type get_duration(storage_type& acc_)
+ {
+ return acc_;
+ }
+ static void set_duration(storage_type& acc_, duration_type d)
+ {
+ acc_ = d;
+ }
+ static void reset(storage_type& acc_)
+ {
+ acc_ = storage_type();
+ }
         };
+ };
 
     };
 
-//--------------------------------------------------------------------------------------//
-// stopwatch
-//
-//~ A stopwatch is a class designed to measure the amount of time elapsed from a particular time
-//~ when activated to when it is deactivated.
-
-//~ Calling start starts the stopwatch running, and calling stop stops it.
-//~ A call to reset resets the stopwatch to zero.
-//~ A stopwatch can also also used to record split times or lap times.
-//~ The elapsed time since the last start is available through the elapsed function.
-//--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
+ // stopwatch
+ //
+ //~ A stopwatch is a class designed to measure the amount of time elapsed from a particular time
+ //~ when activated to when it is deactivated.
+
+ //~ Calling start starts the stopwatch running, and calling stop stops it.
+ //~ A call to reset resets the stopwatch to zero.
+ //~ A stopwatch can also also used to record split times or lap times.
+ //~ The elapsed time since the last start is available through the elapsed function.
+ //--------------------------------------------------------------------------------------//
 
     //~ template <class Clock=chrono::high_resolution_clock>
- template <class Clock=chrono::system_clock>
+ template<class Clock = chrono::system_clock>
     class stopwatch;
 
-//--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
 
- template <class Clock>
- class stopwatch : private base_from_member<typename Clock::duration>, public lightweight_stopwatch<Clock,lightweight_stopwatch_identity_traits>
+ template<class Clock>
+ class stopwatch: private base_from_member<typename Clock::duration> , public lightweight_stopwatch<
+ Clock, lightweight_stopwatch_identity_traits>
     {
     public:
- typedef base_from_member<typename Clock::duration> pbase_type;
- explicit stopwatch( system::error_code & ec = BOOST_CHRONO_THROWS )
- : pbase_type(), lightweight_stopwatch<Clock,lightweight_stopwatch_identity_traits>(pbase_type::member, ec)
- {
- }
+ typedef base_from_member<typename Clock::duration> pbase_type;
+ explicit stopwatch(system::error_code & ec = BOOST_CHRONO_THROWS) :
+ pbase_type(),
+ lightweight_stopwatch<Clock, lightweight_stopwatch_identity_traits> (pbase_type::member, ec)
+ {
+ }
+
+ explicit stopwatch(const dont_start_t& t) :
+ pbase_type(),
+ lightweight_stopwatch<Clock, lightweight_stopwatch_identity_traits> (pbase_type::member, t)
+ {
+ }
 
- explicit stopwatch( const dont_start_t& t )
- : pbase_type(), lightweight_stopwatch<Clock,lightweight_stopwatch_identity_traits>(pbase_type::member, t)
- { }
-
     };
 
-//--------------------------------------------------------------------------------------//
- typedef boost::chrono::stopwatch< boost::chrono::system_clock > system_stopwatch;
+ //--------------------------------------------------------------------------------------//
+ typedef boost::chrono::stopwatch<boost::chrono::system_clock>
+ system_stopwatch;
 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- typedef boost::chrono::stopwatch< boost::chrono::steady_clock > steady_stopwatch;
+ typedef boost::chrono::stopwatch<boost::chrono::steady_clock>
+ steady_stopwatch;
 #endif
- typedef boost::chrono::stopwatch< boost::chrono::high_resolution_clock > high_resolution_stopwatch;
-
-
+ typedef boost::chrono::stopwatch<boost::chrono::high_resolution_clock>
+ high_resolution_stopwatch;
 
   } // namespace chrono
 } // namespace boost

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -26,73 +26,89 @@
   namespace chrono
   {
 
- template <typename Features, typename Weight=void>
- struct lightweight_stopwatch_accumulator_set_traits {
- template <typename D>
- struct apply {
- struct type {
- typedef accumulators::accumulator_set<typename D::rep, Features, Weight> storage_type;
- typedef D duration_type;
- static duration_type get_duration(storage_type& acc_) { return duration_type(accumulators::sum(acc_)); }
- static void set_duration(storage_type& acc_, duration_type d) { acc_(d.count()); }
- static void reset(storage_type& acc_) { acc_=storage_type(); }
- };
+ template<typename Features, typename Weight = void>
+ struct lightweight_stopwatch_accumulator_set_traits
+ {
+ template<typename D>
+ struct apply
+ {
+ struct type
+ {
+ typedef accumulators::accumulator_set<typename D::rep, Features,
+ Weight> storage_type;
+ typedef D duration_type;
+ static duration_type get_duration(storage_type& acc_)
+ {
+ return duration_type(accumulators::sum(acc_));
+ }
+ static void set_duration(storage_type& acc_, duration_type d)
+ {
+ acc_(d.count());
+ }
+ static void reset(storage_type& acc_)
+ {
+ acc_ = storage_type();
+ }
         };
+ };
     };
 
-//--------------------------------------------------------------------------------------//
-// stopwatch_accumulator
-//
-//~ A stopwatch accumulator is a class designed to measure the amount of time elapsed from a particular time
-//~ when activated to when it is deactivated.
-
-//~ Calling start starts the stopwatch_accumulator running, and calling stop stops it.
-//~ A call to reset resets the stopwatch_accumulator to zero.
-//~ A stopwatch_accumulator can also be used to record split times or lap times.
-//~ The elapsed time since the last start is available through the elapsed function.
-//--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
+ // stopwatch_accumulator
+ //
+ //~ A stopwatch accumulator is a class designed to measure the amount of time elapsed from a particular time
+ //~ when activated to when it is deactivated.
+
+ //~ Calling start starts the stopwatch_accumulator running, and calling stop stops it.
+ //~ A call to reset resets the stopwatch_accumulator to zero.
+ //~ A stopwatch_accumulator can also be used to record split times or lap times.
+ //~ The elapsed time since the last start is available through the elapsed function.
+ //--------------------------------------------------------------------------------------//
 
     // forward declaration
- template <class Clock=chrono::high_resolution_clock,
- typename Features=accumulators::features<
- accumulators::tag::count,
- accumulators::tag::sum,
- accumulators::tag::min,
- accumulators::tag::max,
- accumulators::tag::mean >,
- typename Weight=void
- >
+ template<class Clock = chrono::high_resolution_clock,
+ typename Features = accumulators::features<accumulators::tag::count,
+ accumulators::tag::sum, accumulators::tag::min,
+ accumulators::tag::max, accumulators::tag::mean>,
+ typename Weight = void>
     class stopwatch_accumulator;
 
+ //--------------------------------------------------------------------------------------//
 
-//--------------------------------------------------------------------------------------//
-
- template <class Clock, typename Features, typename Weight>
- class stopwatch_accumulator
- : private base_from_member<
- typename accumulators::accumulator_set<typename Clock::duration::rep, Features, Weight>
- //~ typename lightweight_stopwatch_accumulator_set_traits<Features,Weight>::template apply<Clock::duration>::storage_type
- >,
- public lightweight_stopwatch<Clock,lightweight_stopwatch_accumulator_set_traits<Features,Weight> >
+ template<class Clock, typename Features, typename Weight>
+ class stopwatch_accumulator: private base_from_member<
+ typename accumulators::accumulator_set<typename Clock::duration::rep,
+ Features, Weight>
+ //~ typename lightweight_stopwatch_accumulator_set_traits<Features,Weight>::template apply<Clock::duration>::storage_type
+ > , public lightweight_stopwatch<Clock,
+ lightweight_stopwatch_accumulator_set_traits<Features, Weight> >
     {
     public:
- typedef base_from_member<typename accumulators::accumulator_set<typename Clock::duration::rep, Features, Weight> > pbase_type;
- typedef typename accumulators::accumulator_set<typename Clock::duration::rep, Features, Weight> accumulator_set;
-
- stopwatch_accumulator( )
- : pbase_type(),
- lightweight_stopwatch<Clock,lightweight_stopwatch_accumulator_set_traits<Features,Weight> >(pbase_type::member, dont_start)
- { }
+ typedef base_from_member<typename accumulators::accumulator_set<
+ typename Clock::duration::rep, Features, Weight> > pbase_type;
+ typedef typename accumulators::accumulator_set<
+ typename Clock::duration::rep, Features, Weight> accumulator_set;
+
+ stopwatch_accumulator() :
+ pbase_type(),
+ lightweight_stopwatch<Clock,
+ lightweight_stopwatch_accumulator_set_traits<Features, Weight> > (pbase_type::member, dont_start)
+ {
+ }
     };
 
-//--------------------------------------------------------------------------------------//
- typedef boost::chrono::stopwatch_accumulator< boost::chrono::system_clock > system_stopwatch_accumulator;
+ //--------------------------------------------------------------------------------------//
+ typedef boost::chrono::stopwatch_accumulator<boost::chrono::system_clock>
+ system_stopwatch_accumulator;
 #ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
- typedef boost::chrono::stopwatch_accumulator< boost::chrono::steady_clock > steady_stopwatch_accumulator;
+ typedef boost::chrono::stopwatch_accumulator<boost::chrono::steady_clock>
+ steady_stopwatch_accumulator;
 #endif
- typedef boost::chrono::stopwatch_accumulator< boost::chrono::high_resolution_clock > high_resolution_stopwatch_accumulator;
+ typedef boost::chrono::stopwatch_accumulator<
+ boost::chrono::high_resolution_clock>
+ high_resolution_stopwatch_accumulator;
 
-//--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
 
 
   } // namespace chrono

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator_formatter.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator_formatter.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator_formatter.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -29,132 +29,164 @@
 
 #define BOOST_STOPWATCHES_ACCUMULATOR_FORMAT_DEFAULT "%c times, sum=%ss, min=%ms, max=%Ms, mean=%as, frequency=%fHz, lifetime=%ls, percentage=%p%\n"
 
-
-namespace boost { namespace chrono {
-
-//--------------------------------------------------------------------------------------//
-//--------------------------------------------------------------------------------------//
-
- template <
- typename CharT=char,
- typename Traits=std::char_traits<CharT>,
- class Alloc=std::allocator<CharT>
- >
- class basic_stopwatch_accumulator_formatter {
+namespace boost
+{
+ namespace chrono
+ {
+
+ //--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
+
+ template<typename CharT = char, typename Traits = std::char_traits<CharT>,
+ class Alloc = std::allocator<CharT> >
+ class basic_stopwatch_accumulator_formatter
+ {
     public:
- typedef std::basic_string<CharT,Traits,Alloc> string_type;
- typedef CharT char_type;
- typedef std::basic_ostream<CharT,Traits> ostream_type;
-
- static ostream_type & default_os();
- static const char_type* default_format();
- static string_type format(const char_type* s) {
- string_type res(s);
- res += boost::chrono::detail::adaptive_string(" : ");
- res += default_format();
- return res;
+ typedef std::basic_string<CharT, Traits, Alloc> string_type;
+ typedef CharT char_type;
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ static ostream_type & default_os();
+ static const char_type* default_format();
+ static string_type format(const char_type* s)
+ {
+ string_type res(s);
+ res += boost::chrono::detail::adaptive_string(" : ");
+ res += default_format();
+ return res;
+ }
+ static int default_places()
+ {
+ return 3;
+ }
+
+ template<class Stopwatch>
+ static void show_time(Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, system::error_code & ec)
+ // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
+ // be as low as 10, although will be 15 for many common platforms.
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ ec.clear();
         }
- static int default_places() { return 3; }
+ typedef typename Stopwatch::storage_type accumulator;
+ typedef typename Stopwatch::duration duration_t;
+ accumulator& acc = stopwatch_.get_storage();
+ duration_t lt = stopwatch_.lifetime(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
+ }
+ //if ( d < duration_t::zero() ) return;
+ if (places > 9)
+ places = 9; // sanity check
+ else if (places < 0)
+ places = 0;
+
+ boost::io::ios_flags_saver ifs(os);
+ os.setf(std::ios_base::fixed, std::ios_base::floatfield);
+ boost::io::ios_precision_saver ips(os);
+ os.precision(places);
 
- template <class Stopwatch >
- static void show_time( Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, system::error_code & ec)
- // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
- // be as low as 10, although will be 15 for many common platforms.
+ for (; *format; ++format)
         {
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- ec.clear();
- }
- typedef typename Stopwatch::storage_type accumulator;
- typedef typename Stopwatch::duration duration_t;
- accumulator& acc = stopwatch_.get_storage();
- duration_t lt= stopwatch_.lifetime(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- //if ( d < duration_t::zero() ) return;
- if ( places > 9 )
- places = 9; // sanity check
- else if ( places < 0 )
- places = 0;
-
- boost::io::ios_flags_saver ifs( os );
- os.setf( std::ios_base::fixed, std::ios_base::floatfield );
- boost::io::ios_precision_saver ips( os );
- os.precision( places );
-
- for ( ; *format; ++format ) {
- if ( (*format != '%') || (!*(format+1)) || (!std::strchr("acflmMps", *(format+1))) ) {
- os << *format;
- } else {
- ++format;
- switch ( *format ) {
- case 's':
- os << boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count();
- break;
- case 'm':
- os << boost::chrono::duration<double>(duration_t((accumulators::min)(acc))).count();
- break;
- case 'M':
- os << boost::chrono::duration<double>(duration_t((accumulators::max)(acc))).count();
- break;
- case 'a':
- os << ((accumulators::count(acc)>0)
- //? boost::chrono::duration<double>(duration_t(typename duration_t::rep(accumulators::mean(acc)))).count()
- ? boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count() / accumulators::count(acc)
- : 0);
- break;
- case 'c':
- os << accumulators::count(acc);
- break;
- case 'f':
- os << ((accumulators::count(acc)>0)
- ? accumulators::count(acc)/boost::chrono::duration<double>(lt)
- : 0);
- break;
- case 'l':
- os << boost::chrono::duration<double>(lt).count();
- break;
- case 'p':
- os << int(boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count()*100/boost::chrono::duration<double>(lt).count());
- break;
- default:
- BOOST_ASSERT(0 && "basic_stopwatch_accumulator_formatter internal logic error");
- }
- }
+ if ((*format != '%') || (!*(format + 1))
+ || (!std::strchr("acflmMps", *(format + 1))))
+ {
+ os << *format;
+ } else
+ {
+ ++format;
+ switch (*format)
+ {
+ case 's':
+ os
+ << boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count();
+ break;
+ case 'm':
+ os
+ << boost::chrono::duration<double>(duration_t((accumulators::min)(acc))).count();
+ break;
+ case 'M':
+ os
+ << boost::chrono::duration<double>(duration_t((accumulators::max)(acc))).count();
+ break;
+ case 'a':
+ os
+ << ((accumulators::count(acc) > 0)
+ //? boost::chrono::duration<double>(duration_t(typename duration_t::rep(accumulators::mean(acc)))).count()
+ ? boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count()
+ / accumulators::count(acc) : 0);
+ break;
+ case 'c':
+ os << accumulators::count(acc);
+ break;
+ case 'f':
+ os << ((accumulators::count(acc) > 0) ? accumulators::count(acc)
+ / boost::chrono::duration<double>(lt) : 0);
+ break;
+ case 'l':
+ os << boost::chrono::duration<double>(lt).count();
+ break;
+ case 'p':
+ os
+ << int(boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count()
+ * 100 / boost::chrono::duration<double>(lt).count());
+ break;
+ default:
+ BOOST_ASSERT(0 && "basic_stopwatch_accumulator_formatter internal logic error");
             }
+ }
         }
+ }
     };
 
-namespace detail {
- template <typename CharT>
- struct basic_stopwatch_accumulator_formatter_default_format;
- template <>
- struct basic_stopwatch_accumulator_formatter_default_format<char> {
- static const char* apply() {return BOOST_STOPWATCHES_ACCUMULATOR_FORMAT_DEFAULT; }
- };
+ namespace detail
+ {
+ template<typename CharT>
+ struct basic_stopwatch_accumulator_formatter_default_format;
+ template<>
+ struct basic_stopwatch_accumulator_formatter_default_format<char>
+ {
+ static const char* apply()
+ {
+ return BOOST_STOPWATCHES_ACCUMULATOR_FORMAT_DEFAULT;
+ }
+ };
 #ifndef BOOST_NO_STD_WSTRING
- template <>
- struct basic_stopwatch_accumulator_formatter_default_format<wchar_t> {
- static const wchar_t* apply() {return L"%c times, sum=%ss, min=%ms, max=%Ms, mean=%as, frequency=%fHz, lifetime=%ls, percentage=%p%\n"; }
- };
+ template<>
+ struct basic_stopwatch_accumulator_formatter_default_format<wchar_t>
+ {
+ static const wchar_t* apply()
+ {
+ return L"%c times, sum=%ss, min=%ms, max=%Ms, mean=%as, frequency=%fHz, lifetime=%ls, percentage=%p%\n";
+ }
+ };
 
 #endif
-}
+ }
 
- template <typename CharT,typename Traits, class Alloc>
- const typename basic_stopwatch_accumulator_formatter<CharT,Traits,Alloc>::char_type*
- basic_stopwatch_accumulator_formatter<CharT,Traits,Alloc>::default_format() {
- return detail::basic_stopwatch_accumulator_formatter_default_format<CharT>::apply();
+ template<typename CharT, typename Traits, class Alloc>
+ const typename basic_stopwatch_accumulator_formatter<CharT, Traits, Alloc>::char_type*
+ basic_stopwatch_accumulator_formatter<CharT, Traits, Alloc>::default_format()
+ {
+ return detail::basic_stopwatch_accumulator_formatter_default_format<CharT>::apply();
     }
 
- template <typename CharT,typename Traits, class Alloc>
- typename basic_stopwatch_accumulator_formatter<CharT,Traits,Alloc>::ostream_type &
- basic_stopwatch_accumulator_formatter<CharT,Traits,Alloc>::default_os() { return detail::default_out<CharT,Traits>::apply(); }
+ template<typename CharT, typename Traits, class Alloc>
+ typename basic_stopwatch_accumulator_formatter<CharT, Traits, Alloc>::ostream_type &
+ basic_stopwatch_accumulator_formatter<CharT, Traits, Alloc>::default_os()
+ {
+ return detail::default_out<CharT, Traits>::apply();
+ }
 
- typedef basic_stopwatch_accumulator_formatter<char> stopwatch_accumulator_formatter;
- typedef basic_stopwatch_accumulator_formatter<wchar_t> wstopwatch_accumulator_formatter;
+ typedef basic_stopwatch_accumulator_formatter<char>
+ stopwatch_accumulator_formatter;
+ typedef basic_stopwatch_accumulator_formatter<wchar_t>
+ wstopwatch_accumulator_formatter;
 
-} // namespace chrono
+ } // namespace chrono
 } // namespace boost
 
 #define BOOST_STOPWATCHES_ACCUMULATOR_FORMAT(F) boost::chrono::detail::adaptive_string(F " : " BOOST_STOPWATCHES_ACCUMULATOR_FORMAT_DEFAULT)

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator_time_formatter.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator_time_formatter.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_accumulator_time_formatter.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -31,162 +31,196 @@
 //~ #define BOOST_STOPWATCHES_ACCUMULATOR_TIME_FORMAT_DEFAULT "%c times, sum=%s, min=%m, max=%M, mean=%a, frequency=%fHz, lifetime=%ls, percentage=%p%|real %rs, cpu %cs (%p%), user %us, system %ss\n"
 #define BOOST_STOPWATCHES_ACCUMULATOR_TIME_FORMAT_DEFAULT "%c times, sum %s, min %m, max %M, mean=%a, frequency=%fHz, lifetime=%ls, percentage=%p%\n"
 
-
-namespace boost { namespace chrono {
-
-//--------------------------------------------------------------------------------------//
-//--------------------------------------------------------------------------------------//
-
- template <
- typename CharT=char,
- typename Traits=std::char_traits<CharT>,
- class Alloc=std::allocator<CharT>
- >
- class basic_stopwatch_accumulator_time_formatter {
+namespace boost
+{
+ namespace chrono
+ {
+
+ //--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
+
+ template<typename CharT = char, typename Traits = std::char_traits<CharT>,
+ class Alloc = std::allocator<CharT> >
+ class basic_stopwatch_accumulator_time_formatter
+ {
     public:
- typedef std::basic_string<CharT,Traits,Alloc> string_type;
- typedef CharT char_type;
- typedef std::basic_ostream<CharT,Traits> ostream_type;
-
- static ostream_type & default_os();
- static const char_type* default_format();
- static string_type format(const char_type* s) {
- string_type res(s);
- res += boost::chrono::detail::adaptive_string(" : ");
- res += default_format();
- return res;
- }
- static int default_places() { return 3; }
+ typedef std::basic_string<CharT, Traits, Alloc> string_type;
+ typedef CharT char_type;
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ static ostream_type & default_os();
+ static const char_type* default_format();
+ static string_type format(const char_type* s)
+ {
+ string_type res(s);
+ res += boost::chrono::detail::adaptive_string(" : ");
+ res += default_format();
+ return res;
+ }
+ static int default_places()
+ {
+ return 3;
+ }
+
+ template<class Stopwatch>
+ static void show_time(Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, system::error_code & ec)
+ // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
+ // be as low as 10, although will be 15 for many common platforms.
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ typedef typename Stopwatch::storage_type accumulator;
+ typedef typename Stopwatch::duration duration_t;
+ accumulator& acc = stopwatch_.get_storage();
+ duration_t lt = stopwatch_.lifetime();
+
+ //if ( d < duration_t::zero() ) return;
+ if (places > 9)
+ places = 9; // sanity check
+ else if (places < 0)
+ places = 0;
+
+ boost::io::ios_flags_saver ifs(os);
+ os.setf(std::ios_base::fixed, std::ios_base::floatfield);
+ boost::io::ios_precision_saver ips(os);
+ os.precision(places);
+
+ const char_type* format2 = BOOST_STOPWATCHES_TIME_FORMAT_DEFAULT;
+ //~ for (format2=format ; *format2; ++format2 ) {
+ //~ if (*format2=='|') {++format2; break;}
+ //~ }
 
- template <class Stopwatch >
- static void show_time( Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, system::error_code & ec)
- // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
- // be as low as 10, although will be 15 for many common platforms.
+ for (; *format; ++format)
         {
- if (!BOOST_CHRONO_IS_THROWS(ec))
- ec.clear();
- typedef typename Stopwatch::storage_type accumulator;
- typedef typename Stopwatch::duration duration_t;
- accumulator& acc = stopwatch_.get_storage();
- duration_t lt= stopwatch_.lifetime();
-
- //if ( d < duration_t::zero() ) return;
- if ( places > 9 )
- places = 9; // sanity check
- else if ( places < 0 )
- places = 0;
-
- boost::io::ios_flags_saver ifs( os );
- os.setf( std::ios_base::fixed, std::ios_base::floatfield );
- boost::io::ios_precision_saver ips( os );
- os.precision( places );
-
- const char_type* format2=BOOST_STOPWATCHES_TIME_FORMAT_DEFAULT;
- //~ for (format2=format ; *format2; ++format2 ) {
- //~ if (*format2=='|') {++format2; break;}
- //~ }
-
- for ( ; *format; ++format ) {
- if ( (*format != '%') || (!*(format+1)) || (!std::strchr("acflmMps", *(format+1))) ) {
- os << *format;
- } else {
- ++format;
- switch ( *format ) {
- case 's':
- //~ os << boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count();
- time_formatter::show_time<chrono::process_cpu_clock>(accumulators::sum(acc), format2, places, os, ec);
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- //~ os << accumulators::sum(acc);
- break;
- case 'm':
- //~ os << boost::chrono::duration<double>(duration_t((accumulators::min)(acc))).count();
- time_formatter::show_time<chrono::process_cpu_clock>((accumulators::min)(acc), format2, places, os, ec);
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- //~ os << (accumulators::min)(acc);
- break;
- case 'M':
- //~ os << boost::chrono::duration<double>(duration_t((accumulators::max)(acc))).count();
- time_formatter::show_time<chrono::process_cpu_clock>((accumulators::max)(acc), format2, places, os, ec);
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- //~ os << (accumulators::max)(acc);
- break;
- case 'a':
- if (accumulators::count(acc)>0) {
- //? os << boost::chrono::duration<double>(duration_t(typename duration_t::rep(accumulators::mean(acc)))).count()
- //~ os << boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count() / accumulators::count(acc)
- time_formatter::show_time<chrono::process_cpu_clock>(accumulators::sum(acc) / accumulators::count(acc), format2, places, os, ec);
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- } else {
- os << 0;
- }
- break;
- case 'c':
- os << accumulators::count(acc);
- break;
- case 'f':
- if (accumulators::count(acc)>0)
- //~ os << accumulators::count(acc)/boost::chrono::duration<double>(lt);
- os << accumulators::count(acc) << "/" << lt.count();
- else
- os << 0;
- break;
- case 'l':
- os << lt.count();
- break;
- case 'p':
- //~ os << int(boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count()*100/boost::chrono::duration<double>(lt).count());
- os << accumulators::sum(acc)*100 << "/" << lt.count();
- break;
- default:
- BOOST_ASSERT(0 && "basic_stopwatch_accumulator_time_formatter internal logic error");
- }
+ if ((*format != '%') || (!*(format + 1))
+ || (!std::strchr("acflmMps", *(format + 1))))
+ {
+ os << *format;
+ } else
+ {
+ ++format;
+ switch (*format)
+ {
+ case 's':
+ //~ os << boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count();
+ time_formatter::show_time<chrono::process_cpu_clock>(accumulators::sum(acc), format2, places, os, ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
+ }
+ //~ os << accumulators::sum(acc);
+ break;
+ case 'm':
+ //~ os << boost::chrono::duration<double>(duration_t((accumulators::min)(acc))).count();
+ time_formatter::show_time<chrono::process_cpu_clock>((accumulators::min)(acc), format2, places, os, ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
+ }
+ //~ os << (accumulators::min)(acc);
+ break;
+ case 'M':
+ //~ os << boost::chrono::duration<double>(duration_t((accumulators::max)(acc))).count();
+ time_formatter::show_time<chrono::process_cpu_clock>((accumulators::max)(acc), format2, places, os, ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
+ }
+ //~ os << (accumulators::max)(acc);
+ break;
+ case 'a':
+ if (accumulators::count(acc) > 0)
+ {
+ //? os << boost::chrono::duration<double>(duration_t(typename duration_t::rep(accumulators::mean(acc)))).count()
+ //~ os << boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count() / accumulators::count(acc)
+ time_formatter::show_time<chrono::process_cpu_clock>(accumulators::sum(acc)
+ / accumulators::count(acc), format2, places, os, ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
                 }
+ } else
+ {
+ os << 0;
+ }
+ break;
+ case 'c':
+ os << accumulators::count(acc);
+ break;
+ case 'f':
+ if (accumulators::count(acc) > 0)
+ //~ os << accumulators::count(acc)/boost::chrono::duration<double>(lt);
+ os << accumulators::count(acc) << "/" << lt.count();
+ else
+ os << 0;
+ break;
+ case 'l':
+ os << lt.count();
+ break;
+ case 'p':
+ //~ os << int(boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count()*100/boost::chrono::duration<double>(lt).count());
+ os << accumulators::sum(acc) * 100 << "/" << lt.count();
+ break;
+ default:
+ BOOST_ASSERT(0 && "basic_stopwatch_accumulator_time_formatter internal logic error");
             }
+ }
         }
+ }
     };
 
-namespace detail {
- template <typename CharT>
- struct basic_stopwatch_accumulator_time_formatter_default_format;
- template <>
- struct basic_stopwatch_accumulator_time_formatter_default_format<char> {
- static const char* apply() {return BOOST_STOPWATCHES_ACCUMULATOR_TIME_FORMAT_DEFAULT; }
- };
+ namespace detail
+ {
+ template<typename CharT>
+ struct basic_stopwatch_accumulator_time_formatter_default_format;
+ template<>
+ struct basic_stopwatch_accumulator_time_formatter_default_format<char>
+ {
+ static const char* apply()
+ {
+ return BOOST_STOPWATCHES_ACCUMULATOR_TIME_FORMAT_DEFAULT;
+ }
+ };
 #ifndef BOOST_NO_STD_WSTRING
- template <>
- struct basic_stopwatch_accumulator_time_formatter_default_format<wchar_t> {
+ template<>
+ struct basic_stopwatch_accumulator_time_formatter_default_format<wchar_t>
+ {
         //~ static const wchar_t* apply() {return L"%c times, sum=%ss, min=%ms, max=%Ms, mean=%as, frequency=%fHz, lifetime=%ls, percentage=%p%|real %rs, cpu %cs (%p%), user %us, system %ss\n"; }
- static const wchar_t* apply() {return L"%c times, sum %s, min %m, max %M, mean %a, frequency=%fHz, lifetime=%ls, percentage=%p%\n"; }
- };
+ static const wchar_t* apply()
+ {
+ return L"%c times, sum %s, min %m, max %M, mean %a, frequency=%fHz, lifetime=%ls, percentage=%p%\n";
+ }
+ };
 
 #endif
-}
-
- template <typename CharT,typename Traits, class Alloc>
- const typename basic_stopwatch_accumulator_time_formatter<CharT,Traits,Alloc>::char_type*
- basic_stopwatch_accumulator_time_formatter<CharT,Traits,Alloc>::default_format() {
- return detail::basic_stopwatch_accumulator_time_formatter_default_format<CharT>::apply();
     }
 
- template <typename CharT,typename Traits, class Alloc>
- typename basic_stopwatch_accumulator_time_formatter<CharT,Traits,Alloc>::ostream_type &
- basic_stopwatch_accumulator_time_formatter<CharT,Traits,Alloc>::default_os() { return detail::default_out<CharT,Traits>::apply(); }
-
- typedef basic_stopwatch_accumulator_time_formatter<char> stopwatch_accumulator_time_formatter;
- typedef basic_stopwatch_accumulator_time_formatter<wchar_t> wstopwatch_accumulator_time_formatter;
-
+ template<typename CharT, typename Traits, class Alloc>
+ const typename basic_stopwatch_accumulator_time_formatter<CharT, Traits,
+ Alloc>::char_type*
+ basic_stopwatch_accumulator_time_formatter<CharT, Traits, Alloc>::default_format()
+ {
+ return detail::basic_stopwatch_accumulator_time_formatter_default_format<
+ CharT>::apply();
+ }
 
+ template<typename CharT, typename Traits, class Alloc>
+ typename basic_stopwatch_accumulator_time_formatter<CharT, Traits, Alloc>::ostream_type &
+ basic_stopwatch_accumulator_time_formatter<CharT, Traits, Alloc>::default_os()
+ {
+ return detail::default_out<CharT, Traits>::apply();
+ }
 
+ typedef basic_stopwatch_accumulator_time_formatter<char>
+ stopwatch_accumulator_time_formatter;
+ typedef basic_stopwatch_accumulator_time_formatter<wchar_t>
+ wstopwatch_accumulator_time_formatter;
 
-} // namespace chrono
+ } // namespace chrono
 } // namespace boost
 
 #define BOOST_STOPWATCHES_ACCUMULATOR_TIME_FORMAT(F) boost::chrono::detail::adaptive_string(F " : " BOOST_STOPWATCHES_ACCUMULATOR_TIME_FORMAT_DEFAULT)

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_formatter.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_formatter.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_formatter.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -22,96 +22,118 @@
 
 #define BOOST_STOPWATCHES_STOPWATCH_FORMAT_DEFAULT "%ds\n"
 
-namespace boost { namespace chrono {
+namespace boost
+{
+ namespace chrono
+ {
+
+ //--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
 
-//--------------------------------------------------------------------------------------//
-//--------------------------------------------------------------------------------------//
 
-
- template <
- typename CharT=char,
- typename Traits=std::char_traits<CharT>,
- class Alloc=std::allocator<CharT>
- >
- class basic_stopwatch_formatter {
+ template<typename CharT = char, typename Traits = std::char_traits<CharT>,
+ class Alloc = std::allocator<CharT> >
+ class basic_stopwatch_formatter
+ {
     public:
- typedef std::basic_string<CharT,Traits,Alloc> string_type;
- typedef CharT char_type;
- typedef std::basic_ostream<CharT,Traits> ostream_type;
-
- static ostream_type & default_os();
- static const char_type* default_format();
- static string_type format(const char_type* s) {
- string_type res(s);
- //res += boost::chrono::detail::adaptive_string(" tokes %ds\n");
- res += boost::chrono::detail::adaptive_string(" : ");
- res += default_format();
- return res;
- }
- static int default_places() { return 3; }
+ typedef std::basic_string<CharT, Traits, Alloc> string_type;
+ typedef CharT char_type;
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ static ostream_type & default_os();
+ static const char_type* default_format();
+ static string_type format(const char_type* s)
+ {
+ string_type res(s);
+ //res += boost::chrono::detail::adaptive_string(" tokes %ds\n");
+ res += boost::chrono::detail::adaptive_string(" : ");
+ res += default_format();
+ return res;
+ }
+ static int default_places()
+ {
+ return 3;
+ }
+
+ template<class Stopwatch>
+ static void show_time(Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, system::error_code & ec)
+ // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
+ // be as low as 10, although will be 15 for many common platforms.
+ {
+ typedef typename Stopwatch::duration duration_t;
+ duration_t d = stopwatch_.elapsed(ec);
+
+ if (d < duration_t::zero())
+ return;
+ if (places > 9)
+ places = 9; // sanity check
+ else if (places < 0)
+ places = 0;
+
+ boost::io::ios_flags_saver ifs(os);
+ os.setf(std::ios_base::fixed, std::ios_base::floatfield);
+ boost::io::ios_precision_saver ips(os);
+ os.precision(places);
 
- template <class Stopwatch >
- static void show_time( Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, system::error_code & ec)
- // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
- // be as low as 10, although will be 15 for many common platforms.
+ for (; *format; ++format)
         {
- typedef typename Stopwatch::duration duration_t;
- duration_t d = stopwatch_.elapsed( ec );
-
- if ( d < duration_t::zero() ) return;
- if ( places > 9 )
- places = 9; // sanity check
- else if ( places < 0 )
- places = 0;
-
- boost::io::ios_flags_saver ifs( os );
- os.setf( std::ios_base::fixed, std::ios_base::floatfield );
- boost::io::ios_precision_saver ips( os );
- os.precision( places );
-
- for ( ; *format; ++format ) {
- if ( (*format != '%') || (!*(format+1)) || (!std::strchr("d", *(format+1))) ) {
- os << *format;
- } else {
- ++format;
- switch ( *format ) {
- case 'd':
- os << boost::chrono::duration<double>(d).count();
- break;
- default:
- BOOST_ASSERT(0 && "run_timer internal logic error");
- }
- }
+ if ((*format != '%') || (!*(format + 1))
+ || (!std::strchr("d", *(format + 1))))
+ {
+ os << *format;
+ } else
+ {
+ ++format;
+ switch (*format)
+ {
+ case 'd':
+ os << boost::chrono::duration<double>(d).count();
+ break;
+ default:
+ BOOST_ASSERT(0 && "run_timer internal logic error");
             }
+ }
         }
+ }
     };
 
-namespace detail {
- template <typename CharT>
- struct basic_stopwatch_formatter_default_format;
- template <>
- struct basic_stopwatch_formatter_default_format<char> {
- static const char* apply() {return BOOST_STOPWATCHES_STOPWATCH_FORMAT_DEFAULT; }
- };
+ namespace detail
+ {
+ template<typename CharT>
+ struct basic_stopwatch_formatter_default_format;
+ template<>
+ struct basic_stopwatch_formatter_default_format<char>
+ {
+ static const char* apply()
+ {
+ return BOOST_STOPWATCHES_STOPWATCH_FORMAT_DEFAULT;
+ }
+ };
 #ifndef BOOST_NO_STD_WSTRING
- template <>
- struct basic_stopwatch_formatter_default_format<wchar_t> {
- static const wchar_t* apply() {return L"%ds\n"; }
- };
+ template<>
+ struct basic_stopwatch_formatter_default_format<wchar_t>
+ {
+ static const wchar_t* apply()
+ {
+ return L"%ds\n";
+ }
+ };
 
 #endif
-}
+ }
 
- template <typename CharT,typename Traits, class Alloc>
- const typename basic_stopwatch_formatter<CharT,Traits,Alloc>::char_type*
- basic_stopwatch_formatter<CharT,Traits,Alloc>::default_format() {
- return detail::basic_stopwatch_formatter_default_format<CharT>::apply();
+ template<typename CharT, typename Traits, class Alloc>
+ const typename basic_stopwatch_formatter<CharT, Traits, Alloc>::char_type*
+ basic_stopwatch_formatter<CharT, Traits, Alloc>::default_format()
+ {
+ return detail::basic_stopwatch_formatter_default_format<CharT>::apply();
     }
 
- template <typename CharT,typename Traits, class Alloc>
- typename basic_stopwatch_formatter<CharT,Traits,Alloc>::ostream_type &
- basic_stopwatch_formatter<CharT,Traits,Alloc>::default_os() {
- return detail::default_out<CharT,Traits>::apply();
+ template<typename CharT, typename Traits, class Alloc>
+ typename basic_stopwatch_formatter<CharT, Traits, Alloc>::ostream_type &
+ basic_stopwatch_formatter<CharT, Traits, Alloc>::default_os()
+ {
+ return detail::default_out<CharT, Traits>::apply();
     }
 
     typedef basic_stopwatch_formatter<char> stopwatch_formatter;

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_reporter.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_reporter.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_reporter.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -29,318 +29,417 @@
 #include <cassert>
 
 #include <boost/config/abi_prefix.hpp> // must be the last #include
-
-namespace boost { namespace chrono {
-
-//--------------------------------------------------------------------------------------//
-//~ Provides a everything a Stopwatch provides and it adds reporting capabilities that can be invoked in a single line of code.
-// The reporting is controlled by two parameters:
+namespace boost
+{
+ namespace chrono
+ {
+
+ //--------------------------------------------------------------------------------------//
+ //~ Provides a everything a Stopwatch provides and it adds reporting capabilities that can be invoked in a single line of code.
+ // The reporting is controlled by two parameters:
 
     //~ * format : The output format
     //~ * places(precision): the number of decimal places used.
 
-//~ The default places is given by default_places and is 3. The default format is "\n%ts\n", where
+ //~ The default places is given by default_places and is 3. The default format is "\n%ts\n", where
 
     //~ * %t : the result of elapsed() when the reporting is done.
 
-//~ The time is given using the suffix "s" following the System International d'Unites Std.
-
-/* void f1()
- * {
- * stopwatch_reporter<stopwatch<> > _;
- * // ...
- * }
- */
-/* void f2()
- * {
- * stopwatch<>::reporter _;
- * // ...
- * }
- */
-/* void f3()
- * {
- * static stopwatch_reporter<stopwatch_accumulator<> > t;
- * stopwatch_reporter<stopwatch_accumulator<> >::scoped_run _(t);
- * // ...
- * }
- */
-/* void f4()
- * {
- * static stopwatch_accumulator<>::reporter t;
- * stopwatch_accumulator<>::reporter::scoped_run _(t);
- * // ...
- * }
- */
-//--------------------------------------------------------------------------------------//
+ //~ The time is given using the suffix "s" following the System International d'Unites Std.
 
- template <class Stopwatch, class Formatter>
- class basic_stopwatch_reporter : public Stopwatch {
+ /* void f1()
+ * {
+ * stopwatch_reporter<stopwatch<> > _;
+ * // ...
+ * }
+ */
+ /* void f2()
+ * {
+ * stopwatch<>::reporter _;
+ * // ...
+ * }
+ */
+ /* void f3()
+ * {
+ * static stopwatch_reporter<stopwatch_accumulator<> > t;
+ * stopwatch_reporter<stopwatch_accumulator<> >::scoped_run _(t);
+ * // ...
+ * }
+ */
+ /* void f4()
+ * {
+ * static stopwatch_accumulator<>::reporter t;
+ * stopwatch_accumulator<>::reporter::scoped_run _(t);
+ * // ...
+ * }
+ */
+ //--------------------------------------------------------------------------------------//
+
+ template<class Stopwatch, class Formatter>
+ class basic_stopwatch_reporter: public Stopwatch
+ {
     public:
- typedef typename Stopwatch::clock clock;
- typedef Stopwatch stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- basic_stopwatch_reporter( )
- : m_places(Formatter::default_places()), m_os(Formatter::default_os()), m_format(Formatter::default_format()), m_reported(false) {
- }
- explicit basic_stopwatch_reporter( system::error_code & )
- : m_places(Formatter::default_places()), m_os(Formatter::default_os()), m_format(Formatter::default_format()), m_reported(false) {
- }
- explicit basic_stopwatch_reporter( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(Formatter::default_places()), m_os(os), m_format(Formatter::default_format()), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- explicit basic_stopwatch_reporter( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(Formatter::default_places()), m_os(Formatter::default_os()), m_format(format), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- explicit basic_stopwatch_reporter( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(places), m_os(Formatter::default_os()), m_format(Formatter::default_format()), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- basic_stopwatch_reporter( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(Formatter::default_places()), m_os(os), m_format(format), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- basic_stopwatch_reporter( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(places), m_os(Formatter::default_os()), m_format(format), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- basic_stopwatch_reporter( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(places), m_os(os), m_format(Formatter::default_format()), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- basic_stopwatch_reporter( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(places), m_os(Formatter::default_os()), m_format(format), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- basic_stopwatch_reporter( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(places), m_os(os), m_format(format), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- basic_stopwatch_reporter( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : m_places(places), m_os(os), m_format(format), m_reported(false) {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- }
-
- ~basic_stopwatch_reporter() {// never throws
- system::error_code ec;
- //this->stop(ec);
- if ( !reported() ) {
- this->report( ec );
- }
- }
-
-
- inline void report( system::error_code & /*ec*/ = BOOST_CHRONO_THROWS );
- bool reported() const { return m_reported; }
-
-
- typedef stopwatch_runner<basic_stopwatch_reporter<Stopwatch,Formatter> > scoped_run;
- typedef stopwatch_stopper<basic_stopwatch_reporter<Stopwatch,Formatter> > scoped_stop;
- typedef stopwatch_suspender<basic_stopwatch_reporter<Stopwatch,Formatter> > scoped_suspend;
- typedef stopwatch_resumer<basic_stopwatch_reporter<Stopwatch,Formatter> > scoped_resume;
+ typedef typename Stopwatch::clock clock;
+ typedef Stopwatch stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ basic_stopwatch_reporter() :
+ m_places(Formatter::default_places()), m_os(Formatter::default_os()),
+ m_format(Formatter::default_format()), m_reported(false)
+ {
+ }
+ explicit basic_stopwatch_reporter(system::error_code &) :
+ m_places(Formatter::default_places()), m_os(Formatter::default_os()),
+ m_format(Formatter::default_format()), m_reported(false)
+ {
+ }
+ explicit basic_stopwatch_reporter(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(Formatter::default_places()), m_os(os),
+ m_format(Formatter::default_format()), m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ explicit basic_stopwatch_reporter(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(Formatter::default_places()), m_os(Formatter::default_os()),
+ m_format(format), m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ explicit basic_stopwatch_reporter(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(places), m_os(Formatter::default_os()),
+ m_format(Formatter::default_format()), m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ basic_stopwatch_reporter(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(Formatter::default_places()), m_os(os), m_format(format),
+ m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ basic_stopwatch_reporter(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(places), m_os(Formatter::default_os()), m_format(format),
+ m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ basic_stopwatch_reporter(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(places), m_os(os), m_format(Formatter::default_format()),
+ m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ basic_stopwatch_reporter(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(places), m_os(Formatter::default_os()), m_format(format),
+ m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ basic_stopwatch_reporter(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(places), m_os(os), m_format(format), m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ basic_stopwatch_reporter(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ m_places(places), m_os(os), m_format(format), m_reported(false)
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ }
+
+ ~basic_stopwatch_reporter()
+ {// never throws
+ system::error_code ec;
+ //this->stop(ec);
+ if (!reported())
+ {
+ this->report(ec);
+ }
+ }
+
+ inline void report(system::error_code & /*ec*/= BOOST_CHRONO_THROWS);
+ bool reported() const
+ {
+ return m_reported;
+ }
+
+ typedef stopwatch_runner<basic_stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<basic_stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<
+ basic_stopwatch_reporter<Stopwatch, Formatter> > scoped_suspend;
+ typedef stopwatch_resumer<basic_stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_resume;
 
     protected:
- int m_places;
- ostream_type & m_os;
- string_type m_format;
- bool m_reported;
-
-
- //basic_stopwatch_reporter(); // = delete;
- basic_stopwatch_reporter(const basic_stopwatch_reporter&); // = delete;
- basic_stopwatch_reporter& operator=(const basic_stopwatch_reporter&); // = delete;
+ int m_places;
+ ostream_type & m_os;
+ string_type m_format;
+ bool m_reported;
+
+ //basic_stopwatch_reporter(); // = delete;
+ basic_stopwatch_reporter(const basic_stopwatch_reporter&); // = delete;
+ basic_stopwatch_reporter& operator=(const basic_stopwatch_reporter&); // = delete;
     };
 
- template <class Stopwatch, class Formatter>
- void basic_stopwatch_reporter<Stopwatch, Formatter>::report( system::error_code & ec ) {
- chrono::clock_suspender<typename Stopwatch::clock> _(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- if ( m_format.empty() ) m_format = Formatter::default_format();
+ template<class Stopwatch, class Formatter>
+ void basic_stopwatch_reporter<Stopwatch, Formatter>::report(system::error_code & ec)
+ {
+ chrono::clock_suspender<typename Stopwatch::clock> _(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
+ }
+ if (m_format.empty())
+ m_format = Formatter::default_format();
 
- m_reported = true;
- Formatter::show_time( *this, m_format.c_str(), m_places, m_os, ec);
+ m_reported = true;
+ Formatter::show_time(*this, m_format.c_str(), m_places, m_os, ec);
     }
 
-
- template <class Stopwatch>
+ template<class Stopwatch>
     struct stopwatch_reporter_default_formatter;
 
- template <class Stopwatch, class Formatter=typename stopwatch_reporter_default_formatter<Stopwatch>::type>
+ template<class Stopwatch,
+ class Formatter = typename stopwatch_reporter_default_formatter<
+ Stopwatch>::type>
     class stopwatch_reporter;
 
- template <class Stopwatch, class Formatter>
- struct stopwatch_reporter_default_formatter<stopwatch_reporter<Stopwatch, Formatter> > {
- typedef Formatter type;
+ template<class Stopwatch, class Formatter>
+ struct stopwatch_reporter_default_formatter<stopwatch_reporter<Stopwatch,
+ Formatter> >
+ {
+ typedef Formatter type;
     };
 
-
- template <class Stopwatch, class Formatter>
- class stopwatch_reporter : public basic_stopwatch_reporter<Stopwatch,Formatter> {
- typedef basic_stopwatch_reporter<Stopwatch,Formatter> base_type;
+ template<class Stopwatch, class Formatter>
+ class stopwatch_reporter: public basic_stopwatch_reporter<Stopwatch,
+ Formatter>
+ {
+ typedef basic_stopwatch_reporter<Stopwatch, Formatter> base_type;
     public:
- typedef typename Stopwatch::clock clock;
- typedef Stopwatch stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- stopwatch_reporter( )
- : base_type() { }
- explicit stopwatch_reporter( system::error_code & ec )
- : base_type(ec) { }
- explicit stopwatch_reporter( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec) { }
-
- explicit stopwatch_reporter( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec) { }
-
- explicit stopwatch_reporter( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec) { }
-
- stopwatch_reporter( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec) { }
-
- stopwatch_reporter( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec) { }
-
- stopwatch_reporter( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec) { }
-
- stopwatch_reporter( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec) { }
-
- stopwatch_reporter( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec) { }
-
- stopwatch_reporter( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec) { }
-
- typedef stopwatch_runner<stopwatch_reporter<Stopwatch,Formatter> > scoped_run;
- typedef stopwatch_stopper<stopwatch_reporter<Stopwatch,Formatter> > scoped_stop;
- typedef stopwatch_suspender<stopwatch_reporter<Stopwatch,Formatter> > scoped_suspend;
- typedef stopwatch_resumer<stopwatch_reporter<Stopwatch,Formatter> > scoped_resume;
+ typedef typename Stopwatch::clock clock;
+ typedef Stopwatch stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ stopwatch_reporter() :
+ base_type()
+ {
+ }
+ explicit stopwatch_reporter(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+ explicit stopwatch_reporter(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec)
+ {
+ }
+
+ explicit stopwatch_reporter(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec)
+ {
+ }
+
+ explicit stopwatch_reporter(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec)
+ {
+ }
+
+ stopwatch_reporter(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec)
+ {
+ }
+
+ stopwatch_reporter(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec)
+ {
+ }
+
+ stopwatch_reporter(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec)
+ {
+ }
+
+ stopwatch_reporter(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec)
+ {
+ }
+
+ stopwatch_reporter(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec)
+ {
+ }
+
+ stopwatch_reporter(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec)
+ {
+ }
+
+ typedef stopwatch_runner<stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_resume;
 
     protected:
 
-
- //stopwatch_reporter(); // = delete;
- stopwatch_reporter(const stopwatch_reporter&); // = delete;
- stopwatch_reporter& operator=(const stopwatch_reporter&); // = delete;
+ //stopwatch_reporter(); // = delete;
+ stopwatch_reporter(const stopwatch_reporter&); // = delete;
+ stopwatch_reporter& operator=(const stopwatch_reporter&); // = delete;
     };
 
-
- template <class Stopwatch>
+ template<class Stopwatch>
     struct wstopwatch_reporter_default_formatter;
 
- template <class Stopwatch, class Formatter=typename wstopwatch_reporter_default_formatter<Stopwatch>::type>
+ template<class Stopwatch,
+ class Formatter = typename wstopwatch_reporter_default_formatter<
+ Stopwatch>::type>
     class wstopwatch_reporter;
 
- template <class Stopwatch, class Formatter>
- struct wstopwatch_reporter_default_formatter<wstopwatch_reporter<Stopwatch, Formatter> > {
- typedef Formatter type;
+ template<class Stopwatch, class Formatter>
+ struct wstopwatch_reporter_default_formatter<wstopwatch_reporter<Stopwatch,
+ Formatter> >
+ {
+ typedef Formatter type;
     };
 
-
- template <class Stopwatch, class Formatter>
- class wstopwatch_reporter : public basic_stopwatch_reporter<Stopwatch,Formatter> {
- typedef basic_stopwatch_reporter<Stopwatch,Formatter> base_type;
+ template<class Stopwatch, class Formatter>
+ class wstopwatch_reporter: public basic_stopwatch_reporter<Stopwatch,
+ Formatter>
+ {
+ typedef basic_stopwatch_reporter<Stopwatch, Formatter> base_type;
     public:
- typedef typename Stopwatch::clock clock;
- typedef Stopwatch stopwatch;
- typedef Formatter formatter;
- typedef typename Formatter::string_type string_type;
- typedef typename Formatter::char_type char_type;
- typedef typename Formatter::ostream_type ostream_type;
-
- explicit wstopwatch_reporter( system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(ec) { }
- explicit wstopwatch_reporter( ostream_type & os,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, ec) { }
-
- explicit wstopwatch_reporter( const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, ec) { }
-
- explicit wstopwatch_reporter( int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, ec) { }
-
- wstopwatch_reporter( ostream_type & os, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, ec) { }
-
- wstopwatch_reporter( const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(format, places, ec) { }
-
- wstopwatch_reporter( ostream_type & os, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, ec) { }
-
- wstopwatch_reporter( int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(places, format, ec) { }
-
- wstopwatch_reporter( ostream_type & os, const string_type & format, int places,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, format, places, ec) { }
-
- wstopwatch_reporter( ostream_type & os, int places, const string_type & format,
- system::error_code & ec = BOOST_CHRONO_THROWS )
- : base_type(os, places, format, ec) { }
-
- typedef stopwatch_runner<wstopwatch_reporter<Stopwatch,Formatter> > scoped_run;
- typedef stopwatch_stopper<wstopwatch_reporter<Stopwatch,Formatter> > scoped_stop;
- typedef stopwatch_suspender<wstopwatch_reporter<Stopwatch,Formatter> > scoped_suspend;
- typedef stopwatch_resumer<wstopwatch_reporter<Stopwatch,Formatter> > scoped_resume;
+ typedef typename Stopwatch::clock clock;
+ typedef Stopwatch stopwatch;
+ typedef Formatter formatter;
+ typedef typename Formatter::string_type string_type;
+ typedef typename Formatter::char_type char_type;
+ typedef typename Formatter::ostream_type ostream_type;
+
+ explicit wstopwatch_reporter(system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(ec)
+ {
+ }
+ explicit wstopwatch_reporter(ostream_type & os, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, ec)
+ {
+ }
+
+ explicit wstopwatch_reporter(const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, ec)
+ {
+ }
+
+ explicit wstopwatch_reporter(int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, ec)
+ {
+ }
+
+ wstopwatch_reporter(ostream_type & os, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, ec)
+ {
+ }
+
+ wstopwatch_reporter(const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(format, places, ec)
+ {
+ }
+
+ wstopwatch_reporter(ostream_type & os, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, ec)
+ {
+ }
+
+ wstopwatch_reporter(int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(places, format, ec)
+ {
+ }
+
+ wstopwatch_reporter(ostream_type & os, const string_type & format, int places, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, format, places, ec)
+ {
+ }
+
+ wstopwatch_reporter(ostream_type & os, int places, const string_type & format, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ base_type(os, places, format, ec)
+ {
+ }
+
+ typedef stopwatch_runner<wstopwatch_reporter<Stopwatch, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<wstopwatch_reporter<Stopwatch, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<wstopwatch_reporter<Stopwatch, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<wstopwatch_reporter<Stopwatch, Formatter> >
+ scoped_resume;
 
     protected:
 
- //wstopwatch_reporter(); // = delete;
- wstopwatch_reporter(const wstopwatch_reporter&); // = delete;
- wstopwatch_reporter& operator=(const wstopwatch_reporter&); // = delete;
+ //wstopwatch_reporter(); // = delete;
+ wstopwatch_reporter(const wstopwatch_reporter&); // = delete;
+ wstopwatch_reporter& operator=(const wstopwatch_reporter&); // = delete;
     };
 
   } // namespace chrono
 } // namespace boost
 
 #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
-
 #if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_STOPWATCHES_ENABLE_WARNINGS)
 #if defined __SUNPRO_CC
 #pragma enable_warn
@@ -349,5 +448,4 @@
 #endif
 #endif
 
-
 #endif

Modified: sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_scoped.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_scoped.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/stopwatch_scoped.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -15,97 +15,112 @@
   namespace chrono
   {
 
-//--------------------------------------------------------------------------------------//
- template <class Stopwatch> class stopwatch_runner {
+ //--------------------------------------------------------------------------------------//
+ template<class Stopwatch> class stopwatch_runner
+ {
     public:
- typedef Stopwatch stopwatch;
- stopwatch_runner(stopwatch & a, system::error_code & ec = BOOST_CHRONO_THROWS)
- : stopwatch_(a) {
- stopwatch_.start(ec);
- }
- ~stopwatch_runner() {
- system::error_code ec;
- stopwatch_.stop(ec);
- }
+ typedef Stopwatch stopwatch;
+ stopwatch_runner(stopwatch & a, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ stopwatch_(a)
+ {
+ stopwatch_.start(ec);
+ }
+ ~stopwatch_runner()
+ {
+ system::error_code ec;
+ stopwatch_.stop(ec);
+ }
 #if 0
- typename Stopwatch::duration elapsed(system::error_code & ec = BOOST_CHRONO_THROWS)
- {
- return stopwatch_.elapsed(ec)-stopwatch_.get_storage();
- }
+ typename Stopwatch::duration elapsed(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ return stopwatch_.elapsed(ec)-stopwatch_.get_storage();
+ }
 #endif
     private:
- stopwatch& stopwatch_;
- stopwatch_runner();//= delete;
- stopwatch_runner(const stopwatch_runner&); // = delete;
- stopwatch_runner& operator=(const stopwatch_runner&); // = delete;
+ stopwatch& stopwatch_;
+ stopwatch_runner();//= delete;
+ stopwatch_runner(const stopwatch_runner&); // = delete;
+ stopwatch_runner& operator=(const stopwatch_runner&); // = delete;
 
     };
 
-//--------------------------------------------------------------------------------------//
- template <class Stopwatch> class stopwatch_stopper {
+ //--------------------------------------------------------------------------------------//
+ template<class Stopwatch> class stopwatch_stopper
+ {
     public:
- typedef Stopwatch stopwatch;
- stopwatch_stopper(stopwatch & a, system::error_code & ec = BOOST_CHRONO_THROWS)
- : stopwatch_(a) {
- stopwatch_.stop(ec);
- }
- ~stopwatch_stopper() {
- system::error_code ec;
- stopwatch_.start(ec);
- }
+ typedef Stopwatch stopwatch;
+ stopwatch_stopper(stopwatch & a, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ stopwatch_(a)
+ {
+ stopwatch_.stop(ec);
+ }
+ ~stopwatch_stopper()
+ {
+ system::error_code ec;
+ stopwatch_.start(ec);
+ }
 #if 0
- typename Stopwatch::duration elapsed(system::error_code & ec = BOOST_CHRONO_THROWS)
- {
- return stopwatch_.elapsed(ec)-stopwatch_.get_storage();
- }
+ typename Stopwatch::duration elapsed(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ return stopwatch_.elapsed(ec)-stopwatch_.get_storage();
+ }
 #endif
     private:
- stopwatch& stopwatch_;
- stopwatch_stopper();//= delete;
- stopwatch_stopper(const stopwatch_stopper&); // = delete;
- stopwatch_stopper& operator=(const stopwatch_stopper&); // = delete;
+ stopwatch& stopwatch_;
+ stopwatch_stopper();//= delete;
+ stopwatch_stopper(const stopwatch_stopper&); // = delete;
+ stopwatch_stopper& operator=(const stopwatch_stopper&); // = delete;
 
     };
 
-//--------------------------------------------------------------------------------------//
- template <class Stopwatch> class stopwatch_suspender {
+ //--------------------------------------------------------------------------------------//
+ template<class Stopwatch> class stopwatch_suspender
+ {
     public:
- typedef Stopwatch stopwatch;
- stopwatch_suspender(stopwatch & a, system::error_code & ec = BOOST_CHRONO_THROWS)
- : stopwatch_(a) {
- stopwatch_.suspend(ec);
- }
- ~stopwatch_suspender() {
- system::error_code ec;
- stopwatch_.resume(ec);
- }
+ typedef Stopwatch stopwatch;
+ stopwatch_suspender(stopwatch & a, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ stopwatch_(a)
+ {
+ stopwatch_.suspend(ec);
+ }
+ ~stopwatch_suspender()
+ {
+ system::error_code ec;
+ stopwatch_.resume(ec);
+ }
     private:
- stopwatch& stopwatch_;
- stopwatch_suspender(); // = delete;
- stopwatch_suspender(const stopwatch_suspender&); // = delete;
- stopwatch_suspender& operator=(const stopwatch_suspender&); // = delete;
+ stopwatch& stopwatch_;
+ stopwatch_suspender(); // = delete;
+ stopwatch_suspender(const stopwatch_suspender&); // = delete;
+ stopwatch_suspender& operator=(const stopwatch_suspender&); // = delete;
     };
 
-//--------------------------------------------------------------------------------------//
- template <class Stopwatch> class stopwatch_resumer {
+ //--------------------------------------------------------------------------------------//
+ template<class Stopwatch> class stopwatch_resumer
+ {
     public:
- typedef Stopwatch stopwatch;
- stopwatch_resumer(stopwatch & a, system::error_code & ec = BOOST_CHRONO_THROWS)
- : stopwatch_(a) {
- stopwatch_.resume(ec);
- }
- ~stopwatch_resumer() {
- system::error_code ec;
- stopwatch_.suspend(ec);
- }
+ typedef Stopwatch stopwatch;
+ stopwatch_resumer(stopwatch & a, system::error_code & ec =
+ BOOST_CHRONO_THROWS) :
+ stopwatch_(a)
+ {
+ stopwatch_.resume(ec);
+ }
+ ~stopwatch_resumer()
+ {
+ system::error_code ec;
+ stopwatch_.suspend(ec);
+ }
     private:
- stopwatch& stopwatch_;
- stopwatch_resumer(); // = delete;
- stopwatch_resumer(const stopwatch_resumer&); // = delete;
- stopwatch_resumer& operator=(const stopwatch_resumer&); // = delete;
+ stopwatch& stopwatch_;
+ stopwatch_resumer(); // = delete;
+ stopwatch_resumer(const stopwatch_resumer&); // = delete;
+ stopwatch_resumer& operator=(const stopwatch_resumer&); // = delete;
     };
 
-
   } // namespace chrono
 } // namespace boost
 

Modified: sandbox/stopwatches/boost/chrono/stopwatches/suspendible_clock.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/suspendible_clock.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/suspendible_clock.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -14,185 +14,235 @@
 #include <boost/thread/tss.hpp>
 #include <memory>
 
-namespace boost { namespace chrono {
-
- template < class Clock=chrono::high_resolution_clock >
- class suspendible_clock {
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class Clock = chrono::high_resolution_clock>
+ class suspendible_clock
+ {
     public:
- typedef typename Clock::duration duration;
- typedef typename Clock::rep rep;
- typedef typename Clock::period period;
- typedef chrono::time_point<suspendible_clock<Clock> > time_point;
- static const bool is_steady = true;
+ typedef typename Clock::duration duration;
+ typedef typename Clock::rep rep;
+ typedef typename Clock::period period;
+ typedef chrono::time_point<suspendible_clock<Clock> > time_point;
+ static const bool is_steady = true;
 
     private:
- struct thread_specific_context {
- bool suspended_;
- time_point suspended_time_;
- duration suspended_duration_;
- std::size_t suspend_level_;
-
- thread_specific_context()
- : suspended_(false)
- , suspended_time_()
- , suspended_duration_(duration::zero())
- , suspend_level_(0)
- {}
- duration suspended(system::error_code & ec = BOOST_CHRONO_THROWS) {
- if (!suspended_) {
- ec.clear();
- return suspended_duration_;
- } else {
- time_point tmp;
- tmp+=duration(Clock::now(ec).time_since_epoch());
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return duration::zero();
- }
- return suspended_duration_ + tmp - suspended_time_;
- }
+ struct thread_specific_context
+ {
+ bool suspended_;
+ time_point suspended_time_;
+ duration suspended_duration_;
+ std::size_t suspend_level_;
+
+ thread_specific_context() :
+ suspended_(false), suspended_time_(),
+ suspended_duration_(duration::zero()), suspend_level_(0)
+ {
+ }
+ duration suspended(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ if (!suspended_)
+ {
+ ec.clear();
+ return suspended_duration_;
+ } else
+ {
+ time_point tmp;
+ tmp += duration(Clock::now(ec).time_since_epoch());
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return duration::zero();
             }
+ return suspended_duration_ + tmp - suspended_time_;
+ }
+ }
 
- void suspend( system::error_code & ec = BOOST_CHRONO_THROWS ) {
- if (!suspended_) {
- time_point tmp;
- tmp+=duration(Clock::now(ec).time_since_epoch());
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- ++suspend_level_;
- suspended_time_ = tmp;
- suspended_=true;
- } else {
- ec.clear();
- ++suspend_level_;
- }
- }
- void resume( system::error_code & ec = BOOST_CHRONO_THROWS ) {
- if (suspended_&&(--suspend_level_==0)) {
- time_point tmp;
- tmp+=duration(Clock::now(ec).time_since_epoch());
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
+ void suspend(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ if (!suspended_)
+ {
+ time_point tmp;
+ tmp += duration(Clock::now(ec).time_since_epoch());
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
             }
- suspended_duration_ += tmp - suspended_time_;
- suspended_=false;
- } else {
- ec.clear();
- }
+ ++suspend_level_;
+ suspended_time_ = tmp;
+ suspended_ = true;
+ } else
+ {
+ ec.clear();
+ ++suspend_level_;
+ }
+ }
+ void resume(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ if (suspended_ && (--suspend_level_ == 0))
+ {
+ time_point tmp;
+ tmp += duration(Clock::now(ec).time_since_epoch());
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return;
             }
+ suspended_duration_ += tmp - suspended_time_;
+ suspended_ = false;
+ } else
+ {
+ ec.clear();
+ }
+ }
 
- };
- static thread_specific_context* instance(system::error_code & ec) {
- thread_specific_context* ptr= ptr_.get();
- if (ptr==0) {
- if (BOOST_CHRONO_IS_THROWS(ec)) {
- std::auto_ptr<thread_specific_context> ptr2(new thread_specific_context());
- ptr_.reset(ptr2.get());
- ptr = ptr2.release();
- } else {
- ptr=(new(std::nothrow) thread_specific_context());
- if (ptr==0) {
+ };
+ static thread_specific_context* instance(system::error_code & ec)
+ {
+ thread_specific_context* ptr = ptr_.get();
+ if (ptr == 0)
+ {
+ if (BOOST_CHRONO_IS_THROWS(ec))
+ {
+ std::auto_ptr<thread_specific_context>
+ ptr2(new thread_specific_context());
+ ptr_.reset(ptr2.get());
+ ptr = ptr2.release();
+ } else
+ {
+ ptr = (new (std::nothrow) thread_specific_context());
+ if (ptr == 0)
+ {
 #if (BOOST_VERSION / 100 % 1000) < 44
- ec.assign( system::errc::resource_unavailable_try_again, system::generic_category );
+ ec.assign( system::errc::resource_unavailable_try_again, system::generic_category );
 #else
- ec.assign( system::errc::resource_unavailable_try_again, system::generic_category() );
+ ec.assign(system::errc::resource_unavailable_try_again, system::generic_category());
 #endif
- return 0;
- }
- try {
- ptr_.reset(ptr);
- } catch (...) {
+ return 0;
+ }
+ try
+ {
+ ptr_.reset(ptr);
+ } catch (...)
+ {
 #if (BOOST_VERSION / 100 % 1000) < 44
- ec.assign( system::errc::resource_unavailable_try_again, system::generic_category );
+ ec.assign( system::errc::resource_unavailable_try_again, system::generic_category );
 #else
- ec.assign( system::errc::resource_unavailable_try_again, system::generic_category() );
+ ec.assign(system::errc::resource_unavailable_try_again, system::generic_category());
 #endif
- return 0;
- }
- }
+ return 0;
             }
- ec.clear();
- return ptr;
+ }
         }
+ ec.clear();
+ return ptr;
+ }
 
- static thread_specific_ptr<thread_specific_context> ptr_;
+ static thread_specific_ptr<thread_specific_context> ptr_;
     public:
- static time_point now( ) {
- time_point res;
- res+= duration(Clock::now().time_since_epoch())-suspended();
- return res;
- }
-
- static time_point now( system::error_code & ec ) {
- time_point res;
- typename Clock::time_point t=Clock::now(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return time_point();
- }
- res+= duration(t.time_since_epoch())-suspended(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return time_point();
+ static time_point now()
+ {
+ time_point res;
+ res += duration(Clock::now().time_since_epoch()) - suspended();
+ return res;
+ }
+
+ static time_point now(system::error_code & ec)
+ {
+ time_point res;
+ typename Clock::time_point t = Clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return time_point();
         }
- return res;
+ res += duration(t.time_since_epoch()) - suspended(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return time_point();
         }
+ return res;
+ }
 
- static void suspend( system::error_code & ec = BOOST_CHRONO_THROWS ) {
- thread_specific_context* ptr= instance(ec);
- if (ptr!=0) ptr->suspend(ec);
- }
- static void resume( system::error_code & ec = BOOST_CHRONO_THROWS ) {
- thread_specific_context* ptr= instance(ec);
- if (ptr!=0) ptr->resume(ec);
+ static void suspend(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ thread_specific_context* ptr = instance(ec);
+ if (ptr != 0)
+ ptr->suspend(ec);
+ }
+ static void resume(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ thread_specific_context* ptr = instance(ec);
+ if (ptr != 0)
+ ptr->resume(ec);
+ }
+ static duration suspended(system::error_code & ec = BOOST_CHRONO_THROWS)
+ {
+ thread_specific_context* ptr = instance(ec);
+ if (ptr != 0)
+ {
+ return ptr->suspended(ec);
+ } else
+ return duration::zero();
+ }
+ class clock_suspender
+ {
+ public:
+ clock_suspender(system::error_code & ec = BOOST_CHRONO_THROWS) :
+ ptr_(instance(ec))
+ {
+ if (ptr_ != 0)
+ ptr_->suspend(ec);
         }
- static duration suspended(system::error_code & ec = BOOST_CHRONO_THROWS)
+ ~clock_suspender()
         {
- thread_specific_context* ptr= instance(ec);
- if (ptr!=0) {
- return ptr->suspended(ec);
- }
- else return duration::zero();
+ if (ptr_ != 0)
+ {
+ system::error_code ec;
+ ptr_->resume(ec);
+ }
+
         }
- class clock_suspender {
- public:
- clock_suspender(system::error_code & ec = BOOST_CHRONO_THROWS)
- : ptr_(instance(ec))
- {
- if (ptr_!=0) ptr_->suspend(ec);
- }
- ~clock_suspender() {
- if (ptr_!=0) {
- system::error_code ec;
- ptr_->resume(ec);
- }
-
- }
- private:
- thread_specific_context* ptr_;
- //~ clock_suspender(); // = delete;
- clock_suspender(const clock_suspender&); // = delete;
- clock_suspender& operator=(const clock_suspender&); // = delete;
- };
+ private:
+ thread_specific_context* ptr_;
+ //~ clock_suspender(); // = delete;
+ clock_suspender(const clock_suspender&); // = delete;
+ clock_suspender& operator=(const clock_suspender&); // = delete;
+ };
 
     };
 
- template < class Clock >
- thread_specific_ptr<typename suspendible_clock<Clock>::thread_specific_context> suspendible_clock<Clock>::ptr_;
-
- template <class Clock>
- struct is_suspendible<suspendible_clock<Clock> > : mpl:: true_ {};
+ template<class Clock>
+ thread_specific_ptr<
+ typename suspendible_clock<Clock>::thread_specific_context>
+ suspendible_clock<Clock>::ptr_;
+
+ template<class Clock>
+ struct is_suspendible<suspendible_clock<Clock> > : mpl::true_
+ {
+ };
 
- template <class Clock>
- class clock_suspender<suspendible_clock<Clock> >
- : public suspendible_clock<Clock>::clock_suspender {
+ template<class Clock>
+ class clock_suspender<suspendible_clock<Clock> > : public suspendible_clock<
+ Clock>::clock_suspender
+ {
     public:
- clock_suspender(system::error_code & ec = BOOST_CHRONO_THROWS) : suspendible_clock<Clock>::clock_suspender(ec) {}
+ clock_suspender(system::error_code & ec = BOOST_CHRONO_THROWS) :
+ suspendible_clock<Clock>::clock_suspender(ec)
+ {
+ }
     private:
- //~ clock_suspender(); // = delete;
- clock_suspender(const clock_suspender&); // = delete;
- clock_suspender& operator=(const clock_suspender&); // = delete;
+ //~ clock_suspender(); // = delete;
+ clock_suspender(const clock_suspender&); // = delete;
+ clock_suspender& operator=(const clock_suspender&); // = delete;
     };
 
-} // namespace chrono
+ } // namespace chrono
 } // namespace boost
 
 #endif // BOOST_CHRONO_SUSPENDIBLE_CLOCK_HPP

Modified: sandbox/stopwatches/boost/chrono/stopwatches/t24_hours.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/t24_hours.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/t24_hours.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -9,58 +9,66 @@
 
 #include <boost/chrono/chrono.hpp>
 
-
-namespace boost { namespace chrono {
-
-class t24_hours {
- typedef boost::chrono::duration<boost::int_least32_t, ratio<24*3600> > days;
- typedef boost::chrono::hours hours;
- typedef boost::chrono::minutes minutes;
- typedef boost::chrono::seconds seconds;
- typedef boost::chrono::nanoseconds nanoseconds;
-public:
- days days_;
- hours hours_;
- minutes minutes_;
- seconds seconds_;
- nanoseconds nanoseconds_;
-
- template <class Rep, class Period>
- static days get_days(const boost::chrono::duration<Rep, Period>& d) {
+namespace boost
+{
+ namespace chrono
+ {
+
+ class t24_hours
+ {
+ typedef boost::chrono::duration<boost::int_least32_t, ratio<24 * 3600> >
+ days;
+ typedef boost::chrono::hours hours;
+ typedef boost::chrono::minutes minutes;
+ typedef boost::chrono::seconds seconds;
+ typedef boost::chrono::nanoseconds nanoseconds;
+ public:
+ days days_;
+ hours hours_;
+ minutes minutes_;
+ seconds seconds_;
+ nanoseconds nanoseconds_;
+
+ template<class Rep, class Period>
+ static days get_days(const boost::chrono::duration<Rep, Period>& d)
+ {
         return boost::chrono::duration_cast<days>(d);
- }
+ }
 
- template <class Rep, class Period>
- static hours get_hours(const boost::chrono::duration<Rep, Period>& d) {
+ template<class Rep, class Period>
+ static hours get_hours(const boost::chrono::duration<Rep, Period>& d)
+ {
         return boost::chrono::duration_cast<hours>(d % days(1));
- }
+ }
 
- template <class Rep, class Period>
- static minutes get_minutes(const boost::chrono::duration<Rep, Period>& d) {
+ template<class Rep, class Period>
+ static minutes get_minutes(const boost::chrono::duration<Rep, Period>& d)
+ {
         return boost::chrono::duration_cast<minutes>(d % hours(1));
- }
+ }
 
- template <class Rep, class Period>
- static seconds get_seconds(const boost::chrono::duration<Rep, Period>& d) {
+ template<class Rep, class Period>
+ static seconds get_seconds(const boost::chrono::duration<Rep, Period>& d)
+ {
         return boost::chrono::duration_cast<seconds>(d % minutes(1));
- }
+ }
 
- template <class Rep, class Period>
- static nanoseconds get_nanoseconds(const boost::chrono::duration<Rep, Period>& d) {
+ template<class Rep, class Period>
+ static nanoseconds get_nanoseconds(const boost::chrono::duration<Rep,
+ Period>& d)
+ {
         return boost::chrono::duration_cast<nanoseconds>(d % seconds(1));
- }
+ }
 
- template <class Rep, class Period>
- explicit t24_hours(const boost::chrono::duration<Rep, Period>& d)
- : days_ (get_days(d))
- , hours_ (get_hours(d))
- , minutes_ (get_minutes(d))
- , seconds_ (get_seconds(d))
- , nanoseconds_ (get_nanoseconds(d))
- {}
-};
+ template<class Rep, class Period>
+ explicit t24_hours(const boost::chrono::duration<Rep, Period>& d) :
+ days_(get_days(d)), hours_(get_hours(d)), minutes_(get_minutes(d)),
+ seconds_(get_seconds(d)), nanoseconds_(get_nanoseconds(d))
+ {
+ }
+ };
 
-} // namespace chrono
+ } // namespace chrono
 } // namespace boost
 
 

Modified: sandbox/stopwatches/boost/chrono/stopwatches/t24_hours_formatter.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/t24_hours_formatter.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/t24_hours_formatter.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -23,126 +23,152 @@
 
 #define BOOST_STOPWATCHES_24_HOURS_FORMAT_DEFAULT "%d day(s) %h:%m:%s.%n\n"
 
-namespace boost { namespace chrono {
+namespace boost
+{
+ namespace chrono
+ {
+
+ //--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
 
-//--------------------------------------------------------------------------------------//
-//--------------------------------------------------------------------------------------//
 
-
- template <
- typename CharT=char,
- typename Traits=std::char_traits<CharT>,
- class Alloc=std::allocator<CharT>
- >
- class basic_24_hours_formatter {
+ template<typename CharT = char, typename Traits = std::char_traits<CharT>,
+ class Alloc = std::allocator<CharT> >
+ class basic_24_hours_formatter
+ {
     public:
 
- typedef std::basic_string<CharT,Traits,Alloc> string_type;
- typedef CharT char_type;
- typedef std::basic_ostream<CharT,Traits> ostream_type;
-
- static ostream_type & default_os();
- static const char_type* default_format();
- static string_type format(const char_type* s) {
- string_type res(s);
- res += boost::chrono::detail::adaptive_string(" : ");
- res += default_format();
- //res += boost::chrono::detail::adaptive_string(" tokes %d day(s) %h:%m:%s.%n\n");
- return res;
- }
- static int default_places() { return 3; }
-
- template <class Stopwatch >
- static void show_time( Stopwatch & stopwatch_
- , const char_type* format, int places, ostream_type & os
- , system::error_code & ec)
- // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
- // be as low as 10, although will be 15 for many common platforms.
+ typedef std::basic_string<CharT, Traits, Alloc> string_type;
+ typedef CharT char_type;
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ static ostream_type & default_os();
+ static const char_type* default_format();
+ static string_type format(const char_type* s)
+ {
+ string_type res(s);
+ res += boost::chrono::detail::adaptive_string(" : ");
+ res += default_format();
+ //res += boost::chrono::detail::adaptive_string(" tokes %d day(s) %h:%m:%s.%n\n");
+ return res;
+ }
+ static int default_places()
+ {
+ return 3;
+ }
+
+ template<class Stopwatch>
+ static void show_time(Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, system::error_code & ec)
+ // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
+ // be as low as 10, although will be 15 for many common platforms.
+ {
+ typedef typename Stopwatch::duration duration_t;
+ duration_t d = stopwatch_.elapsed(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
         {
- typedef typename Stopwatch::duration duration_t;
- duration_t d = stopwatch_.elapsed( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
+ if (ec)
+ return;
         }
- if ( d < duration_t::zero() ) return;
+ if (d < duration_t::zero())
+ return;
+
+ boost::io::ios_flags_saver ifs(os);
+ os.setf(std::ios_base::fixed, std::ios_base::floatfield);
+ boost::io::ios_precision_saver ips(os);
+ os.precision(places);
 
- boost::io::ios_flags_saver ifs( os );
- os.setf( std::ios_base::fixed, std::ios_base::floatfield );
- boost::io::ios_precision_saver ips( os );
- os.precision( places );
-
- t24_hours dt(d);
- for ( ; *format; ++format ) {
- if ( (*format != '%') || (!*(format+1)) || (!std::strchr("dhmsn", *(format+1))) ) {
- os << *format;
- } else {
- ++format;
- switch ( *format ) {
- case 'd':
- os << dt.days_.count();
- break;
- case 'h':
- {
- boost::io::ios_flags_saver ifs( os );
- os.width(2); os.fill('0');
- os << dt.hours_.count();
- break;
- }
- case 'm':
- {
- boost::io::ios_flags_saver ifs( os );
- os.width(2); os.fill('0');
- os << dt.minutes_.count();
- break;
- }
- case 's':
- {
- boost::io::ios_flags_saver ifs( os );
- os.width(2); os.fill('0');
- os << dt.seconds_.count();
- break;
- }
- case 'n':
- {
- boost::io::ios_flags_saver ifs( os );
- os.width(9); os.fill('0');
- os << dt.nanoseconds_.count();
- break;
- }
- default:
- BOOST_ASSERT(0 && "basic_24_hours_formatter internal logic error");
- }
- }
+ t24_hours dt(d);
+ for (; *format; ++format)
+ {
+ if ((*format != '%') || (!*(format + 1))
+ || (!std::strchr("dhmsn", *(format + 1))))
+ {
+ os << *format;
+ } else
+ {
+ ++format;
+ switch (*format)
+ {
+ case 'd':
+ os << dt.days_.count();
+ break;
+ case 'h':
+ {
+ boost::io::ios_flags_saver ifs(os);
+ os.width(2);
+ os.fill('0');
+ os << dt.hours_.count();
+ break;
+ }
+ case 'm':
+ {
+ boost::io::ios_flags_saver ifs(os);
+ os.width(2);
+ os.fill('0');
+ os << dt.minutes_.count();
+ break;
+ }
+ case 's':
+ {
+ boost::io::ios_flags_saver ifs(os);
+ os.width(2);
+ os.fill('0');
+ os << dt.seconds_.count();
+ break;
+ }
+ case 'n':
+ {
+ boost::io::ios_flags_saver ifs(os);
+ os.width(9);
+ os.fill('0');
+ os << dt.nanoseconds_.count();
+ break;
             }
+ default:
+ BOOST_ASSERT(0 && "basic_24_hours_formatter internal logic error");
+ }
+ }
         }
+ }
     };
 
-namespace detail {
- template <typename CharT>
- struct basic_24_hours_formatter_default_format;
- template <>
- struct basic_24_hours_formatter_default_format<char> {
- static const char* apply() {return BOOST_STOPWATCHES_24_HOURS_FORMAT_DEFAULT; }
- };
+ namespace detail
+ {
+ template<typename CharT>
+ struct basic_24_hours_formatter_default_format;
+ template<>
+ struct basic_24_hours_formatter_default_format<char>
+ {
+ static const char* apply()
+ {
+ return BOOST_STOPWATCHES_24_HOURS_FORMAT_DEFAULT;
+ }
+ };
 #ifndef BOOST_NO_STD_WSTRING
- template <>
- struct basic_24_hours_formatter_default_format<wchar_t> {
- static const wchar_t* apply() {return L"%d day(s) %h:%m:%s.%n\n"; }
- };
+ template<>
+ struct basic_24_hours_formatter_default_format<wchar_t>
+ {
+ static const wchar_t* apply()
+ {
+ return L"%d day(s) %h:%m:%s.%n\n";
+ }
+ };
 
 #endif
-}
+ }
 
- template <typename CharT,typename Traits, class Alloc>
- const typename basic_24_hours_formatter<CharT,Traits,Alloc>::char_type*
- basic_24_hours_formatter<CharT,Traits,Alloc>::default_format() {
- return detail::basic_24_hours_formatter_default_format<CharT>::apply();
+ template<typename CharT, typename Traits, class Alloc>
+ const typename basic_24_hours_formatter<CharT, Traits, Alloc>::char_type*
+ basic_24_hours_formatter<CharT, Traits, Alloc>::default_format()
+ {
+ return detail::basic_24_hours_formatter_default_format<CharT>::apply();
     }
 
- template <typename CharT,typename Traits, class Alloc>
- typename basic_24_hours_formatter<CharT,Traits,Alloc>::ostream_type &
- basic_24_hours_formatter<CharT,Traits,Alloc>::default_os() {
- return detail::default_out<CharT,Traits>::apply();
+ template<typename CharT, typename Traits, class Alloc>
+ typename basic_24_hours_formatter<CharT, Traits, Alloc>::ostream_type &
+ basic_24_hours_formatter<CharT, Traits, Alloc>::default_os()
+ {
+ return detail::default_out<CharT, Traits>::apply();
     }
 
     typedef basic_24_hours_formatter<char> t24_hours_formatter;

Modified: sandbox/stopwatches/boost/chrono/stopwatches/time_formatter.hpp
==============================================================================
--- sandbox/stopwatches/boost/chrono/stopwatches/time_formatter.hpp (original)
+++ sandbox/stopwatches/boost/chrono/stopwatches/time_formatter.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -23,142 +23,164 @@
 
 #define BOOST_STOPWATCHES_TIME_FORMAT_DEFAULT "real %rs, cpu %cs (%p%), user %us, system %ss\n"
 
-namespace boost { namespace chrono {
+namespace boost
+{
+ namespace chrono
+ {
+
+ //--------------------------------------------------------------------------------------//
+ //--------------------------------------------------------------------------------------//
 
-//--------------------------------------------------------------------------------------//
-//--------------------------------------------------------------------------------------//
 
-
- template <
- typename CharT=char,
- typename Traits=std::char_traits<CharT>,
- class Alloc=std::allocator<CharT>
- >
- class basic_time_formatter {
+ template<typename CharT = char, typename Traits = std::char_traits<CharT>,
+ class Alloc = std::allocator<CharT> >
+ class basic_time_formatter
+ {
     public:
 
- typedef std::basic_string<CharT,Traits,Alloc> string_type;
- typedef CharT char_type;
- typedef std::basic_ostream<CharT,Traits> ostream_type;
-
- static ostream_type & default_os();
- static const char_type* default_format();
- static string_type format(const char_type* s) {
- string_type res(s);
- res += boost::chrono::detail::adaptive_string(" : ");
- res += default_format();
- //res += boost::chrono::detail::adaptive_string(" spent real %rs, cpu %cs (%p%), user %us, system %ss\n");
- return res;
- }
- static int default_places() { return 3; }
+ typedef std::basic_string<CharT, Traits, Alloc> string_type;
+ typedef CharT char_type;
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ static ostream_type & default_os();
+ static const char_type* default_format();
+ static string_type format(const char_type* s)
+ {
+ string_type res(s);
+ res += boost::chrono::detail::adaptive_string(" : ");
+ res += default_format();
+ //res += boost::chrono::detail::adaptive_string(" spent real %rs, cpu %cs (%p%), user %us, system %ss\n");
+ return res;
+ }
+ static int default_places()
+ {
+ return 3;
+ }
+
+ template<class Stopwatch>
+ static void show_time(typename Stopwatch::duration::rep const & times, const char_type* format, int places, ostream_type & os, system::error_code & ec)
+ // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
+ // be as low as 10, although will be 15 for many common platforms.
+ {
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ ec.clear();
+ typedef typename Stopwatch::duration duration;
+ typedef typename duration::rep rep;
+ if (times.real < 0)
+ return;
+ if (places > 9)
+ places = 9; // sanity check
+ else if (places < 0)
+ places = 0;
+
+ boost::io::ios_flags_saver ifs(os);
+ os.setf(std::ios_base::fixed, std::ios_base::floatfield);
+ boost::io::ios_precision_saver ips(os);
+ os.precision(places);
 
- template <class Stopwatch >
- static void show_time( typename Stopwatch::duration::rep const & times
- , const char_type* format, int places, ostream_type & os
- , system::error_code & ec
- )
- // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
- // be as low as 10, although will be 15 for many common platforms.
- {
- if (!BOOST_CHRONO_IS_THROWS(ec)) ec.clear();
- typedef typename Stopwatch::duration duration;
- typedef typename duration::rep rep;
- if ( times.real < 0 ) return;
- if ( places > 9 )
- places = 9; // sanity check
- else if ( places < 0 )
- places = 0;
-
- boost::io::ios_flags_saver ifs( os );
- os.setf( std::ios_base::fixed, std::ios_base::floatfield );
- boost::io::ios_precision_saver ips( os );
- os.precision( places );
+ chrono::nanoseconds total = chrono::nanoseconds(times.system
+ + times.user);
 
- chrono::nanoseconds total = chrono::nanoseconds(times.system + times.user);
-
- for ( ; *format; ++format )
+ for (; *format; ++format)
+ {
+ if ((*format != '%') || (!*(format + 1))
+ || (!std::strchr("rcpus", *(format + 1))))
+ os << *format;
+ else
+ {
+ ++format;
+ switch (*format)
+ {
+ case 'r':
+ os
+ << boost::chrono::duration<double>(chrono::nanoseconds(times.real)).count();
+ break;
+ case 'u':
+ os
+ << boost::chrono::duration<double>(chrono::nanoseconds(times.user)).count();
+ break;
+ case 's':
+ os
+ << boost::chrono::duration<double>(chrono::nanoseconds(times.system)).count();
+ break;
+ case 'c':
+ os << boost::chrono::duration<double>(total).count();
+ break;
+ case 'p':
             {
- if ( (*format != '%') || (!*(format+1)) || (!std::strchr("rcpus", *(format+1))) )
- os << *format;
+ boost::io::ios_precision_saver ips(os);
+ os.precision(1);
+ if (times.real && total.count())
+ os
+ << boost::chrono::duration<double>(total).count()
+ / boost::chrono::duration<double>(chrono::nanoseconds(times.real)).count()
+ * 100.0;
               else
- {
- ++format;
- switch ( *format )
- {
- case 'r':
- os << boost::chrono::duration<double>(chrono::nanoseconds(times.real)).count();
- break;
- case 'u':
- os << boost::chrono::duration<double>(chrono::nanoseconds(times.user)).count();
- break;
- case 's':
- os << boost::chrono::duration<double>(chrono::nanoseconds(times.system)).count();
- break;
- case 'c':
- os << boost::chrono::duration<double>(total).count();
- break;
- case 'p':
- {
- boost::io::ios_precision_saver ips( os );
- os.precision( 1 );
- if ( times.real && total.count() )
- os << boost::chrono::duration<double>(total).count()
- /boost::chrono::duration<double>(chrono::nanoseconds(times.real)).count() * 100.0;
- else
- os << 0.0;
- }
- break;
- default:
- BOOST_ASSERT(0 && "basic_time_formatter internal logic error");
- }
- }
+ os << 0.0;
+ }
+ break;
+ default:
+ BOOST_ASSERT(0 && "basic_time_formatter internal logic error");
             }
           }
+ }
+ }
 
- template <class Stopwatch >
- static void show_time( Stopwatch & stopwatch_
- , const char_type* format, int places, ostream_type & os
- , system::error_code & ec)
- // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
- // be as low as 10, although will be 15 for many common platforms.
+ template<class Stopwatch>
+ static void show_time(Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, system::error_code & ec)
+ // NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
+ // be as low as 10, although will be 15 for many common platforms.
+ {
+ typedef typename Stopwatch::duration duration;
+ typedef typename duration::rep rep;
+ duration d = stopwatch_.elapsed(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
         {
- typedef typename Stopwatch::duration duration;
- typedef typename duration::rep rep;
- duration d = stopwatch_.elapsed( ec );
- if (!BOOST_CHRONO_IS_THROWS(ec)) {
- if (ec) return;
- }
- rep times=d.count();
- show_time<Stopwatch>(times, format, places, os, ec);
+ if (ec)
+ return;
         }
+ rep times = d.count();
+ show_time<Stopwatch> (times, format, places, os, ec);
+ }
     };
 
-namespace detail {
- template <typename CharT>
- struct basic_time_formatter_default_format;
- template <>
- struct basic_time_formatter_default_format<char> {
- static const char* apply() {return BOOST_STOPWATCHES_TIME_FORMAT_DEFAULT; }
- };
+ namespace detail
+ {
+ template<typename CharT>
+ struct basic_time_formatter_default_format;
+ template<>
+ struct basic_time_formatter_default_format<char>
+ {
+ static const char* apply()
+ {
+ return BOOST_STOPWATCHES_TIME_FORMAT_DEFAULT;
+ }
+ };
 #ifndef BOOST_NO_STD_WSTRING
- template <>
- struct basic_time_formatter_default_format<wchar_t> {
- static const wchar_t* apply() {return L"real %rs, cpu %cs (%p%), user %us, system %ss\n"; }
- };
+ template<>
+ struct basic_time_formatter_default_format<wchar_t>
+ {
+ static const wchar_t* apply()
+ {
+ return L"real %rs, cpu %cs (%p%), user %us, system %ss\n";
+ }
+ };
 
 #endif
-}
+ }
 
- template <typename CharT,typename Traits, class Alloc>
- const typename basic_time_formatter<CharT,Traits,Alloc>::char_type*
- basic_time_formatter<CharT,Traits,Alloc>::default_format() {
- return detail::basic_time_formatter_default_format<CharT>::apply();
+ template<typename CharT, typename Traits, class Alloc>
+ const typename basic_time_formatter<CharT, Traits, Alloc>::char_type*
+ basic_time_formatter<CharT, Traits, Alloc>::default_format()
+ {
+ return detail::basic_time_formatter_default_format<CharT>::apply();
     }
 
- template <typename CharT,typename Traits, class Alloc>
- typename basic_time_formatter<CharT,Traits,Alloc>::ostream_type &
- basic_time_formatter<CharT,Traits,Alloc>::default_os() {
- return detail::default_out<CharT,Traits>::apply();
+ template<typename CharT, typename Traits, class Alloc>
+ typename basic_time_formatter<CharT, Traits, Alloc>::ostream_type &
+ basic_time_formatter<CharT, Traits, Alloc>::default_os()
+ {
+ return detail::default_out<CharT, Traits>::apply();
     }
 
     typedef basic_time_formatter<char> time_formatter;

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/loop_stopclock_accumulator_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/loop_stopclock_accumulator_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/loop_stopclock_accumulator_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -16,21 +16,22 @@
 int f1(long j)
 {
   stopclock_accumulator<> acc(BOOST_STOPWATCHES_ACCUMULATOR_FUNCTION_FORMAT);
- for ( long i = 0; i < j; ++i ) {
+ for (long i = 0; i < j; ++i)
+ {
     stopclock_accumulator<>::scoped_run _(acc);
- //~ std::cout << "i="<<i <<" ";
- //~ std::cout << " j="<<j <<" ";
+ //~ std::cout << "i="<<i <<" ";
+ //~ std::cout << " j="<<j <<" ";
     //~ stopclock<> s;
- std::sqrt( 123.456L ); // burn some time
+ std::sqrt(123.456L); // burn some time
     boost::this_thread::sleep_for(boost::chrono::milliseconds(20));
   }
-
 
   return 0;
 }
 int main()
 {
- static stopclock_accumulator<> acc(BOOST_STOPWATCHES_ACCUMULATOR_FUNCTION_FORMAT);
+ static stopclock_accumulator<>
+ acc(BOOST_STOPWATCHES_ACCUMULATOR_FUNCTION_FORMAT);
   stopclock_accumulator<>::scoped_run _(acc);
 
   f1(100);

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/nested_stopclock_accumulator_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/nested_stopclock_accumulator_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/nested_stopclock_accumulator_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -31,37 +31,37 @@
 
 void f1()
 {
+ //~ static stopclock_accumulator<> acc(
+ //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
+ //~ );
+ //~ stopclock_accumulator<>::scoped_run _(acc);
+ BOOST_STOPWATCHES_STOPCLOCK_ACCUMULATOR_FCT;
+ //BOOST_STOPWATCHES_STOPCLOCK_ACCUMULATOR_FCT_REVERSE;
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
+ {
+ BOOST_STOPWATCHES_STOPCLOCK_ACCUMULATOR;
     //~ static stopclock_accumulator<> acc(
- //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
+ //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
     //~ );
     //~ stopclock_accumulator<>::scoped_run _(acc);
- BOOST_STOPWATCHES_STOPCLOCK_ACCUMULATOR_FCT;
- //BOOST_STOPWATCHES_STOPCLOCK_ACCUMULATOR_FCT_REVERSE;
- boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
- {
- BOOST_STOPWATCHES_STOPCLOCK_ACCUMULATOR;
- //~ static stopclock_accumulator<> acc(
- //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
- //~ );
- //~ stopclock_accumulator<>::scoped_run _(acc);
- boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
- }
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
+ }
 
 }
 int main()
 {
- BOOST_STOPWATCHES_STOPCLOCK_ACCUMULATOR_FCT;
- //~ static stopclock_accumulator<> acc(
- //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
- //~ );
- //~ stopclock_accumulator<>::scoped_run _(acc);
+ BOOST_STOPWATCHES_STOPCLOCK_ACCUMULATOR_FCT;
+ //~ static stopclock_accumulator<> acc(
+ //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
+ //~ );
+ //~ stopclock_accumulator<>::scoped_run _(acc);
 
- boost::this_thread::sleep_for(boost::chrono::milliseconds(10));
- f1();
- boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
- f1();
- boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
- f1();
- boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
- return 0;
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(10));
+ f1();
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
+ f1();
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
+ f1();
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
+ return 0;
 }

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/scoped_stopclock_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/scoped_stopclock_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/scoped_stopclock_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -14,8 +14,8 @@
 {
   scoped_stopclock<> _(BOOST_CURRENT_FUNCTION);
 
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
+ for (long i = 0; i < j; ++i)
+ std::sqrt(123.456L); // burn some time
 
   return 0;
 }

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/scoped_stopwatch_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/scoped_stopwatch_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/scoped_stopwatch_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -16,39 +16,47 @@
 #include <boost/chrono/chrono_io.hpp>
 #include <boost/format.hpp>
 
-namespace boost { namespace chrono {
- template <>
- struct stopwatch_reporter2_default_formatter<stopwatch<system_clock> > {
+namespace boost
+{
+ namespace chrono
+ {
+ template<>
+ struct stopwatch_reporter2_default_formatter<stopwatch<system_clock> >
+ {
       typedef elapsed_formatter type;
- };
- template <>
- struct stopwatch_reporter2_default_formatter<stopwatch<high_resolution_clock> > {
+ };
+ template<>
+ struct stopwatch_reporter2_default_formatter<stopwatch<
+ high_resolution_clock> >
+ {
       typedef elapsed_formatter type;
- };
- template <>
- struct stopwatch_reporter2_default_formatter<simple_stopwatch<high_resolution_clock> > {
+ };
+ template<>
+ struct stopwatch_reporter2_default_formatter<simple_stopwatch<
+ high_resolution_clock> >
+ {
       typedef elapsed_formatter type;
- };
-}}
+ };
+ }
+}
 
 using namespace boost::chrono;
 using namespace boost;
 
-
 long double res;
 void f0(long j)
 {
   stopwatch_reporter2<simple_stopwatch<high_resolution_clock> > sw;
- for (long i =0; i< j; i+=1)
- res+=std::sqrt( res+123.456L+i ); // burn some time
+ for (long i = 0; i < j; i += 1)
+ res += std::sqrt(res + 123.456L + i); // burn some time
 }
 void f1(long j)
 {
   boost::format fmt("%1%[%2%] f1(%3%) - Elapsed time: %4%");
   fmt % __FILE__ % __LINE__ % j;
   stopwatch_reporter2<stopwatch<high_resolution_clock> > sw(fmt);
- for (long i =0; i< j; i+=1)
- res+=std::sqrt( res+123.456L+i ); // burn some time
+ for (long i = 0; i < j; i += 1)
+ res += std::sqrt(res + 123.456L + i); // burn some time
 }
 
 void f2(long j)
@@ -56,37 +64,37 @@
   boost::format fmt("%1%[%2%] %3% - Elapsed time: %4%");
   fmt % __FILE__ % __LINE__ % BOOST_CURRENT_FUNCTION;
   stopwatch_reporter2<stopwatch<high_resolution_clock> > sw(fmt);
- for (long i =0; i< j; i+=1)
- res+=std::sqrt( res+123.456L+i ); // burn some time
- stopwatch_suspender< stopwatch_reporter2<stopwatch<high_resolution_clock> > > _(sw);
+ for (long i = 0; i < j; i += 1)
+ res += std::sqrt(res + 123.456L + i); // burn some time
+ stopwatch_suspender<stopwatch_reporter2<stopwatch<high_resolution_clock> > >
+ _(sw);
   boost::this_thread::sleep_for(boost::chrono::milliseconds(10));
 }
 void f3(long j)
 {
- typedef basic_elapsed_formatter<milli > formatter;
- formatter fmt("Elapsed time: %1%",std::cerr);
+ typedef basic_elapsed_formatter<milli> formatter;
+ formatter fmt("Elapsed time: %1%", std::cerr);
   fmt.set_duration_style(duration_style::prefix_text);
   fmt.set_precision(6);
 
- stopwatch_reporter2<stopwatch<high_resolution_clock>, formatter> sw(fmt);
- for (long i =0; i< j; i+=1)
- res+=std::sqrt( res+123.456L+i ); // burn some time
+ stopwatch_reporter2<stopwatch<high_resolution_clock> , formatter> sw(fmt);
+ for (long i = 0; i < j; i += 1)
+ res += std::sqrt(res + 123.456L + i); // burn some time
 }
 
 int main()
 {
- std::cout << __FILE__ << "[" << __LINE__ <<"]"<< std::endl;
- stopwatch_reporter2<stopwatch<> > sw(BOOST_CHRONO_STOPWATCHES_ELAPSED_FUNCTION_FORMAT);
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ stopwatch_reporter2<stopwatch<> >
+ sw(BOOST_CHRONO_STOPWATCHES_ELAPSED_FUNCTION_FORMAT);
+
+ res = 0;
+ f0(1000000);
+ f1(1000000);
+ f2(1000000);
+ f3(3000000);
 
- res=0;
- f0(1000000);
- f1(1000000);
- f2(1000000);
- f3(3000000);
-
- std::cout<< res << std::endl;
+ std::cout << res << std::endl;
   return 0;
 }
 
-
-

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/sleep_for.hpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/sleep_for.hpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/sleep_for.hpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -10,17 +10,21 @@
 
 #include <boost/chrono/chrono.hpp>
 
-namespace boost {
-namespace this_thread {
-
-
-template <class Rep, class Period>
-void sleep_for(const boost::chrono::duration<Rep, Period>& d)
+namespace boost
 {
- boost::chrono::high_resolution_clock::time_point go = boost::chrono::high_resolution_clock::now() + d;
- while (boost::chrono::high_resolution_clock::now() < go) {}
-}
-}
+ namespace this_thread
+ {
+
+ template<class Rep, class Period>
+ void sleep_for(const boost::chrono::duration<Rep, Period>& d)
+ {
+ boost::chrono::high_resolution_clock::time_point go =
+ boost::chrono::high_resolution_clock::now() + d;
+ while (boost::chrono::high_resolution_clock::now() < go)
+ {
+ }
+ }
+ }
 }
 
 #endif //BOOST_CHRONO_SLEEP_FOR__HPP

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/specific_stopwatch_accumulator_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/specific_stopwatch_accumulator_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/specific_stopwatch_accumulator_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -11,68 +11,76 @@
 using namespace boost::chrono;
 using namespace boost::accumulators;
 
- class my_stopwatch_accumulator_formatter {
- public:
- typedef std::string string_type;
- typedef char char_type;
- typedef std::ostream ostream_type;
-
- static ostream_type & default_os() {return std::cout;}
- static const char_type* default_format() {return "%c times, sum=%ss, mean=%as, variance=%vs\n";}
- static int default_places() { return 3; }
-
- template <class Stopwatch >
- static void show_time( Stopwatch & stopwatch_, const char_type* format,
- int places, ostream_type & os, boost::system::error_code & ec)
+class my_stopwatch_accumulator_formatter
+{
+public:
+ typedef std::string string_type;
+ typedef char char_type;
+ typedef std::ostream ostream_type;
+
+ static ostream_type & default_os()
+ {
+ return std::cout;
+ }
+ static const char_type* default_format()
+ {
+ return "%c times, sum=%ss, mean=%as, variance=%vs\n";
+ }
+ static int default_places()
+ {
+ return 3;
+ }
+
+ template<class Stopwatch>
+ static void show_time(Stopwatch & stopwatch_, const char_type* format, int places, ostream_type & os, boost::system::error_code & ec)
+ {
+ if (&ec != &BOOST_CHRONO_THROWS)
+ ec.clear();
+ typedef typename Stopwatch::storage_type accumulator_t;
+ typedef typename Stopwatch::duration duration_t;
+ accumulator_t& acc = stopwatch_.get_storage();
+
+ boost::io::ios_flags_saver ifs(os);
+ os.setf(std::ios_base::fixed, std::ios_base::floatfield);
+ boost::io::ios_precision_saver ips(os);
+ os.precision(places);
+
+ for (; *format; ++format)
+ {
+ if (*format != '%' || !*(format + 1)
+ || !std::strchr("acsv", *(format + 1)))
+ {
+ os << *format;
+ } else
+ {
+ ++format;
+ switch (*format)
         {
- if (&ec != &BOOST_CHRONO_THROWS) ec.clear();
- typedef typename Stopwatch::storage_type accumulator_t;
- typedef typename Stopwatch::duration duration_t;
- accumulator_t& acc = stopwatch_.get_storage();
-
- boost::io::ios_flags_saver ifs( os );
- os.setf( std::ios_base::fixed, std::ios_base::floatfield );
- boost::io::ios_precision_saver ips( os );
- os.precision( places );
-
- for ( ; *format; ++format ) {
- if ( *format != '%' || !*(format+1) || !std::strchr("acsv", *(format+1)) ) {
- os << *format;
- } else {
- ++format;
- switch ( *format ) {
- case 's':
- os << boost::chrono::duration<double>(duration_t(sum(acc))).count();
- break;
- case 'a':
- os << count(acc)>0?boost::chrono::duration<double>(duration_t(typename duration_t::rep(sum(acc)))).count()/count(acc):0;
- break;
- case 'c':
- os << count(acc);
- break;
- case 'v':
- os << boost::chrono::duration<double>(duration_t(typename duration_t::rep(variance(acc)))).count();
- break;
- default:
- assert(0 && "my_stopwatch_accumulator_formatter internal logic error");
- }
- }
- }
+ case 's':
+ os << boost::chrono::duration<double>(duration_t(sum(acc))).count();
+ break;
+ case 'a':
+ os << count(acc) > 0 ? boost::chrono::duration<double>(duration_t(typename duration_t::rep(sum(acc)))).count()
+ / count(acc) : 0;
+ break;
+ case 'c':
+ os << count(acc);
+ break;
+ case 'v':
+ os
+ << boost::chrono::duration<double>(duration_t(typename duration_t::rep(variance(acc)))).count();
+ break;
+ default:
+ assert(0 && "my_stopwatch_accumulator_formatter internal logic error");
         }
- };
-
-
-typedef stopwatch_reporter<
- stopwatch_accumulator<process_real_cpu_clock,
- features<
- tag::count,
- tag::sum,
- tag::mean,
- tag::variance(lazy)
- >
- >
- , my_stopwatch_accumulator_formatter
- > my_stopwatch_accumulator_reporter;
+ }
+ }
+ }
+};
+
+typedef stopwatch_reporter<stopwatch_accumulator<process_real_cpu_clock,
+ features<tag::count, tag::sum, tag::mean, tag::variance(lazy)> > ,
+ my_stopwatch_accumulator_formatter> my_stopwatch_accumulator_reporter;
 
 int f1(long j)
 {
@@ -80,8 +88,8 @@
   static my_stopwatch_accumulator_reporter acc;
   my_stopwatch_accumulator_reporter::scoped_run _(acc);
 
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
+ for (long i = 0; i < j; ++i)
+ std::sqrt(123.456L); // burn some time
 
   return 0;
 }

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/stopclock_accumulator_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/stopclock_accumulator_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/stopclock_accumulator_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -11,26 +11,27 @@
 
 using namespace boost::chrono;
 
-template <typename Clock>
+template<typename Clock>
 int f1(long j)
 {
- static stopclock_accumulator<Clock> acc(BOOST_STOPWATCHES_ACCUMULATOR_FUNCTION_FORMAT);
+ static stopclock_accumulator<Clock>
+ acc(BOOST_STOPWATCHES_ACCUMULATOR_FUNCTION_FORMAT);
   typename stopclock_accumulator<Clock>::scoped_run _(acc);
 
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
+ for (long i = 0; i < j; ++i)
+ std::sqrt(123.456L); // burn some time
   boost::this_thread::sleep_for(boost::chrono::milliseconds(20));
-
 
   return 0;
 }
 int main()
 {
- static stopclock_accumulator<process_cpu_clock> acc(BOOST_STOPWATCHES_ACCUMULATOR_TIME_FUNCTION_FORMAT);
+ static stopclock_accumulator<process_cpu_clock>
+ acc(BOOST_STOPWATCHES_ACCUMULATOR_TIME_FUNCTION_FORMAT);
   stopclock_accumulator<process_cpu_clock>::scoped_run _(acc);
 
- f1<high_resolution_clock>(1000);
- f1<high_resolution_clock>(2000);
- f1<high_resolution_clock>(3000);
+ f1<high_resolution_clock> (1000);
+ f1<high_resolution_clock> (2000);
+ f1<high_resolution_clock> (3000);
   return 0;
 }

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/stopclock_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/stopclock_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/stopclock_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -11,16 +11,16 @@
 
 int f1(long j)
 {
- stopclock<> _(BOOST_STOPWATCHES_TIME_FUNCTION_FORMAT);
+ stopclock<> _(BOOST_STOPWATCHES_TIME_FUNCTION_FORMAT);
 
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
+ for (long i = 0; i < j; ++i)
+ std::sqrt(123.456L); // burn some time
 
   return 0;
 }
 int main()
 {
- stopclock<> _(BOOST_STOPWATCHES_TIME_FUNCTION_FORMAT);
+ stopclock<> _(BOOST_STOPWATCHES_TIME_FUNCTION_FORMAT);
 
   f1(1000);
   f1(2000);

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/stopwatch_accumulator_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/stopwatch_accumulator_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/stopwatch_accumulator_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -14,7 +14,6 @@
 #include <boost/format/group.hpp>
 #include <boost/chrono/chrono_io.hpp>
 
-
 using namespace boost::chrono;
 using namespace boost;
 
@@ -24,51 +23,56 @@
   return boost::chrono::duration_short(os);
 }
 
-template <typename Stopwatch, typename Ratio=boost::ratio<1> >
-class stopwatch_reporter : public Stopwatch
+template<typename Stopwatch, typename Ratio = boost::ratio<1> >
+class stopwatch_reporter: public Stopwatch
 {
- public:
- stopwatch_reporter( )
- : internal_fmt_("times=%1%, sum=%2%, min=%3%, max=%4%, mean=%5%, frequency=%6% Hz, lifetime=%7%, time=%8% %%"),
- fmt_(internal_fmt_),
- os_(std::cout)
- {}
- stopwatch_reporter(const char* str )
- : internal_fmt_(str),
- fmt_(internal_fmt_),
- os_(std::cout)
- {}
- stopwatch_reporter(std::string const& str )
- : internal_fmt_(str),
- fmt_(internal_fmt_),
- os_(std::cout)
- {}
- stopwatch_reporter(boost::format & fmt )
- : fmt_(fmt),
- os_(std::cout)
- {}
- ~stopwatch_reporter() {
+public:
+ stopwatch_reporter() :
+ internal_fmt_("times=%1%, sum=%2%, min=%3%, max=%4%, mean=%5%, frequency=%6% Hz, lifetime=%7%, time=%8% %%"),
+ fmt_(internal_fmt_), os_(std::cout)
+ {
+ }
+ stopwatch_reporter(const char* str) :
+ internal_fmt_(str), fmt_(internal_fmt_), os_(std::cout)
+ {
+ }
+ stopwatch_reporter(std::string const& str) :
+ internal_fmt_(str), fmt_(internal_fmt_), os_(std::cout)
+ {
+ }
+ stopwatch_reporter(boost::format & fmt) :
+ fmt_(fmt), os_(std::cout)
+ {
+ }
+ ~stopwatch_reporter()
+ {
     typename Stopwatch::accumulator_set& acc = this->get_storage();
     typedef typename Stopwatch::duration duration_t;
- std::size_t precision_=3;
+ std::size_t precision_ = 3;
 
- os_ << fmt_
- % boost::accumulators::count(acc)
- % io::group(std::fixed, std::setprecision(precision_),my_duration_short, boost::chrono::duration<double,Ratio>(duration_t(boost::accumulators::sum(acc))))
- % io::group(std::fixed, std::setprecision(precision_),my_duration_short, boost::chrono::duration<double,Ratio>(duration_t((boost::accumulators::min)(acc))))
- % io::group(std::fixed, std::setprecision(precision_),my_duration_short, boost::chrono::duration<double,Ratio>(duration_t((boost::accumulators::max)(acc))))
- % io::group(std::fixed, std::setprecision(precision_),my_duration_short,((boost::accumulators::count(acc)>0)
- ? boost::chrono::duration<double,Ratio>(duration_t(boost::accumulators::sum(acc)/boost::accumulators::count(acc)))
- : boost::chrono::duration<double,Ratio>(duration_t(0))))
- % io::group(std::fixed, std::setprecision(precision_),
- ((boost::accumulators::count(acc)>0)
- ? boost::accumulators::count(acc)/boost::chrono::duration<double>(this->lifetime())
- : 0))
- % io::group(std::fixed, std::setprecision(precision_),my_duration_short, boost::chrono::duration<double,Ratio>(this->lifetime()))
- % io::group(std::fixed, std::setprecision(precision_),boost::chrono::duration<double>(duration_t(accumulators::sum(acc))).count()*100/boost::chrono::duration<double>(this->lifetime()).count())
- << std::endl;
+ os_
+ << fmt_ % boost::accumulators::count(acc)
+ % io::group(std::fixed, std::setprecision(precision_), my_duration_short, boost::chrono::duration<
+ double, Ratio>(duration_t(boost::accumulators::sum(acc))))
+ % io::group(std::fixed, std::setprecision(precision_), my_duration_short, boost::chrono::duration<
+ double, Ratio>(duration_t((boost::accumulators::min)(acc))))
+ % io::group(std::fixed, std::setprecision(precision_), my_duration_short, boost::chrono::duration<
+ double, Ratio>(duration_t((boost::accumulators::max)(acc))))
+ % io::group(std::fixed, std::setprecision(precision_), my_duration_short, ((boost::accumulators::count(acc)
+ > 0) ? boost::chrono::duration<double, Ratio>(duration_t(boost::accumulators::sum(acc)
+ / boost::accumulators::count(acc))) : boost::chrono::duration<
+ double, Ratio>(duration_t(0))))
+ % io::group(std::fixed, std::setprecision(precision_), ((boost::accumulators::count(acc)
+ > 0) ? boost::accumulators::count(acc)
+ / boost::chrono::duration<double>(this->lifetime()) : 0))
+ % io::group(std::fixed, std::setprecision(precision_), my_duration_short, boost::chrono::duration<
+ double, Ratio>(this->lifetime()))
+ % io::group(std::fixed, std::setprecision(precision_), boost::chrono::duration<
+ double>(duration_t(accumulators::sum(acc))).count() * 100
+ / boost::chrono::duration<double>(this->lifetime()).count())
+ << std::endl;
   }
- private:
+private:
   boost::format internal_fmt_;
   boost::format& fmt_;
   std::ostream& os_;
@@ -80,19 +84,17 @@
 {
   //static stopwatch_reporter<stopwatch_accumulator<high_resolution_clock> > acc(BOOST_STOPWATCHES_ACCUMULATOR_FUNCTION_FORMAT);
   //stopwatch_reporter<stopwatch_accumulator<high_resolution_clock> >::scoped_run r_(acc);
- static ::stopwatch_reporter<stopwatch_accumulator<high_resolution_clock>, boost::micro> acc;
- stopwatch_runner<
- ::stopwatch_reporter<
- stopwatch_accumulator<high_resolution_clock>, boost::micro
- >
- > r_(acc);
+ static ::stopwatch_reporter<stopwatch_accumulator<high_resolution_clock> ,
+ boost::micro> acc;
+ stopwatch_runner< ::stopwatch_reporter<stopwatch_accumulator<
+ high_resolution_clock> , boost::micro> > r_(acc);
   //static stopwatch_reporter<stopwatch_accumulator<process_real_cpu_clock> > acc2(BOOST_STOPWATCHES_ACCUMULATOR_FUNCTION_FORMAT);
   //stopwatch_reporter<stopwatch_accumulator<process_real_cpu_clock> >::scoped_run r2_(acc2);
 
   //stopwatch_runner<swa > _(sw);
 
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
+ for (long i = 0; i < j; ++i)
+ std::sqrt(123.456L); // burn some time
 
   return 0;
 }
@@ -102,18 +104,18 @@
 
   std::cout << duration_short << nanoseconds(10) << std::endl;
 
- f1(10000000,sw);
- f1(20000000,sw);
- f1(30000000,sw);
-
-// swa::accumulator_set& acc = sw.get_storage();
-// std::cout << "f1() Lifetime: " << sw.lifetime() << std::endl;
-// std::cout << "f1() Elapsed: " << sw.elapsed() << std::endl;
-// std::cout << "f1() Count: " << accumulators::count(acc) << std::endl;
-// std::cout << "f1() Sum: " << accumulators::sum(acc) << std::endl;
-// std::cout << "f1() Sum/Count: " << accumulators::sum(acc)/accumulators::count(acc) << std::endl;
-// std::cout << "f1() Mean: " << accumulators::mean(acc) << std::endl;
-// std::cout << "f1() Min: " << (accumulators::min)(acc) << std::endl;
-// std::cout << "f1() Max: " << (accumulators::max)(acc) << std::endl;
+ f1(10000000, sw);
+ f1(20000000, sw);
+ f1(30000000, sw);
+
+ // swa::accumulator_set& acc = sw.get_storage();
+ // std::cout << "f1() Lifetime: " << sw.lifetime() << std::endl;
+ // std::cout << "f1() Elapsed: " << sw.elapsed() << std::endl;
+ // std::cout << "f1() Count: " << accumulators::count(acc) << std::endl;
+ // std::cout << "f1() Sum: " << accumulators::sum(acc) << std::endl;
+ // std::cout << "f1() Sum/Count: " << accumulators::sum(acc)/accumulators::count(acc) << std::endl;
+ // std::cout << "f1() Mean: " << accumulators::mean(acc) << std::endl;
+ // std::cout << "f1() Min: " << (accumulators::min)(acc) << std::endl;
+ // std::cout << "f1() Max: " << (accumulators::max)(acc) << std::endl;
   return 0;
 }

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/stopwatch_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/stopwatch_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/stopwatch_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -17,10 +17,10 @@
   //stopwatch_reporter<stopwatch<> > _(BOOST_STOPWATCHES_STOPWATCH_FUNCTION_FORMAT);
   stopwatch<> sw;
 
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
+ for (long i = 0; i < j; ++i)
+ std::sqrt(123.456L); // burn some time
 
- std::cout << "f1("<< j <<") Elapsed time: " << sw.elapsed() << std::endl;
+ std::cout << "f1(" << j << ") Elapsed time: " << sw.elapsed() << std::endl;
   return 0;
 }
 int main()

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/suspendible_stopclock_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/suspendible_stopclock_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/suspendible_stopclock_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -15,24 +15,25 @@
 
 int f1(long j)
 {
- stopclock<suspendible_clock<high_resolution_clock> > a(9);
- //stopclock<high_resolution_clock> b(9);
+ stopclock<suspendible_clock<high_resolution_clock> > a(9);
+ //stopclock<high_resolution_clock> b(9);
 
- for ( int i = 0; i < j; ++i )
- res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) f1(j-1);
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
- return 0;
+ for (int i = 0; i < j; ++i)
+ res += std::sqrt(res + 123.456L + i); // burn some time
+ if (j != 0)
+ f1(j - 1);
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ return 0;
 }
 int main()
 {
- //stopclock<> _(BOOST_CHRONO_TIME_FUNCTION_FORMAT);
- //stopclock<> _(9);
- stopclock<suspendible_clock<high_resolution_clock> > a(9);
- //stopclock<high_resolution_clock> b(9);
+ //stopclock<> _(BOOST_CHRONO_TIME_FUNCTION_FORMAT);
+ //stopclock<> _(9);
+ stopclock<suspendible_clock<high_resolution_clock> > a(9);
+ //stopclock<high_resolution_clock> b(9);
 
- for (int i =1; i<= 3; ++i)
- f1(i*100);
- std::cout<< res << std::endl;
- return 0;
+ for (int i = 1; i <= 3; ++i)
+ f1(i * 100);
+ std::cout << res << std::endl;
+ return 0;
 }

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/t24_hours_example.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/t24_hours_example.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/t24_hours_example.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -15,17 +15,19 @@
 
 int f1(long j)
 {
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss(BOOST_STOPWATCHES_24_HOURS_FUNCTION_FORMAT);
+ stopwatch_reporter<stopwatch<process_real_cpu_clock> , t24_hours_formatter>
+ hhmmss(BOOST_STOPWATCHES_24_HOURS_FUNCTION_FORMAT);
   //stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss;
 
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
+ for (long i = 0; i < j; ++i)
+ std::sqrt(123.456L); // burn some time
 
   return 0;
 }
 int main()
 {
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss(BOOST_STOPWATCHES_24_HOURS_FUNCTION_FORMAT);
+ stopwatch_reporter<stopwatch<process_real_cpu_clock> , t24_hours_formatter>
+ hhmmss(BOOST_STOPWATCHES_24_HOURS_FUNCTION_FORMAT);
 
   f1(1000);
   f1(2000);

Modified: sandbox/stopwatches/libs/chrono/stopwatches/example/timex.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/example/timex.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/example/timex.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -10,9 +10,9 @@
 #include <string>
 #include <iostream>
 
-int main( int argc, char * argv[] )
+int main(int argc, char * argv[])
 {
- if ( argc == 1 )
+ if (argc == 1)
   {
     std::cout << "invoke: timex [-v] command [args...]\n"
       " command will be executed and timings displayed\n"
@@ -23,23 +23,26 @@
   std::string s;
 
   bool verbose = false;
- if ( argc > 1 && *argv[1] == '-' && *(argv[1]+1) == 'v' )
+ if (argc > 1 && *argv[1] == '-' && *(argv[1] + 1) == 'v')
   {
     verbose = true;
     ++argv;
     --argc;
   }
 
- for ( int i = 1; i < argc; ++i )
+ for (int i = 1; i < argc; ++i)
   {
- if ( i > 1 ) s += ' ';
+ if (i > 1)
+ s += ' ';
     s += argv[i];
   }
 
- if ( verbose )
- { std::cout << "command: \"" << s.c_str() << "\"\n"; }
+ if (verbose)
+ {
+ std::cout << "command: \"" << s.c_str() << "\"\n";
+ }
 
   boost::chrono::stopclock<> t;
 
- return std::system( s.c_str() );
+ return std::system(s.c_str());
 }

Modified: sandbox/stopwatches/libs/chrono/stopwatches/perf/stopclock_perf.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/perf/stopclock_perf.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/perf/stopclock_perf.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -15,779 +15,1447 @@
 using namespace boost::chrono;
 double res;
 
+namespace rep_none
+{
+ std::size_t count[11];
 
-namespace rep_none {
- std::size_t count[11];
+ template<typename Clock>
+ void f10(long v);
 
- 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 <= 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 <= 3)
+ return;
 
- 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<=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<=3) return;
-
- 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<=4) 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 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<=5) 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 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<=6) 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 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<=7) 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 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<=8) 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 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<=9) 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 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<=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>1) {
- f<Clock>(j-1);
- }
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ 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 <= 4)
+ 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 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 <= 5)
+ return;
 
-namespace rep_basic {
- std::size_t count[11];
+ 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 <= 6)
+ return;
 
- template <typename Clock>
- void f10(long v);
+ 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 <= 7)
+ return;
 
- 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>
- 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<=2) 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<=3) return;
-
- if (v%2==0) {f2<Clock>(v-1); return;}
- 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<=4) 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 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<=5) 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 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<=6) 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 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<=7) 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 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<=8) 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 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<=9) 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 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<=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)
- {
- stopclock<Clock> b(9);
-
- for ( long i = 0; i < j; ++i )
- res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j>1) {
- //std::cout << "f1("<<j-1<<")\n";
- f<Clock>(j-1);
- }
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ 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 <= 8)
+ return;
 
-namespace rep_suspendible {
- std::size_t count[11];
+ 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 <= 9)
+ return;
 
- template <typename Clock>
- void f10(long v);
+ 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 <= 10)
+ return;
 
- 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>
- 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<=2) 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<=3) return;
-
- if (v%2==0) {f2<Clock>(v-1);return;}
- 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<=4) 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 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<=5) 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 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<=6) 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 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<=7) 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 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<=8) 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 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<=9) 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 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<=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)
- {
- 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>1) {
- //std::cout << "f1("<<j-1<<")\n";
- f<Clock>(j-1);
- }
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ 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 > 1)
+ {
+ f<Clock> (j - 1);
+ }
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ }
 }
 
-namespace rep_accu {
- std::size_t count[11];
+namespace rep_basic
+{
+ std::size_t count[11];
+
+ template<typename Clock>
+ void f10(long v);
 
- 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>
+ 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 <= 2)
+ 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 <= 3)
+ return;
 
- 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
- if (v<=10) return;
- f10<Clock>(v-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<=2) 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<=3) return;
-
- if (v%2==0) {f2<Clock>(v-1);return;}
- 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<=4) 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 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<=5) 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 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<=6) 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 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<=7) 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 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<=8) 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 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<=9) 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 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<=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)
- {
- 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>1) {
- //std::cout << "f1("<<j-1<<")\n";
- f<Clock>(j-1);
- }
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ if (v % 2 == 0)
+ {
+ f2<Clock> (v - 1);
+ return;
     }
-}
+ 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 <= 4)
+ return;
 
-template <typename Clock, long SIZE>
-void test_clock_size()
-{
- long K =1;
- std::cout << ">>> test_clock_size " << SIZE << std::endl;
+ if (v % 3 == 0)
     {
- rep_none::count[0]=0;
- res=0;
- stopclock<Clock> b(9, std::string(">>> REC NONE ")+ stopwatch_formatter::default_format());
+ 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)
+ {
+ 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 <= 5)
+ return;
 
- for (long i =1; i<= K; ++i)
- rep_none::f<Clock>(i*SIZE);
- std::cout<< res << std::endl;
- std::cout<< ">>> COUNT REC NONE " << SIZE << " " << rep_none::count[0] << std::endl;
+ 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)
+ {
+ 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 <= 6)
+ 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)
     {
- res=0;
- stopclock<Clock> b(9, std::string(">>> REC BASIC ") + stopwatch_formatter::default_format());
+ f2<Clock> (v - 1);
+ return;
+ }
+ 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 <= 7)
+ return;
 
- for (long i =1; i<= K; ++i)
- rep_basic::f<Clock>(i*SIZE);
- std::cout<< res << std::endl;
+ if (v % 6 == 0)
+ {
+ f6<Clock> (v - 1);
+ return;
+ }
+ if (v % 5 == 0)
+ {
+ f5<Clock> (v - 1);
+ return;
     }
+ if (v % 4 == 0)
     {
- res=0;
- stopclock<suspendible_clock<Clock> > a(9, std::string(">>> REC SUSPEND ") + stopwatch_formatter::default_format());
+ 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)
+ {
+ 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 <= 8)
+ return;
 
- for (long i =1; i<= K; ++i)
- rep_suspendible::f<Clock>(i*SIZE);
- std::cout<< res << std::endl;
+ 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)
     {
- res=0;
- stopclock<Clock> b(9, std::string(">>> REC ACCU ") + stopwatch_formatter::default_format());
+ 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)
+ {
+ 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 <= 9)
+ return;
 
- for (long i =1; i<= K; ++i)
- rep_accu::f<Clock>(i*SIZE);
- std::cout<< res << std::endl;
+ 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)
     {
- 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());
+ 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)
+ {
+ 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;
 
- 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;
+ 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)
     {
- res=0;
- stopclock<Clock> b(9, std::string(">>> NON_REC BASIC ") + stopwatch_formatter::default_format());
+ 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)
+ {
+ stopclock<Clock> b(9);
+
+ for (long i = 0; i < j; ++i)
+ res += std::sqrt(res + 123.456L + i); // burn some time
+ if (j > 1)
+ {
+ //std::cout << "f1("<<j-1<<")\n";
+ f<Clock> (j - 1);
+ }
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ }
+}
 
- for (long i =1; i<= K; ++i)
- rep_basic::f10<Clock>(i*SIZE);
- std::cout<< res << std::endl;
+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>
+ 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 <= 2)
+ 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 <= 3)
+ return;
+
+ if (v % 2 == 0)
+ {
+ f2<Clock> (v - 1);
+ return;
     }
+ 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 <= 4)
+ return;
+
+ if (v % 3 == 0)
+ {
+ f3<Clock> (v - 1);
+ return;
+ }
+ if (v % 2 == 0)
     {
- res=0;
- stopclock<suspendible_clock<Clock> > a(9, std::string(">>> NON_REC SUSPEND ") + stopwatch_formatter::default_format());
+ f2<Clock> (v - 1);
+ return;
+ }
+ 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 <= 5)
+ return;
 
- for (long i =1; i<= K; ++i)
- rep_suspendible::f10<Clock>(i*SIZE);
- std::cout<< res << std::endl;
+ if (v % 4 == 0)
+ {
+ f4<Clock> (v - 1);
+ return;
     }
+ if (v % 3 == 0)
     {
- res=0;
- stopclock<Clock> b(9, std::string(">>> NON_REC ACCU ") + stopwatch_formatter::default_format());
+ 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)
+ {
+ 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 <= 6)
+ return;
 
- for (long i =1; i<= K; ++i)
- rep_accu::f10<Clock>(i*SIZE);
- std::cout<< res << std::endl;
+ if (v % 5 == 0)
+ {
+ f5<Clock> (v - 1);
+ return;
     }
-#if 0
-#endif
+ 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)
+ {
+ 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 <= 7)
+ 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 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 <= 8)
+ 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 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 <= 9)
+ 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 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 <= 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)
+ {
+ 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 > 1)
+ {
+ //std::cout << "f1("<<j-1<<")\n";
+ f<Clock> (j - 1);
+ }
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ }
 }
 
-template <typename Clock>
-void test_clock()
+namespace rep_accu
 {
- //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>();
+ 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);
+ 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 <= 10)
+ return;
+ f10<Clock> (v - 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 <= 2)
+ 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 <= 3)
+ return;
+
+ if (v % 2 == 0)
+ {
+ f2<Clock> (v - 1);
+ return;
+ }
+ 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 <= 4)
+ 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 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 <= 5)
+ 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 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 <= 6)
+ 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 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 <= 7)
+ 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 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 <= 8)
+ 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 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 <= 9)
+ 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 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 <= 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)
+ {
+ 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 > 1)
+ {
+ //std::cout << "f1("<<j-1<<")\n";
+ f<Clock> (j - 1);
+ }
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
+ }
+}
 
+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 <= K; ++i)
+ rep_none::f<Clock>(i * SIZE);
+ 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 <= K; ++i)
+ rep_basic::f<Clock>(i * SIZE);
+ std::cout << res << std::endl;
+ }
+ {
+ res = 0;
+ stopclock<suspendible_clock<Clock> > a(9, std::string(">>> REC SUSPEND ")
+ + stopwatch_formatter::default_format());
+
+ for (long i = 1; i <= K; ++i)
+ rep_suspendible::f<Clock>(i * SIZE);
+ std::cout << res << std::endl;
+ }
+ {
+ res = 0;
+ stopclock<Clock> b(9, std::string(">>> REC ACCU ")
+ + stopwatch_formatter::default_format());
+
+ 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 <= 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 <= K; ++i)
+ rep_basic::f10<Clock>(i * SIZE);
+ std::cout << res << std::endl;
+ }
+ {
+ res = 0;
+ stopclock<suspendible_clock<Clock> >
+ a(9, std::string(">>> NON_REC SUSPEND ")
+ + stopwatch_formatter::default_format());
+
+ for (long i = 1; i <= K; ++i)
+ rep_suspendible::f10<Clock>(i * SIZE);
+ std::cout << res << std::endl;
+ }
+ {
+ res = 0;
+ stopclock<Clock> b(9, std::string(">>> NON_REC ACCU ")
+ + stopwatch_formatter::default_format());
+
+ 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> ();
+
+}
 
-int main() {
+int main()
+{
 #ifdef BOOST_CHRONO_HAS_THREAD_CLOCK
- std::cout << ">>> main thread_clock" << std::endl;
- test_clock<thread_clock>();
+ std::cout << ">>> main thread_clock" << std::endl;
+ test_clock<thread_clock>();
 #endif
- std::cout << ">>> main high_resolution_clock" << std::endl;
- test_clock<high_resolution_clock>();
+ 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;
- test_clock<thread_clock>();
+ std::cout << ">>> main thread_clock" << std::endl;
+ test_clock<thread_clock>();
 #endif
 
- return 0;
+ return 0;
 
 }

Modified: sandbox/stopwatches/libs/chrono/stopwatches/test/stopclock_constructor_overload_test.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/test/stopclock_constructor_overload_test.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/test/stopclock_constructor_overload_test.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -12,7 +12,6 @@
 #include <locale>
 #include <ctime>
 #include <cmath> // for sqrt(), used to burn time
-
 using boost::chrono::stopclock;
 using boost::chrono::time_formatter;
 using boost::system::error_code;
@@ -26,34 +25,45 @@
   {
     // exercise each supported combination of constructor arguments
 
- std::ostream & os = std::cout;
- const int pl = 9;
- boost::system::error_code ec;
+ std::ostream & os = std::cout;
+ const int pl = 9;
+ boost::system::error_code ec;
 
     stopclock<> t1;
- stopclock<> t2( os );
- stopclock<> t3( ec );
- stopclock<> t4( os, ec );
- stopclock<> t5( pl );
- stopclock<> t6( os, pl );
- stopclock<> t7( pl, ec );
- stopclock<> t8( os, pl, ec );
- stopclock<> t9( "t9, default places, r %r, c %c, p %p, u %u, s %s\n" );
- stopclock<> t10( os, "t10, default places, r %r, c %c, p %p, u %u, s %s\n" );
- stopclock<> t11( "t11, default places, r %r, c %c, p %p, u %u, s %s\n", ec );
- stopclock<> t12( os, "t12, default places, r %r, c %c, p %p, u %u, s %s\n", ec );
- stopclock<> t13( pl, "t13, explicitly code places, r %r, c %c, p %p, u %u, s %s\n" );
- stopclock<> t14( "t14, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl );
- stopclock<> t15( os, pl, "t15, explicitly code places, r %r, c %c, p %p, u %u, s %s\n" );
- stopclock<> t16( os, "t16, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl );
- stopclock<> t17( pl, "t17, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", ec );
- stopclock<> t18( "t18, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl, ec );
- stopclock<> t19( os, pl, "t19, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", ec );
- stopclock<> t20( os, "t20, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl, ec );
+ stopclock<> t2(os);
+ stopclock<> t3(ec);
+ stopclock<> t4(os, ec);
+ stopclock<> t5(pl);
+ stopclock<> t6(os, pl);
+ stopclock<> t7(pl, ec);
+ stopclock<> t8(os, pl, ec);
+ stopclock<> t9("t9, default places, r %r, c %c, p %p, u %u, s %s\n");
+ stopclock<> t10(os, "t10, default places, r %r, c %c, p %p, u %u, s %s\n");
+ stopclock<> t11("t11, default places, r %r, c %c, p %p, u %u, s %s\n", ec);
+ stopclock<>
+ t12(os, "t12, default places, r %r, c %c, p %p, u %u, s %s\n", ec);
+ stopclock<>
+ t13(pl, "t13, explicitly code places, r %r, c %c, p %p, u %u, s %s\n");
+ stopclock<>
+ t14("t14, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl);
+ stopclock<>
+ t15(os, pl, "t15, explicitly code places, r %r, c %c, p %p, u %u, s %s\n");
+ stopclock<>
+ t16(os, "t16, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl);
+ stopclock<>
+ t17(pl, "t17, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", ec);
+ stopclock<>
+ t18("t18, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl, ec);
+ stopclock<>
+ t19(os, pl, "t19, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", ec);
+ stopclock<>
+ t20(os, "t20, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl, ec);
 
     std::cout << "Burn some time so run_timers have something to report...";
     boost::chrono::stopwatch<boost::chrono::high_resolution_clock> t;
- while ( t.elapsed() < boost::chrono::seconds(1) ) {}
+ while (t.elapsed() < boost::chrono::seconds(1))
+ {
+ }
     std::cout << "\n";
     std::cout << time_formatter::default_places() << " default places\n";
     std::cout << pl << " explicitly coded places\n";
@@ -61,13 +71,13 @@
 
 }
 
-int main( )
+int main()
 {
   //~ std::locale loc( "" ); // test with appropriate locale
   //~ std::cout.imbue( loc );
 
   stopclock_constructor_overload_test();
-
+
   return boost::report_errors();
 }
 

Modified: sandbox/stopwatches/libs/chrono/stopwatches/test/test_minmax.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/test/test_minmax.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/test/test_minmax.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -10,9 +10,9 @@
 
 #include <boost/chrono/stopwatches/stopwatches.hpp>
 
- int main()
- {
- boost::chrono::stopclock<> _;
- }
+int main()
+{
+ boost::chrono::stopclock<> _;
+}
 
 #endif

Modified: sandbox/stopwatches/libs/chrono/stopwatches/test/wstopclock_constructor_overload_test.cpp
==============================================================================
--- sandbox/stopwatches/libs/chrono/stopwatches/test/wstopclock_constructor_overload_test.cpp (original)
+++ sandbox/stopwatches/libs/chrono/stopwatches/test/wstopclock_constructor_overload_test.cpp 2011-09-16 18:33:12 EDT (Fri, 16 Sep 2011)
@@ -16,7 +16,6 @@
 #include <locale>
 #include <ctime>
 #include <cmath> // for sqrt(), used to burn time
-
 #include <string>
 
 using boost::chrono::stopwatch;
@@ -29,106 +28,114 @@
 
 #include <boost/detail/lightweight_test.hpp>
 
-
 namespace util
-{
-
- /**
- * this class return std::cout or std::wcout according to
- * the context(e.g. type on the left side of '=' operator)
- */
- struct console
+{
+
+ /**
+ * this class return std::cout or std::wcout according to
+ * the context(e.g. type on the left side of '=' operator)
+ */
+ struct console
+ {
+
+ template<typename Traits>
+ operator std::basic_ostream<char,Traits>&() const
     {
-
- template <
- typename Traits
- >
- operator std::basic_ostream<char,Traits>&() const
- {
- return std::cout;
- }
+ return std::cout;
+ }
 #ifndef BOOST_NO_STD_WSTRING
- template <
- typename Traits
- >
- operator std::basic_ostream<wchar_t,Traits>&() const
- {
- return std::wcout;
- }
+ template<typename Traits>
+ operator std::basic_ostream<wchar_t,Traits>&() const
+ {
+ return std::wcout;
+ }
 #endif
- };
+ };
 
 } // namespace util
 
 
- // overload adaptive_string for streaming operation with cout/wcout
- template<class charT>
- std::basic_ostream<charT>& operator << (std::basic_ostream<charT>& os, const boost::chrono::detail::adaptive_string& s)
- {
- os << std::basic_string<charT>(s);
- return os;
- }
-
+// overload adaptive_string for streaming operation with cout/wcout
+template<class charT>
+std::basic_ostream<charT>& operator <<(std::basic_ostream<charT>& os, const boost::chrono::detail::adaptive_string& s)
+{
+ os << std::basic_string<charT>(s);
+ return os;
+}
 
 namespace
 {
- using namespace util;
-
- template<class stopclock_type>
- void stopclock_constructor_overload_test()
- {
- // exercise each supported combination of constructor arguments
+ using namespace util;
+
+ template<class stopclock_type>
+ void stopclock_constructor_overload_test()
+ {
+ // exercise each supported combination of constructor arguments
+
+ typename stopclock_type::ostream_type& os = console();
+ const int pl = 9;
+ boost::system::error_code ec;
+
+ stopclock_type t1;
+ stopclock_type t2(os);
+ stopclock_type t3(ec);
+ stopclock_type t4(os, ec);
+ stopclock_type t5(pl);
+ stopclock_type t6(os, pl);
+ stopclock_type t7(pl, ec);
+ stopclock_type t8(os, pl, ec);
+ stopclock_type
+ t9(adaptive_string("t9, default places, r %r, c %c, p %p, u %u, s %s\n"));
+ stopclock_type
+ t10(os, adaptive_string("t10, default places, r %r, c %c, p %p, u %u, s %s\n"));
+ stopclock_type
+ t11(adaptive_string("t11, default places, r %r, c %c, p %p, u %u, s %s\n"), ec);
+ stopclock_type
+ t12(os, adaptive_string("t12, default places, r %r, c %c, p %p, u %u, s %s\n"), ec);
+ stopclock_type
+ t13(pl, adaptive_string("t13, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"));
+ stopclock_type
+ t14(adaptive_string("t14, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl);
+ stopclock_type
+ t15(os, pl, adaptive_string("t15, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"));
+ stopclock_type
+ t16(os, adaptive_string("t16, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl);
+ stopclock_type
+ t17(pl, adaptive_string("t17, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), ec);
+ stopclock_type
+ t18(adaptive_string("t18, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl, ec);
+ stopclock_type
+ t19(os, pl, adaptive_string("t19, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), ec);
+ stopclock_type
+ t20(os, adaptive_string("t20, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl, ec);
 
- typename stopclock_type::ostream_type& os = console();
- const int pl = 9;
- boost::system::error_code ec;
-
- stopclock_type t1;
- stopclock_type t2( os );
- stopclock_type t3( ec );
- stopclock_type t4( os, ec );
- stopclock_type t5( pl );
- stopclock_type t6( os, pl );
- stopclock_type t7( pl, ec );
- stopclock_type t8( os, pl, ec );
- stopclock_type t9( adaptive_string("t9, default places, r %r, c %c, p %p, u %u, s %s\n") );
- stopclock_type t10( os, adaptive_string("t10, default places, r %r, c %c, p %p, u %u, s %s\n") );
- stopclock_type t11( adaptive_string("t11, default places, r %r, c %c, p %p, u %u, s %s\n"), ec );
- stopclock_type t12( os, adaptive_string("t12, default places, r %r, c %c, p %p, u %u, s %s\n"), ec );
- stopclock_type t13( pl, adaptive_string("t13, explicitly code places, r %r, c %c, p %p, u %u, s %s\n") );
- stopclock_type t14( adaptive_string("t14, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl );
- stopclock_type t15( os, pl, adaptive_string("t15, explicitly code places, r %r, c %c, p %p, u %u, s %s\n") );
- stopclock_type t16( os, adaptive_string("t16, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl );
- stopclock_type t17( pl, adaptive_string("t17, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), ec );
- stopclock_type t18( adaptive_string("t18, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl, ec );
- stopclock_type t19( os, pl, adaptive_string("t19, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), ec );
- stopclock_type t20( os, adaptive_string("t20, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl, ec );
-
- std::cout << adaptive_string("Burn some time so run_timers have something to report...");
-
- boost::chrono::stopwatch<boost::chrono::high_resolution_clock> t;
- while ( t.elapsed() < boost::chrono::seconds(1) ) {}
-
- std::cout << adaptive_string("\n");
- std::cout << time_formatter::default_places() << adaptive_string(" default places\n");
- std::cout << pl << adaptive_string(" explicitly coded places\n");
+ std::cout
+ << adaptive_string("Burn some time so run_timers have something to report...");
+
+ boost::chrono::stopwatch<boost::chrono::high_resolution_clock> t;
+ while (t.elapsed() < boost::chrono::seconds(1))
+ {
     }
-
- typedef stopclock <> stopclock_t;
- typedef stopclock <
- process_cpu_clock,
- boost::chrono::wtime_formatter
- > wstopclock_t;
+
+ std::cout << adaptive_string("\n");
+ std::cout << time_formatter::default_places()
+ << adaptive_string(" default places\n");
+ std::cout << pl << adaptive_string(" explicitly coded places\n");
+ }
+
+ typedef stopclock<> stopclock_t;
+ typedef stopclock<process_cpu_clock, boost::chrono::wtime_formatter>
+ wstopclock_t;
 }
 
-int main( )
+int main()
 {
   //~ std::locale loc( "" ); // test with appropriate locale
   //~ std::cout.imbue( loc );
-
- stopclock_constructor_overload_test<stopclock_t>(); // test for char
+
+ stopclock_constructor_overload_test<stopclock_t> (); // test for char
 #ifndef BOOST_NO_STD_WSTRING
- stopclock_constructor_overload_test<wstopclock_t>(); // test for wchar_t
+ stopclock_constructor_overload_test<wstopclock_t> (); // test for wchar_t
 #endif
   return boost::report_errors();
 }


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