Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75449 - in trunk: boost/chrono/stopwatches boost/chrono/stopwatches/collectors boost/chrono/stopwatches/formatters boost/chrono/stopwatches/reporters libs/chrono/test libs/chrono/test/stopwatch
From: vicente.botet_at_[hidden]
Date: 2011-11-12 03:43:04


Author: viboes
Date: 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
New Revision: 75449
URL: http://svn.boost.org/trac/boost/changeset/75449

Log:
Chrono: renamed basic_stopwatch by laps_stopwatc + Added laps_stopclock
Added:
   trunk/boost/chrono/stopwatches/laps_stopwatch.hpp (contents, props changed)
   trunk/boost/chrono/stopwatches/reporters/laps_stopclock.hpp (contents, props changed)
   trunk/libs/chrono/test/stopwatch/laps_stopclock_laps_accumulator_set_pass.cpp (contents, props changed)
   trunk/libs/chrono/test/stopwatch/laps_stopclock_pass.cpp (contents, props changed)
Removed:
   trunk/boost/chrono/stopwatches/basic_stopwatch.hpp
   trunk/boost/chrono/stopwatches/reporters/basic_stopwatch_default_formatter.hpp
Text files modified:
   trunk/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp | 2 +-
   trunk/boost/chrono/stopwatches/collectors/laps_sequence_container.hpp | 2 +-
   trunk/boost/chrono/stopwatches/collectors/last_lap.hpp | 2 +-
   trunk/boost/chrono/stopwatches/collectors/no_memory.hpp | 2 +-
   trunk/boost/chrono/stopwatches/dont_start.hpp | 2 +-
   trunk/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp | 2 +-
   trunk/boost/chrono/stopwatches/formatters/base_formatter.hpp | 2 +-
   trunk/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp | 2 +-
   trunk/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp | 13 +------------
   trunk/boost/chrono/stopwatches/reporters/process_default_formatter.hpp | 14 +-------------
   trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp | 14 +-------------
   trunk/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp | 2 +-
   trunk/libs/chrono/test/Jamfile.v2 | 2 ++
   trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp | 15 +++------------
   trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp | 15 +++------------
   trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp | 15 +++------------
   trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp | 15 +++------------
   trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp | 21 ++++++---------------
   trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp | 19 +++++--------------
   trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp | 11 +----------
   trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp | 11 +----------
   trunk/libs/chrono/test/stopwatch/suspendable_stopwatch_pass.cpp | 11 +----------
   22 files changed, 40 insertions(+), 154 deletions(-)

Deleted: trunk/boost/chrono/stopwatches/basic_stopwatch.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/basic_stopwatch.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
+++ (empty file)
@@ -1,441 +0,0 @@
-// boost/chrono/stopwatches/basic_stopwatch.hpp ------------------------------------------------------------//
-// Copyright 2011 Vicente J. Botet Escriba
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-// See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.
-
-#ifndef BOOST_CHRONO_STOPWATCHES_BASIC_STOPWATCH__HPP
-#define BOOST_CHRONO_STOPWATCHES_BASIC_STOPWATCH__HPP
-
-
-#include <boost/chrono/config.hpp>
-
-#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
-#include <boost/chrono/stopwatches/collectors/no_memory.hpp> // default laps_collector
-#include <boost/chrono/stopwatches/dont_start.hpp>
-#include <boost/chrono/system_clocks.hpp> // default_clock
-#include <boost/system/error_code.hpp>
-#include <utility>
-
-namespace boost
-{
- namespace chrono
- {
-
-
- /**
- * A basic_stopwatch is a model of @c Stopwatch taking as parameters the @c Clock and the @c LapsCollector.
- *
- * The main difference respect to a @c simple_stopwatch is that the user can stop it.
- * Each sequence of start-stop results in a new elapsed duration sample that is provided to the LapsCollector.
- *
- * It is up to the LapsCollector to make whatever wants with each sample.
- * A LapCollector must define a store(duration const&) and a clear() functions.
- *
- * The library provides LapsCollectors that forget the sample, store the
- * last one, cummulates the samples in an accumulator set or store them in a container.
- * For simplicity the default LapCollector is the one that forget the samples.
- *
- * Even if it is preferable to use process or thread wide clocks,
- * the default of the Clock parameter is high_resolution_clock,
- * as it is the single one ensured on all platforms.
- */
- template<typename Clock=high_resolution_clock, typename LapsCollector=no_memory<typename Clock::duration> >
- class basic_stopwatch
- {
- public:
- typedef LapsCollector laps_collector;
- 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;
- BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
-
- /**
- * Default constructor.
- *
- * Effects: Starts the stopwatch.
- * Post-conditions: is_running().
- */
- explicit basic_stopwatch()
- :
- start_(duration::zero()),
- running_(false),
- laps_collector_()
- {
- start();
- }
-
-#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- /**
- * Default constructor.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- * Effects: Starts the stopwatch.
- * Post-conditions: is_running() if no error occur.
- */
- explicit basic_stopwatch(
- system::error_code & ec
- ) :
- start_(duration::zero()),
- running_(false),
- laps_collector_()
- {
- start(ec);
- }
-#endif
- /**
- * Not starting constructor.
- *
- * Effects: Don't starts the stopwatch.
- * Post-conditions: ! is_running() if no error occur.
- */
- explicit basic_stopwatch(
- const dont_start_t&
- ) :
- start_(duration::zero()),
- running_(false),
- laps_collector_()
- {
- }
-
- /**
- * Starting constructor from a LapsCollector instance.
- *
- * Effects: Copies the LapsCollector. Starts the stopwatch.
- * Post-conditions: is_running() if no error occur.
- *
- * Remark: The LapsCollector is copied and owned by the stopwatch.
- */
- explicit basic_stopwatch(
- laps_collector const& acc
- ) :
- start_(duration::zero()),
- running_(false),
- laps_collector_(acc)
- {
- start();
- }
-
-#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- /**
- * Starting constructor from a LapsCollector instance.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- * Effects: Copies the LapsCollector. Starts the stopwatch.
- * Post-conditions: is_running() if no error occur.
- *
- * Remark: The LapsCollector is copied and owned by the stopwatch.
- */
- explicit basic_stopwatch(
- laps_collector const& acc,
- system::error_code & ec
- ) :
- start_(duration::zero()),
- running_(false),
- laps_collector_(acc)
- {
- start(ec);
- }
-#endif
-
- /**
- * Not starting constructor from a LapsCollector instance.
- *
- * Effects: Copies the LapsCollector. Don't starts the stopwatch.
- * Post-conditions: ! is_running() if no error occur.
- *
- * Remark: The LapsCollector is copied and owned by the stopwatch.
- */
- basic_stopwatch(
- laps_collector const& acc,
- const dont_start_t&
- ) :
- start_(duration::zero()),
- running_(false),
- laps_collector_(acc)
- {
- }
-
- /**
- * Destructor.
- *
- * Effects: Do nothing.
- */
- ~basic_stopwatch()
- {
- }
-
- /**
- * Restart the stopwatch.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- * Effects: As if stop(); start() were called, but ensuring that the start time is the same as the stop time.
- *
- * Post-conditions: is_running() if no error occur.
- */
- void restart()
- {
- time_point tmp = clock::now();
-
- if (is_running())
- {
- laps_collector_.store(tmp - start_);
- }
- else
- {
- running_ = true;
- }
- start_ = tmp;
- }
-
-#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- /**
- * Restart the stopwatch.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- * Effects: As if stop(); start() were called, but ensuring that the start time is the same as the stop time.
- *
- * Post-conditions: is_running() if no error occur.
- */
- void restart(
- system::error_code & ec
- )
- {
- time_point tmp = clock::now(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
-
- if (is_running())
- {
- laps_collector_.store(tmp - start_);
- }
- else
- {
- running_ = true;
- }
- start_ = tmp;
- }
-#endif
-
- /**
- * Start the stopwatch.
- *
- * Effects: Memorize the current time.
- *
- * Post-conditions: is_running().
- */
- void start()
- {
- start_ = clock::now();
- running_ = true;
- }
-
-#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- /**
- * Start the stopwatch.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- * Effects: Memorize the current time.
- *
- * Post-conditions: is_running() if no error occur.
- */
- void start(
- system::error_code & ec
- )
- {
- time_point tmp = clock::now(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
-
- start_ = tmp;
- running_ = true;
- }
-#endif
-
- /**
- * Start the stopwatch.
- *
- * Effects: Gives the elapsed time since start time to the LapCollector.
- *
- * Throws: Any exception that the LapCollector can throw when .
- *
- * Post-conditions: !is_running() if no error occur.
- */
- void stop()
- {
- if (is_running())
- {
- laps_collector_.store(clock::now() - start_);
- start_ = time_point(duration::zero());
- running_ = false;
- }
- }
-
-#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- /**
- * Start the stopwatch.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- * Effects: Gives the elapsed time since start time to the LapCollector if no internal error occurs.
- *
- * Throws: Any exception that the LapCollector can Throw.
- *
- * Post-conditions: !is_running() if no error occur.
- */
- void stop(
- system::error_code & ec
- )
- {
- if (is_running())
- {
- time_point tmp = clock::now(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
-
- laps_collector_.store(tmp - start_);
- start_ = time_point(duration::zero());
- running_ = false;
- }
- }
-#endif
-
- /**
- * States if the Stopwatch is running.
- */
- bool is_running() const {
- return running_;
- }
-
- /**
- * Elapsed time getter for the current lap.
- *
- * Returns: the elapsed time since the last start if no internal error occur.
- *
- */
- duration elapsed_current_lap() const
- {
- if (is_running())
- {
- return clock::now() - start_;
- }
- else
- {
- return duration::zero();
- }
- }
-
-#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- /**
- * Elapsed time getter for the current lap.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- *
- * Returns: the elapsed time since the start if no internal error occur.
- *
- */
- duration elapsed_current_lap(
- system::error_code & ec
- ) const
- {
- if (is_running())
- {
- time_point tmp = clock::now(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
-
- return tmp - start_;
- } else
- {
- return duration::zero();
- }
- }
-#endif
-
- /**
- * Elapsed time getter.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- *
- * Returns: the elapsed time since the start if no internal error occur.
- *
- */
- duration elapsed() const
- {
- return laps_collector_.elapsed()+elapsed_current_lap();
- }
-
-#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- /**
- * Elapsed time getter.
- *
- * Effects: Assign the error code if any internal error occur while retrieving the current time.
- *
- * Returns: the elapsed time since the start if no internal error occur.
- *
- */
- duration elapsed(
- system::error_code & ec
- ) const
- {
- duration tmp = elapsed_current_lap(ec);
- if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
- return laps_collector_.elapsed() + tmp;
- }
-#endif
- /**
- * Elapsed time for the last lap.
- *
- * Returns: the elapsed time of the last lap.
- *
- */
-
- duration last() const
- {
- return laps_collector_.last();
- }
- /**
- * Resets the stopwatch.
- *
- * Effects: Resets the LapCollector.
- *
- * Post-conditions: !is_running() if no error occur.
- *
- */
- void reset()
- {
-
- laps_collector_.reset();
- running_ = false;
- start_ = time_point(duration::zero());
- }
-
- /**
- * LapsCollector getter.
- *
- * Returns: the LapCollector instance.
- *
- */
- laps_collector const& get_laps_collector() BOOST_NOEXCEPT
- {
- return laps_collector_;
- }
-
- /**
- * Useful typedef for scoped run
- */
- typedef stopwatch_runner<basic_stopwatch<Clock, LapsCollector> >
- scoped_run;
- /**
- * Useful typedef for scoped stop
- */
- typedef stopwatch_stopper<basic_stopwatch<Clock, LapsCollector> >
- scoped_stop;
-
- private:
- time_point start_;
- bool running_;
- laps_collector laps_collector_;
- };
-
- } // namespace chrono
-} // namespace boost
-
-#endif

Modified: trunk/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp (original)
+++ trunk/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or

Modified: trunk/boost/chrono/stopwatches/collectors/laps_sequence_container.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/collectors/laps_sequence_container.hpp (original)
+++ trunk/boost/chrono/stopwatches/collectors/laps_sequence_container.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// boost/chrono/stopwatches/collectors/laps_sequence_container.hpp
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or

Modified: trunk/boost/chrono/stopwatches/collectors/last_lap.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/collectors/last_lap.hpp (original)
+++ trunk/boost/chrono/stopwatches/collectors/last_lap.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// boost/chrono/stopwatches/collectors/last_lap.hpp
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or

Modified: trunk/boost/chrono/stopwatches/collectors/no_memory.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/collectors/no_memory.hpp (original)
+++ trunk/boost/chrono/stopwatches/collectors/no_memory.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// boost/chrono/stopwatches/collectors/no_memory.hpp
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or

Modified: trunk/boost/chrono/stopwatches/dont_start.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/dont_start.hpp (original)
+++ trunk/boost/chrono/stopwatches/dont_start.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/basic_stopwatch.hpp ------------------------------------------------------------//
+// boost/chrono/stopwatches/dont.hpp ------------------------------------------------------------//
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: trunk/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_formatter.hpp ------------------------------------------------------------//
+// boost/chrono/stopwatches/formatters/ accumulator_set_formatter.hpp ------------------------------------------------------------//
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt

Modified: trunk/boost/chrono/stopwatches/formatters/base_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/formatters/base_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/formatters/base_formatter.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_formatter.hpp ------------------------------------------------------------//
+// boost/chrono/stopwatches/formatters/base_formatter.hpp ------------------------------------------------------------//
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt

Modified: trunk/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_formatter.hpp ------------------------------------------------------------//
+// boost/chrono/stopwatches/elapsed_formatter.hpp ------------------------------------------------------------//
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt

Added: trunk/boost/chrono/stopwatches/laps_stopwatch.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/chrono/stopwatches/laps_stopwatch.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -0,0 +1,442 @@
+// boost/chrono/stopwatches/laps_stopwatch.hpp -----------------------------//
+
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_LAPS_STOPWATCH_HPP
+#define BOOST_CHRONO_STOPWATCHES_LAPS_STOPWATCH_HPP
+
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
+#include <boost/chrono/stopwatches/collectors/no_memory.hpp> // default laps_collector
+#include <boost/chrono/stopwatches/dont_start.hpp>
+#include <boost/chrono/system_clocks.hpp> // default_clock
+#include <boost/system/error_code.hpp>
+#include <utility>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+
+ /**
+ * A laps_stopwatch is a model of @c Stopwatch taking as parameters the @c Clock and the @c LapsCollector.
+ *
+ * The main difference respect to a @c simple_stopwatch is that the user can stop it.
+ * Each sequence of start-stop results in a new elapsed duration sample that is provided to the LapsCollector.
+ *
+ * It is up to the LapsCollector to make whatever wants with each sample.
+ * A LapCollector must define a store(duration const&) and a clear() functions.
+ *
+ * The library provides LapsCollectors that forget the sample, store the
+ * last one, cummulates the samples in an accumulator set or store them in a container.
+ * For simplicity the default LapCollector is the one that forget the samples.
+ *
+ * Even if it is preferable to use process or thread wide clocks,
+ * the default of the Clock parameter is high_resolution_clock,
+ * as it is the single one ensured on all platforms.
+ */
+ template<typename Clock=high_resolution_clock, typename LapsCollector=no_memory<typename Clock::duration> >
+ class laps_stopwatch
+ {
+ public:
+ typedef LapsCollector laps_collector;
+ 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;
+ BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
+
+ /**
+ * Default constructor.
+ *
+ * Effects: Starts the stopwatch.
+ * Post-conditions: is_running().
+ */
+ explicit laps_stopwatch()
+ :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ start();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Default constructor.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ */
+ explicit laps_stopwatch(
+ system::error_code & ec
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ start(ec);
+ }
+#endif
+ /**
+ * Not starting constructor.
+ *
+ * Effects: Don't starts the stopwatch.
+ * Post-conditions: ! is_running() if no error occur.
+ */
+ explicit laps_stopwatch(
+ const dont_start_t&
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ }
+
+ /**
+ * Starting constructor from a LapsCollector instance.
+ *
+ * Effects: Copies the LapsCollector. Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ explicit laps_stopwatch(
+ laps_collector const& acc
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ start();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Starting constructor from a LapsCollector instance.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Copies the LapsCollector. Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ explicit laps_stopwatch(
+ laps_collector const& acc,
+ system::error_code & ec
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ start(ec);
+ }
+#endif
+
+ /**
+ * Not starting constructor from a LapsCollector instance.
+ *
+ * Effects: Copies the LapsCollector. Don't starts the stopwatch.
+ * Post-conditions: ! is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ laps_stopwatch(
+ laps_collector const& acc,
+ const dont_start_t&
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ }
+
+ /**
+ * Destructor.
+ *
+ * Effects: Do nothing.
+ */
+ ~laps_stopwatch()
+ {
+ }
+
+ /**
+ * Restart the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: As if stop(); start() were called, but ensuring that the start time is the same as the stop time.
+ *
+ * Post-conditions: is_running() if no error occur.
+ */
+ void restart()
+ {
+ time_point tmp = clock::now();
+
+ if (is_running())
+ {
+ laps_collector_.store(tmp - start_);
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Restart the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: As if stop(); start() were called, but ensuring that the start time is the same as the stop time.
+ *
+ * Post-conditions: is_running() if no error occur.
+ */
+ void restart(
+ system::error_code & ec
+ )
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ if (is_running())
+ {
+ laps_collector_.store(tmp - start_);
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+#endif
+
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Memorize the current time.
+ *
+ * Post-conditions: is_running().
+ */
+ void start()
+ {
+ start_ = clock::now();
+ running_ = true;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Memorize the current time.
+ *
+ * Post-conditions: is_running() if no error occur.
+ */
+ void start(
+ system::error_code & ec
+ )
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ start_ = tmp;
+ running_ = true;
+ }
+#endif
+
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Gives the elapsed time since start time to the LapCollector.
+ *
+ * Throws: Any exception that the LapCollector can throw when .
+ *
+ * Post-conditions: !is_running() if no error occur.
+ */
+ void stop()
+ {
+ if (is_running())
+ {
+ laps_collector_.store(clock::now() - start_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Gives the elapsed time since start time to the LapCollector if no internal error occurs.
+ *
+ * Throws: Any exception that the LapCollector can Throw.
+ *
+ * Post-conditions: !is_running() if no error occur.
+ */
+ void stop(
+ system::error_code & ec
+ )
+ {
+ if (is_running())
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ laps_collector_.store(tmp - start_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ }
+ }
+#endif
+
+ /**
+ * States if the Stopwatch is running.
+ */
+ bool is_running() const {
+ return running_;
+ }
+
+ /**
+ * Elapsed time getter for the current lap.
+ *
+ * Returns: the elapsed time since the last start if no internal error occur.
+ *
+ */
+ duration elapsed_current_lap() const
+ {
+ if (is_running())
+ {
+ return clock::now() - start_;
+ }
+ else
+ {
+ return duration::zero();
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Elapsed time getter for the current lap.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed_current_lap(
+ system::error_code & ec
+ ) const
+ {
+ if (is_running())
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
+
+ return tmp - start_;
+ } else
+ {
+ return duration::zero();
+ }
+ }
+#endif
+
+ /**
+ * Elapsed time getter.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed() const
+ {
+ return laps_collector_.elapsed()+elapsed_current_lap();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Elapsed time getter.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed(
+ system::error_code & ec
+ ) const
+ {
+ duration tmp = elapsed_current_lap(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
+ return laps_collector_.elapsed() + tmp;
+ }
+#endif
+ /**
+ * Elapsed time for the last lap.
+ *
+ * Returns: the elapsed time of the last lap.
+ *
+ */
+
+ duration last() const
+ {
+ return laps_collector_.last();
+ }
+ /**
+ * Resets the stopwatch.
+ *
+ * Effects: Resets the LapCollector.
+ *
+ * Post-conditions: !is_running() if no error occur.
+ *
+ */
+ void reset()
+ {
+
+ laps_collector_.reset();
+ running_ = false;
+ start_ = time_point(duration::zero());
+ }
+
+ /**
+ * LapsCollector getter.
+ *
+ * Returns: the LapCollector instance.
+ *
+ */
+ laps_collector const& get_laps_collector() BOOST_NOEXCEPT
+ {
+ return laps_collector_;
+ }
+
+ /**
+ * Useful typedef for scoped run
+ */
+ typedef stopwatch_runner<laps_stopwatch<Clock, LapsCollector> >
+ scoped_run;
+ /**
+ * Useful typedef for scoped stop
+ */
+ typedef stopwatch_stopper<laps_stopwatch<Clock, LapsCollector> >
+ scoped_stop;
+
+ private:
+ time_point start_;
+ bool running_;
+ laps_collector laps_collector_;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+#endif // header

Deleted: trunk/boost/chrono/stopwatches/reporters/basic_stopwatch_default_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/reporters/basic_stopwatch_default_formatter.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
+++ (empty file)
@@ -1,46 +0,0 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
-// Copyright 2011 Vicente J. Botet Escriba
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
-// copy at http://www.boost.org/LICENSE_1_0.txt)
-// See http://www.boost.org/libs/chrono/stopwatches for documentation.
-
-#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_ACCUMULATOR_SET_DEFAULT_FORMATTER_HPP
-#define BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_ACCUMULATOR_SET_DEFAULT_FORMATTER_HPP
-
-#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
-#include <boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp>
-#include <boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp>
-#include <boost/chrono/stopwatches/basic_stopwatch.hpp>
-#include <boost/chrono/thread_clock.hpp>
-
-namespace boost
-{
- namespace chrono
- {
-
- template <typename CharT, typename Clock, typename Features, typename Weight>
- struct basic_stopwatch_reporter_default_formatter<CharT, basic_stopwatch<Clock,laps_accumulator_set<typename Clock::duration,Features, Weight> > >
- {
- typedef basic_accumulator_set_formatter<milli,CharT> type;
- };
-
-// template <typename Clock, typename Features, typename Weight>
-// struct stopwatch_reporter_default_formatter<basic_stopwatch<Clock,laps_accumulator_set<typename Clock::duration,Features, Weight> > >
-// {
-// typedef accumulator_set_formatter type;
-// };
-//
-// template <typename Clock, typename Features, typename Weight>
-// struct wstopwatch_reporter_default_formatter<basic_stopwatch<Clock,laps_accumulator_set<typename Clock::duration,Features, Weight> > >
-// {
-// typedef waccumulator_set_formatter type;
-// };
-
- } // namespace chrono
-} // namespace boost
-
-
-#endif
-
-

Modified: trunk/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or
@@ -21,17 +21,6 @@
       typedef basic_elapsed_formatter<milli, CharT> type;
     };
 
-// template<class Clock>
-// struct clock_default_formatter
-// {
-// typedef elapsed_formatter type;
-// };
-//
-// template<class Clock>
-// struct wclock_default_formatter
-// {
-// typedef welapsed_formatter type;
-// };
   } // namespace chrono
 } // namespace boost
 

Added: trunk/boost/chrono/stopwatches/reporters/laps_stopclock.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/chrono/stopwatches/reporters/laps_stopclock.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -0,0 +1,175 @@
+// boost/chrono/stopwatches/reporters/laps_stopclock.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPCLOCK_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPCLOCK_HPP
+
+#include <boost/chrono/config.hpp>
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __GNUC__
+#pragma GCC system_header
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#endif
+
+#include <boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
+#include <boost/chrono/stopwatches/laps_stopwatch.hpp>
+#include <boost/chrono/stopwatches/dont_start.hpp>
+#include <boost/chrono/chrono.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/cstdint.hpp>
+#include <cassert>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class CharT, typename Clock, typename LapsCollector, class Formatter>
+ class basic_laps_stopclock: public basic_stopwatch_reporter<CharT, laps_stopwatch<Clock, LapsCollector>, Formatter>
+ {
+ public:
+ typedef basic_stopwatch_reporter<CharT, laps_stopwatch<Clock, LapsCollector>, Formatter> base_type;
+ typedef Clock clock;
+ typedef laps_stopwatch<Clock, LapsCollector> stopwatch;
+ typedef Formatter formatter_type;
+
+ basic_laps_stopclock()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit basic_laps_stopclock(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+ explicit basic_laps_stopclock(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag)
+ {
+ }
+
+ explicit basic_laps_stopclock(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit basic_laps_stopclock(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit basic_laps_stopclock(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ typedef stopwatch_runner<basic_laps_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<basic_laps_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<basic_laps_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<basic_laps_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_resume;
+
+ protected:
+
+ basic_laps_stopclock(const basic_laps_stopclock&); // = delete;
+ basic_laps_stopclock& operator=(const basic_laps_stopclock&); // = delete;
+ };
+
+
+ template<typename Clock=high_resolution_clock, typename LapsCollector=no_memory<typename Clock::duration>,
+ class Formatter = typename basic_stopwatch_reporter_default_formatter<char, laps_stopwatch<Clock, LapsCollector> >::type>
+ class laps_stopclock;
+
+ template<class Stopwatch, class Formatter>
+ struct basic_stopwatch_reporter_default_formatter<char, laps_stopclock<Stopwatch,
+ Formatter> >
+ {
+ typedef Formatter type;
+ };
+
+ template<typename Clock, typename LapsCollector, class Formatter>
+ class laps_stopclock: public basic_laps_stopclock<char, Clock, LapsCollector, Formatter>
+ {
+ typedef basic_laps_stopclock<char, Clock, LapsCollector, Formatter> base_type;
+ public:
+ typedef Clock clock;
+ typedef typename base_type::stopwatch stopwatch;
+ typedef Formatter formatter_type;
+
+ laps_stopclock()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit laps_stopclock(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+ explicit laps_stopclock(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag)
+ {
+ }
+
+ explicit laps_stopclock(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit laps_stopclock(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit laps_stopclock(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ typedef stopwatch_runner<laps_stopclock<Clock, LapsCollector, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<laps_stopclock<Clock, LapsCollector, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<laps_stopclock<Clock, LapsCollector, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<laps_stopclock<Clock, LapsCollector, Formatter> >
+ scoped_resume;
+
+ protected:
+
+ laps_stopclock(const laps_stopclock&); // = delete;
+ laps_stopclock& operator=(const laps_stopclock&); // = delete;
+ };
+
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __SUNPRO_CC
+#pragma enable_warn
+#elif defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#endif
+
+

Modified: trunk/boost/chrono/stopwatches/reporters/process_default_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/reporters/process_default_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/reporters/process_default_formatter.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// boost/chrono/stopwatches/reporters/process_default_formatter.hpp
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or
@@ -29,18 +29,6 @@
       typedef basic_times_formatter<milli, CharT> type;
     };
 
-// template<>
-// struct clock_default_formatter<process_cpu_clock>
-// {
-// typedef times_formatter type;
-// };
-//
-// template<>
-// struct wclock_default_formatter<process_cpu_clock>
-// {
-// typedef wtimes_formatter type;
-// };
-
   } // namespace chrono
 } // namespace boost
 

Modified: trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// boost/chrono/stopwatches/stopwatch_reporter_default_formatter.hpp
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or
@@ -21,18 +21,6 @@
     {
     };
 
-// template<class Stopwatch>
-// struct stopwatch_reporter_default_formatter
-// : clock_default_formatter<typename Stopwatch::clock>
-// {
-// };
-//
-// template<class Stopwatch>
-// struct wstopwatch_reporter_default_formatter
-// : wclock_default_formatter<typename Stopwatch::clock>
-// {
-// };
-
   } // namespace chrono
 } // namespace boost
 

Modified: trunk/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,4 +1,4 @@
-// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// boost/chrono/stopwatches/reporters/thread_default_formatter.hpp
 // Copyright 2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // (See accompanying file LICENSE_1_0.txt or

Modified: trunk/libs/chrono/test/Jamfile.v2
==============================================================================
--- trunk/libs/chrono/test/Jamfile.v2 (original)
+++ trunk/libs/chrono/test/Jamfile.v2 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -445,6 +445,8 @@
         [ stopwatch-run2 stopwatch/simple_stopwatch_reporter_pass.cpp : simple_stopwatch_reporter_pass ]
         [ stopwatch-run2 stopwatch/basic_stopwatch_reporter_pass.cpp : basic_stopwatch_reporter_pass ]
         [ stopwatch-run2 stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp : basic_stopwatch_reporter_laps_accumulator_set_pass ]
+ [ stopwatch-run2 stopwatch/laps_stopclock_pass.cpp : laps_stopclock_pass ]
+ [ stopwatch-run2 stopwatch/laps_stopclock_laps_accumulator_set_pass.cpp : laps_stopclock_laps_accumulator_set_pass ]
 
         ;
     test-suite "stopclock_ex"

Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,19 +1,10 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 
 #include <iostream>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/chrono/stopwatches/basic_stopwatch.hpp>
+#include <boost/chrono/stopwatches/laps_stopwatch.hpp>
 #include <boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp>
 #include <libs/chrono/test/cycle_count.hpp>
 #include <boost/detail/lightweight_test.hpp>
@@ -219,6 +210,6 @@
 int main()
 {
   std::cout << "cycle_count=";
- check_all<boost::chrono::basic_stopwatch< ex::cycle_count<1500>, boost::chrono::laps_accumulator_set<ex::cycle_count<1500>::duration> > >();
+ check_all<boost::chrono::laps_stopwatch< ex::cycle_count<1500>, boost::chrono::laps_accumulator_set<ex::cycle_count<1500>::duration> > >();
   return boost::report_errors();
 }

Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,19 +1,10 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 
 #include <iostream>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/chrono/stopwatches/basic_stopwatch.hpp>
+#include <boost/chrono/stopwatches/laps_stopwatch.hpp>
 #include <boost/chrono/stopwatches/collectors/laps_sequence_container.hpp>
 #include <libs/chrono/test/cycle_count.hpp>
 #include <boost/detail/lightweight_test.hpp>
@@ -219,6 +210,6 @@
 int main()
 {
   std::cout << "cycle_count=";
- check_all<boost::chrono::basic_stopwatch< ex::cycle_count<1500>, boost::chrono::laps_sequence_container<ex::cycle_count<1500>::duration> > >();
+ check_all<boost::chrono::laps_stopwatch< ex::cycle_count<1500>, boost::chrono::laps_sequence_container<ex::cycle_count<1500>::duration> > >();
   return boost::report_errors();
 }

Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,19 +1,10 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 
 #include <iostream>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/chrono/stopwatches/basic_stopwatch.hpp>
+#include <boost/chrono/stopwatches/laps_stopwatch.hpp>
 #include <boost/chrono/stopwatches/collectors/last_lap.hpp>
 #include <libs/chrono/test/cycle_count.hpp>
 #include <boost/detail/lightweight_test.hpp>
@@ -221,6 +212,6 @@
 int main()
 {
   std::cout << "cycle_count=";
- check_all<boost::chrono::basic_stopwatch< ex::cycle_count<1500>, boost::chrono::last_lap<ex::cycle_count<1500>::duration> > >();
+ check_all<boost::chrono::laps_stopwatch< ex::cycle_count<1500>, boost::chrono::last_lap<ex::cycle_count<1500>::duration> > >();
   return boost::report_errors();
 }

Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,19 +1,10 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 
 #include <iostream>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/chrono/stopwatches/basic_stopwatch.hpp>
+#include <boost/chrono/stopwatches/laps_stopwatch.hpp>
 #include <libs/chrono/test/cycle_count.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
@@ -195,7 +186,7 @@
 int main()
 {
   std::cout << "cycle_count=";
- check_all<boost::chrono::basic_stopwatch< ex::cycle_count<1500> > >();
+ check_all<boost::chrono::laps_stopwatch< ex::cycle_count<1500> > >();
 
 
   return boost::report_errors();

Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,23 +1,14 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 
 #include <iostream>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/chrono/stopwatches/basic_stopwatch.hpp>
+#include <boost/chrono/stopwatches/laps_stopwatch.hpp>
 #include <libs/chrono/test/cycle_count.hpp>
 #include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
 #include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
-#include <boost/chrono/stopwatches/reporters/basic_stopwatch_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp>
 #include <boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp>
 
 #include <boost/chrono/chrono_io.hpp>
@@ -226,8 +217,8 @@
 template <typename Clock>
 void check_all()
 {
- typedef stopwatch_reporter<basic_stopwatch<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration> > > Reporter;
- typedef stopwatch_reporter<basic_stopwatch<Clock>, elapsed_formatter > ReporterE;
+ typedef stopwatch_reporter<laps_stopwatch<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration> > > Reporter;
+ typedef stopwatch_reporter<laps_stopwatch<Clock>, elapsed_formatter > ReporterE;
 
   check_invariants<Reporter>();
   check_default_constructor<Reporter>();
@@ -254,7 +245,7 @@
 
 int main()
 {
- typedef basic_stopwatch<high_resolution_clock > Stopwatch;
+ typedef laps_stopwatch<high_resolution_clock > Stopwatch;
   typedef basic_stopwatch_reporter_default_formatter<char, Stopwatch>::type Formatter;
   typedef stopwatch_reporter<Stopwatch> Reporter;
   static Formatter fmtr;

Modified: trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,19 +1,10 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 
 #include <iostream>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/chrono/stopwatches/basic_stopwatch.hpp>
+#include <boost/chrono/stopwatches/laps_stopwatch.hpp>
 #include <libs/chrono/test/cycle_count.hpp>
 #include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
 #include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
@@ -224,8 +215,8 @@
 template <typename Clock>
 void check_all()
 {
- typedef stopwatch_reporter<basic_stopwatch<Clock> > Reporter;
- typedef stopwatch_reporter<basic_stopwatch<Clock>, elapsed_formatter > ReporterE;
+ typedef stopwatch_reporter<laps_stopwatch<Clock> > Reporter;
+ typedef stopwatch_reporter<laps_stopwatch<Clock>, elapsed_formatter > ReporterE;
 
   check_invariants<Reporter>();
   check_default_constructor<Reporter>();
@@ -251,7 +242,7 @@
 
 int main()
 {
- typedef basic_stopwatch<high_resolution_clock > Stopwatch;
+ typedef laps_stopwatch<high_resolution_clock > Stopwatch;
   typedef basic_stopwatch_reporter_default_formatter<char, Stopwatch>::type Formatter;
   typedef stopwatch_reporter<Stopwatch> Reporter;
   static Formatter fmtr;

Added: trunk/libs/chrono/test/stopwatch/laps_stopclock_laps_accumulator_set_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/chrono/test/stopwatch/laps_stopclock_laps_accumulator_set_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -0,0 +1,258 @@
+// Copyright 2010-2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <iostream>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/chrono/stopwatches/reporters/laps_stopclock.hpp>
+#include <libs/chrono/test/cycle_count.hpp>
+//#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
+//#include <boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp>
+#include <boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp>
+
+#include <boost/chrono/chrono_io.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+using namespace boost::chrono;
+
+
+template <typename Stopwatch>
+void check_invariants()
+{
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::rep, typename Stopwatch::clock::duration::rep>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::period, typename Stopwatch::clock::duration::period>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::duration, typename Stopwatch::clock::time_point::duration>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(Stopwatch::is_steady == Stopwatch::clock::is_steady, NOTHING, ());
+}
+
+template <typename Stopwatch>
+void check_default_constructor()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+}
+
+template <typename Stopwatch>
+void check_dont_start_constructor()
+{
+ Stopwatch sw(boost::chrono::dont_start);
+ BOOST_TEST(!sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(d == Stopwatch::duration::zero());
+}
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+template <typename Stopwatch>
+void check_constructor_ec()
+{
+ boost::system::error_code ec;
+ Stopwatch sw(ec);
+ BOOST_TEST(sw.is_running());
+ BOOST_TEST(ec.value()==0);
+}
+
+template <typename Stopwatch>
+void check_constructor_throws()
+{
+ Stopwatch sw(boost::throws());
+ BOOST_TEST(sw.is_running());
+}
+#endif
+
+template <typename Stopwatch>
+void check_elapsed()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(100));
+}
+
+template <typename Stopwatch>
+void check_start_start()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.start();
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(100));
+ BOOST_TEST(d < boost::chrono::milliseconds(200));
+}
+
+template <typename Stopwatch>
+void check_dont_start_start()
+{
+ Stopwatch sw(boost::chrono::dont_start);
+ BOOST_TEST(!sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.start();
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(100));
+ BOOST_TEST(d < boost::chrono::milliseconds(200));
+}
+
+template <typename Stopwatch>
+void check_dont_start_start_stop()
+{
+ Stopwatch sw(boost::chrono::dont_start);
+ BOOST_TEST(!sw.is_running());
+ sw.start();
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.stop();
+ BOOST_TEST(!sw.is_running());
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(0));
+}
+
+template <typename Stopwatch>
+void check_dont_start_scoped_run()
+{
+ Stopwatch sw(boost::chrono::dont_start);
+ BOOST_TEST(!sw.is_running());
+ {
+ typename Stopwatch::scoped_run _(sw);
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ }
+ BOOST_TEST(!sw.is_running());
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(0));
+}
+
+template <typename Stopwatch>
+void check_stop()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.stop();
+ BOOST_TEST(!sw.is_running());
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d == boost::chrono::milliseconds(100));
+}
+
+template <typename Stopwatch>
+void check_stop_stop()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.stop();
+ BOOST_TEST(!sw.is_running());
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d == boost::chrono::milliseconds(100));
+ sw.stop();
+ BOOST_TEST(!sw.is_running());
+ d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d == boost::chrono::milliseconds(100));
+}
+
+
+
+struct file_line {
+ file_line(const char* file, std::size_t line)
+ : fmt("%1%[%2%] Elapsed time:")
+ {
+ fmt % file % line;
+ }
+ ~file_line()
+ {
+ std::cout << fmt;
+ }
+ boost::format fmt;
+
+};
+
+template <typename Reporter>
+void check_file_line2()
+{
+ Reporter _("%1%\n");
+ file_line fl(__FILE__, __LINE__);
+ ex::sleep_for<typename Reporter::clock>(milliseconds(100));
+
+}
+template <typename Reporter>
+void check_file_line()
+{
+ Reporter rp("%1%[%2%] Elapsed time: %3%\n");
+ rp.format() % __FILE__ % __LINE__;
+
+ ex::sleep_for<typename Reporter::clock>(milliseconds(100));
+
+}
+
+template <typename Reporter>
+void check_report()
+{
+ Reporter sw;
+ ex::sleep_for<typename Reporter::clock>(milliseconds(100));
+ sw.report();
+}
+
+
+
+
+template <typename Clock>
+void check_all()
+{
+
+ typedef laps_stopclock<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration> > Reporter;
+ typedef laps_stopclock<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration>, elapsed_formatter > ReporterE;
+
+ check_invariants<Reporter>();
+ check_default_constructor<Reporter>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ check_constructor_ec<Reporter>();
+ check_constructor_throws<Reporter>();
+#endif
+ check_elapsed<Reporter>();
+
+ check_report<Reporter>();
+ check_file_line<ReporterE>();
+
+ check_start_start<Reporter>();
+ check_dont_start_constructor<Reporter>();
+ check_dont_start_start<Reporter>();
+ check_dont_start_start_stop<Reporter>();
+ check_dont_start_scoped_run<Reporter>();
+ check_stop<Reporter>();
+ check_stop_stop<Reporter>();
+
+}
+
+
+
+int main()
+{
+ typedef laps_stopclock<high_resolution_clock > Reporter;
+
+ static Reporter::formatter_type fmtr;
+
+ Reporter _(fmtr);
+
+ check_all<ex::cycle_count<1500> >();
+
+ return boost::report_errors();
+}

Added: trunk/libs/chrono/test/stopwatch/laps_stopclock_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/chrono/test/stopwatch/laps_stopclock_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -0,0 +1,254 @@
+// Copyright 2010-2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#include <iostream>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/chrono/stopwatches/reporters/laps_stopclock.hpp>
+#include <libs/chrono/test/cycle_count.hpp>
+#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
+
+#include <boost/chrono/chrono_io.hpp>
+#include <boost/system/system_error.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+#if !defined(BOOST_NO_STATIC_ASSERT)
+#define NOTHING ""
+#endif
+
+using namespace boost::chrono;
+
+
+template <typename Stopwatch>
+void check_invariants()
+{
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::rep, typename Stopwatch::clock::duration::rep>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::period, typename Stopwatch::clock::duration::period>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::duration, typename Stopwatch::clock::time_point::duration>::value), NOTHING, ());
+ BOOST_CHRONO_STATIC_ASSERT(Stopwatch::is_steady == Stopwatch::clock::is_steady, NOTHING, ());
+}
+
+template <typename Stopwatch>
+void check_default_constructor()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+}
+
+template <typename Stopwatch>
+void check_dont_start_constructor()
+{
+ Stopwatch sw(boost::chrono::dont_start);
+ BOOST_TEST(!sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(d == Stopwatch::duration::zero());
+}
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+template <typename Stopwatch>
+void check_constructor_ec()
+{
+ boost::system::error_code ec;
+ Stopwatch sw(ec);
+ BOOST_TEST(sw.is_running());
+ BOOST_TEST(ec.value()==0);
+}
+
+template <typename Stopwatch>
+void check_constructor_throws()
+{
+ Stopwatch sw(boost::throws());
+ BOOST_TEST(sw.is_running());
+}
+#endif
+
+template <typename Stopwatch>
+void check_elapsed()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(100));
+}
+
+template <typename Stopwatch>
+void check_start_start()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.start();
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(100));
+ BOOST_TEST(d < boost::chrono::milliseconds(200));
+}
+
+template <typename Stopwatch>
+void check_dont_start_start()
+{
+ Stopwatch sw(boost::chrono::dont_start);
+ BOOST_TEST(!sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.start();
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(100));
+ BOOST_TEST(d < boost::chrono::milliseconds(200));
+}
+
+template <typename Stopwatch>
+void check_dont_start_start_stop()
+{
+ Stopwatch sw(boost::chrono::dont_start);
+ BOOST_TEST(!sw.is_running());
+ sw.start();
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.stop();
+ BOOST_TEST(!sw.is_running());
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(0));
+}
+
+template <typename Stopwatch>
+void check_dont_start_scoped_run()
+{
+ Stopwatch sw(boost::chrono::dont_start);
+ BOOST_TEST(!sw.is_running());
+ {
+ typename Stopwatch::scoped_run _(sw);
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ }
+ BOOST_TEST(!sw.is_running());
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d >= boost::chrono::milliseconds(0));
+}
+
+template <typename Stopwatch>
+void check_stop()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.stop();
+ BOOST_TEST(!sw.is_running());
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d == boost::chrono::milliseconds(0));
+}
+
+template <typename Stopwatch>
+void check_stop_stop()
+{
+ Stopwatch sw;
+ BOOST_TEST(sw.is_running());
+ ex::sleep_for<typename Stopwatch::clock>(boost::chrono::milliseconds(100));
+ sw.stop();
+ BOOST_TEST(!sw.is_running());
+ typename Stopwatch::duration d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d == boost::chrono::milliseconds(0));
+ sw.stop();
+ BOOST_TEST(!sw.is_running());
+ d=sw.elapsed();
+ BOOST_TEST(!sw.is_running());
+ BOOST_TEST(d == boost::chrono::milliseconds(0));
+}
+
+
+
+struct file_line {
+ file_line(const char* file, std::size_t line)
+ : fmt("%1%[%2%] Elapsed time:")
+ {
+ fmt % file % line;
+ }
+ ~file_line()
+ {
+ std::cout << fmt;
+ }
+ boost::format fmt;
+
+};
+
+template <typename Reporter>
+void check_file_line2()
+{
+ Reporter _("%1%\n");
+ file_line fl(__FILE__, __LINE__);
+ ex::sleep_for<typename Reporter::clock>(milliseconds(100));
+
+}
+template <typename Reporter>
+void check_file_line()
+{
+ Reporter rp("%1%[%2%] Elapsed time: %3%\n");
+ rp.format() % __FILE__ % __LINE__;
+
+ ex::sleep_for<typename Reporter::clock>(milliseconds(100));
+
+}
+
+template <typename Reporter>
+void check_report()
+{
+ Reporter sw;
+ ex::sleep_for<typename Reporter::clock>(milliseconds(100));
+ sw.report();
+}
+
+
+
+
+template <typename Clock>
+void check_all()
+{
+ typedef laps_stopclock<Clock> Reporter;
+ typedef laps_stopclock<Clock, no_memory<typename Clock::duration>, elapsed_formatter > ReporterE;
+
+ check_invariants<Reporter>();
+ check_default_constructor<Reporter>();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ check_constructor_ec<Reporter>();
+ check_constructor_throws<Reporter>();
+#endif
+ check_elapsed<Reporter>();
+
+ check_report<Reporter>();
+ check_file_line<ReporterE>();
+
+ check_start_start<Reporter>();
+ check_dont_start_constructor<Reporter>();
+ check_dont_start_start<Reporter>();
+ check_dont_start_start_stop<Reporter>();
+ check_dont_start_scoped_run<Reporter>();
+ check_stop<Reporter>();
+ check_stop_stop<Reporter>();
+
+
+}
+
+int main()
+{
+ typedef laps_stopclock<high_resolution_clock > Reporter;
+
+ static Reporter::formatter_type fmtr;
+
+ //Reporter _(fmtr);
+ Reporter _;
+
+ check_all<ex::cycle_count<1500> >();
+
+ return boost::report_errors();
+}

Modified: trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,13 +1,4 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 

Modified: trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,13 +1,4 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 

Modified: trunk/libs/chrono/test/stopwatch/suspendable_stopwatch_pass.cpp
==============================================================================
--- trunk/libs/chrono/test/stopwatch/suspendable_stopwatch_pass.cpp (original)
+++ trunk/libs/chrono/test/stopwatch/suspendable_stopwatch_pass.cpp 2011-11-12 03:43:00 EST (Sat, 12 Nov 2011)
@@ -1,13 +1,4 @@
-//===----------------------------------------------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-// Adaptation to Boost of the libcxx
-// Copyright 2010 Vicente J. Botet Escriba
+// Copyright 2010-2011 Vicente J. Botet Escriba
 // Distributed under the Boost Software License, Version 1.0.
 // See http://www.boost.org/LICENSE_1_0.txt
 


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