|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74777 - in trunk/boost/chrono: . detail/inlined detail/inlined/mac detail/inlined/posix detail/inlined/win stopwatches stopwatches/formatters stopwatches/reporters
From: vicente.botet_at_[hidden]
Date: 2011-10-07 09:43:50
Author: viboes
Date: 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
New Revision: 74777
URL: http://svn.boost.org/trac/boost/changeset/74777
Log:
Chrono: Added BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING to avoid system::error_code
Text files modified:
trunk/boost/chrono/config.hpp | 2
trunk/boost/chrono/detail/inlined/mac/chrono.hpp | 16 +++-
trunk/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp | 9 ++
trunk/boost/chrono/detail/inlined/posix/chrono.hpp | 4 +
trunk/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp | 10 ++
trunk/boost/chrono/detail/inlined/posix/thread_clock.hpp | 3
trunk/boost/chrono/detail/inlined/process_cpu_clocks.hpp | 38 ----------
trunk/boost/chrono/detail/inlined/win/chrono.hpp | 4 +
trunk/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp | 9 ++
trunk/boost/chrono/detail/inlined/win/thread_clock.hpp | 2
trunk/boost/chrono/process_cpu_clocks.hpp | 15 +++
trunk/boost/chrono/stopwatches/basic_stopwatch.hpp | 18 ++++-
trunk/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp | 5
trunk/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp | 7 +
trunk/boost/chrono/stopwatches/formatters/times_formatter.hpp | 7 +
trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp | 19 +++--
trunk/boost/chrono/stopwatches/simple_stopwatch.hpp | 5 +
trunk/boost/chrono/stopwatches/stopwatch_scoped.hpp | 65 ++++++++++--------
trunk/boost/chrono/stopwatches/suspendable_stopwatch.hpp | 139 +++++++++++++++++++++++++++++++++------
trunk/boost/chrono/system_clocks.hpp | 8 ++
trunk/boost/chrono/thread_clock.hpp | 4 +
21 files changed, 274 insertions(+), 115 deletions(-)
Modified: trunk/boost/chrono/config.hpp
==============================================================================
--- trunk/boost/chrono/config.hpp (original)
+++ trunk/boost/chrono/config.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -148,6 +148,8 @@
#endif
+//#define BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+
// enable automatic library variant selection ------------------------------//
#if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB)
Modified: trunk/boost/chrono/detail/inlined/mac/chrono.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/mac/chrono.hpp (original)
+++ trunk/boost/chrono/detail/inlined/mac/chrono.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -33,6 +33,7 @@
return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
system_clock::time_point
system_clock::now(system::error_code & ec)
{
@@ -44,7 +45,7 @@
}
return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
}
-
+#endif
// Take advantage of the fact that on this platform time_t is nothing but
// an integral count of seconds since New Years 1970 (same epoch as timeval).
// Just get the duration out of the time_point and truncate it to seconds.
@@ -82,6 +83,7 @@
return mach_absolute_time();
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
BOOST_CHRONO_STATIC
steady_clock::rep
steady_simplified_ec(system::error_code & ec)
@@ -92,7 +94,7 @@
}
return mach_absolute_time();
}
-
+#endif
BOOST_CHRONO_STATIC
double
@@ -119,6 +121,7 @@
return static_cast<steady_clock::rep>(mach_absolute_time() * factor);
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
BOOST_CHRONO_STATIC
steady_clock::rep
steady_full_ec(system::error_code & ec)
@@ -147,10 +150,12 @@
}
return static_cast<steady_clock::rep>(mach_absolute_time() * factor);
}
+#endif
typedef steady_clock::rep (*FP)();
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
typedef steady_clock::rep (*FP_ec)(system::error_code &);
-
+#endif
BOOST_CHRONO_STATIC
FP
@@ -170,6 +175,7 @@
return &chrono_detail::steady_full;
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
BOOST_CHRONO_STATIC
FP_ec
init_steady_clock_ec(kern_return_t & err)
@@ -187,6 +193,7 @@
}
return &chrono_detail::steady_full_ec;
}
+#endif
}
steady_clock::time_point
@@ -201,6 +208,7 @@
return time_point(duration(fp()));
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
steady_clock::time_point
steady_clock::now(system::error_code & ec)
{
@@ -228,6 +236,6 @@
}
return time_point(duration(fp(ec)));
}
-
+#endif
} // namespace chrono
} // namespace boost
Modified: trunk/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp (original)
+++ trunk/boost/chrono/detail/inlined/mac/process_cpu_clocks.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -78,6 +78,7 @@
#endif
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_real_cpu_clock::time_point process_real_cpu_clock::now(system::error_code & ec)
{
@@ -136,7 +137,9 @@
#endif
}
+#endif
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_user_cpu_clock::time_point process_user_cpu_clock::now(system::error_code & ec)
{
tms tm;
@@ -174,6 +177,7 @@
}
}
}
+#endif
process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
@@ -218,6 +222,7 @@
return time_point();
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_system_cpu_clock::time_point process_system_cpu_clock::now(system::error_code & ec)
{
tms tm;
@@ -255,6 +260,7 @@
}
}
}
+#endif
process_cpu_clock::time_point process_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
@@ -280,6 +286,7 @@
return time_point();
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_cpu_clock::time_point process_cpu_clock::now(system::error_code & ec)
{
@@ -318,5 +325,7 @@
}
}
+#endif
+
}
}
Modified: trunk/boost/chrono/detail/inlined/posix/chrono.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/posix/chrono.hpp (original)
+++ trunk/boost/chrono/detail/inlined/posix/chrono.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -29,6 +29,7 @@
static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
system_clock::time_point system_clock::now(system::error_code & ec)
{
timespec ts;
@@ -56,6 +57,7 @@
return time_point(duration(
static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
}
+#endif
std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_CHRONO_NOEXCEPT
{
@@ -81,6 +83,7 @@
static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
steady_clock::time_point steady_clock::now(system::error_code & ec)
{
timespec ts;
@@ -109,6 +112,7 @@
static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
}
#endif
+#endif
} // namespace chrono
} // namespace boost
Modified: trunk/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp (original)
+++ trunk/boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -63,6 +63,8 @@
}
return time_point();
}
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_real_cpu_clock::time_point process_real_cpu_clock::now(
system::error_code & ec)
{
@@ -114,6 +116,7 @@
}
}
}
+#endif
process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
@@ -138,6 +141,7 @@
return time_point();
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_user_cpu_clock::time_point process_user_cpu_clock::now(
system::error_code & ec)
{
@@ -188,6 +192,7 @@
}
}
}
+#endif
process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
@@ -212,6 +217,7 @@
}
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_system_cpu_clock::time_point process_system_cpu_clock::now(
system::error_code & ec)
{
@@ -262,6 +268,7 @@
}
}
}
+#endif
process_cpu_clock::time_point process_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
@@ -288,6 +295,8 @@
}
return time_point();
}
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_cpu_clock::time_point process_cpu_clock::now(
system::error_code & ec )
{
@@ -338,5 +347,6 @@
}
}
+#endif
} }
Modified: trunk/boost/chrono/detail/inlined/posix/thread_clock.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/posix/thread_clock.hpp (original)
+++ trunk/boost/chrono/detail/inlined/posix/thread_clock.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -43,6 +43,8 @@
static_cast<thread_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
}
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
thread_clock::time_point thread_clock::now( system::error_code & ec )
{
struct timespec ts;
@@ -82,4 +84,5 @@
static_cast<thread_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec));
}
+#endif
} }
Modified: trunk/boost/chrono/detail/inlined/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/process_cpu_clocks.hpp (original)
+++ trunk/boost/chrono/detail/inlined/process_cpu_clocks.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -39,45 +39,7 @@
#include <boost/chrono/detail/inlined/posix/process_cpu_clocks.hpp>
#endif // POSIX
-#if 0
-namespace boost { namespace chrono {
- process_real_cpu_clock::time_point process_real_cpu_clock::now(
- system::error_code & ec)
- {
- process_times t;
- process_clock::now(t, ec);
- return process_real_cpu_clock::time_point(t.real);
- }
-
- process_user_cpu_clock::time_point process_user_cpu_clock::now(
- system::error_code & ec)
- {
- process_times t;
- process_clock::now(t, ec);
- return process_user_cpu_clock::time_point(t.user);
- }
-
- process_system_cpu_clock::time_point process_system_cpu_clock::now(
- system::error_code & ec)
- {
- process_times t;
- process_clock::now(t, ec);
- return process_system_cpu_clock::time_point(t.system);
- }
-
- process_cpu_clock::time_point process_cpu_clock::now(
- system::error_code & ec )
- {
- process_times t;
- process_clock::now(t,ec);
- time_point::rep r(t.real.count(), t.user.count(), t.system.count());
- return time_point(duration(r));
- }
-
-} // namespace chrono
-} // namespace boost
-#endif
#endif
#endif
Modified: trunk/boost/chrono/detail/inlined/win/chrono.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/win/chrono.hpp (original)
+++ trunk/boost/chrono/detail/inlined/win/chrono.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -49,6 +49,7 @@
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
steady_clock::time_point steady_clock::now( system::error_code & ec )
{
static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic();
@@ -82,6 +83,7 @@
return time_point(duration(
static_cast<steady_clock::rep>(nanosecs_per_tic * pcount.QuadPart)));
}
+#endif
BOOST_CHRONO_INLINE
system_clock::time_point system_clock::now() BOOST_CHRONO_NOEXCEPT
@@ -99,6 +101,7 @@
(static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime));
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
BOOST_CHRONO_INLINE
system_clock::time_point system_clock::now( system::error_code & ec )
{
@@ -118,6 +121,7 @@
return time_point(duration(
(static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime));
}
+#endif
BOOST_CHRONO_INLINE
std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_CHRONO_NOEXCEPT
Modified: trunk/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp (original)
+++ trunk/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -39,6 +39,7 @@
);
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_real_cpu_clock::time_point process_real_cpu_clock::now(
system::error_code & ec)
{
@@ -59,6 +60,7 @@
duration(c*(1000000000l/CLOCKS_PER_SEC))
);
}
+#endif
process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
@@ -83,6 +85,7 @@
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_user_cpu_clock::time_point process_user_cpu_clock::now(
system::error_code & ec)
{
@@ -122,6 +125,7 @@
}
}
+#endif
process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
@@ -146,6 +150,7 @@
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_system_cpu_clock::time_point process_system_cpu_clock::now(
system::error_code & ec)
{
@@ -185,6 +190,8 @@
}
}
+#endif
+
process_cpu_clock::time_point process_cpu_clock::now() BOOST_CHRONO_NOEXCEPT
{
@@ -214,6 +221,7 @@
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
process_cpu_clock::time_point process_cpu_clock::now(
system::error_code & ec )
{
@@ -259,6 +267,7 @@
}
}
+#endif
} // namespace chrono
} // namespace boost
Modified: trunk/boost/chrono/detail/inlined/win/thread_clock.hpp
==============================================================================
--- trunk/boost/chrono/detail/inlined/win/thread_clock.hpp (original)
+++ trunk/boost/chrono/detail/inlined/win/thread_clock.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -24,6 +24,7 @@
namespace chrono
{
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
thread_clock::time_point thread_clock::now( system::error_code & ec )
{
// note that Windows uses 100 nanosecond ticks for FILETIME
@@ -65,6 +66,7 @@
}
}
}
+#endif
thread_clock::time_point thread_clock::now() BOOST_CHRONO_NOEXCEPT
{
Modified: trunk/boost/chrono/process_cpu_clocks.hpp
==============================================================================
--- trunk/boost/chrono/process_cpu_clocks.hpp (original)
+++ trunk/boost/chrono/process_cpu_clocks.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -16,9 +16,11 @@
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
-#include <boost/system/error_code.hpp>
#include <boost/operators.hpp>
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+#include <boost/system/error_code.hpp>
#include <boost/chrono/detail/system.hpp>
+#endif
#include <iostream>
#include <boost/type_traits/common_type.hpp>
#include <boost/chrono/io/clock_string.hpp>
@@ -39,7 +41,9 @@
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
+#endif
};
class BOOST_CHRONO_DECL process_user_cpu_clock {
@@ -51,7 +55,9 @@
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
+#endif
};
class BOOST_CHRONO_DECL process_system_cpu_clock {
@@ -63,7 +69,9 @@
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
+#endif
};
template <typename Rep>
@@ -299,8 +307,9 @@
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
- static BOOST_CHRONO_INLINE time_point now(
- system::error_code & ec );
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ static BOOST_CHRONO_INLINE time_point now(system::error_code & ec );
+#endif
};
template <class CharT, class Traits, typename Rep>
Modified: trunk/boost/chrono/stopwatches/basic_stopwatch.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/basic_stopwatch.hpp (original)
+++ trunk/boost/chrono/stopwatches/basic_stopwatch.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -66,6 +66,7 @@
start();
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
/**
* Default constructor.
*
@@ -82,7 +83,7 @@
{
start(ec);
}
-
+#endif
/**
* Not starting constructor.
*
@@ -116,6 +117,7 @@
start();
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
/**
* Starting constructor from a LapsCollector instance.
*
@@ -135,6 +137,7 @@
{
start(ec);
}
+#endif
/**
* Not starting constructor from a LapsCollector instance.
@@ -186,6 +189,7 @@
start_ = tmp;
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
/**
* Restart the stopwatch.
*
@@ -211,6 +215,7 @@
}
start_ = tmp;
}
+#endif
/**
* Start the stopwatch.
@@ -225,6 +230,7 @@
running_ = true;
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
/**
* Start the stopwatch.
*
@@ -243,7 +249,7 @@
start_ = tmp;
running_ = true;
}
-
+#endif
/**
* Start the stopwatch.
@@ -264,6 +270,7 @@
}
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
/**
* Start the stopwatch.
*
@@ -288,6 +295,7 @@
running_ = false;
}
}
+#endif
/**
* States if the Stopwatch is running.
@@ -314,6 +322,7 @@
}
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
/**
* Elapsed time getter for the current lap.
*
@@ -337,7 +346,7 @@
return duration::zero();
}
}
-
+#endif
/**
* Elapsed time getter.
@@ -352,6 +361,7 @@
return laps_collector_.elapsed()+elapsed_current_lap();
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
/**
* Elapsed time getter.
*
@@ -368,7 +378,7 @@
if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
return laps_collector_.elapsed() + tmp;
}
-
+#endif
/**
* Elapsed time for the last lap.
*
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-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -78,8 +78,9 @@
// }
template<class Stopwatch>
- void operator()(Stopwatch & stopwatch_, system::error_code & ec =
- BOOST_CHRONO_THROWS)
+ void operator()(Stopwatch & stopwatch_
+ //, system::error_code & ec = BOOST_CHRONO_THROWS
+ )
{
typedef typename Stopwatch::laps_collector::storage_type
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-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -69,10 +69,13 @@
// }
template<class Stopwatch>
- void operator()(Stopwatch & stopwatch_, system::error_code & ec= BOOST_CHRONO_THROWS)
+ void operator()(Stopwatch & stopwatch_
+ //, system::error_code & ec= BOOST_CHRONO_THROWS
+ )
{
typedef typename Stopwatch::duration duration_t;
- duration_t d = stopwatch_.elapsed(ec);
+ duration_t d = stopwatch_.elapsed();
+ //duration_t d = stopwatch_.elapsed(ec);
if (d < duration_t::zero())
return;
Modified: trunk/boost/chrono/stopwatches/formatters/times_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/formatters/times_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/formatters/times_formatter.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -69,10 +69,13 @@
// }
template<class Stopwatch>
- void operator()(Stopwatch & stopwatch_, system::error_code & ec= BOOST_CHRONO_THROWS)
+ void operator()(Stopwatch & stopwatch_
+ //, system::error_code & ec= BOOST_CHRONO_THROWS
+ )
{
typedef typename Stopwatch::duration::rep times_type;
- times_type times = stopwatch_.elapsed(ec).count();
+ //times_type times = stopwatch_.elapsed(ec).count();
+ times_type times = stopwatch_.elapsed().count();
if (times.real < 0)
return;
Modified: trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp (original)
+++ trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -45,10 +45,12 @@
{
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
explicit basic_stopwatch_reporter(system::error_code & ec) :
base_type(ec), formatter_(), reported_(false)
{
}
+#endif
explicit basic_stopwatch_reporter(
const dont_start_t& tag
@@ -84,11 +86,11 @@
formatter_(*this);
reported_ = true;
}
- inline void report(system::error_code & ec)
- {
- formatter_(*this, ec);
- reported_ = true;
- }
+// inline void report(system::error_code & ec)
+// {
+// formatter_(*this, ec);
+// reported_ = true;
+// }
bool reported() const
{
@@ -132,15 +134,15 @@
typedef Formatter formatter_type;
stopwatch_reporter()
- //: base_type()
{
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
explicit stopwatch_reporter(system::error_code & ec) :
base_type(ec)
{
}
-
+#endif
explicit stopwatch_reporter(
const dont_start_t& tag
) BOOST_CHRONO_NOEXCEPT :
@@ -202,11 +204,12 @@
base_type()
{
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
explicit wstopwatch_reporter(system::error_code & ec) :
base_type(ec)
{
}
-
+#endif
explicit wstopwatch_reporter(
const dont_start_t& tag
) BOOST_CHRONO_NOEXCEPT :
Modified: trunk/boost/chrono/stopwatches/simple_stopwatch.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/simple_stopwatch.hpp (original)
+++ trunk/boost/chrono/stopwatches/simple_stopwatch.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -38,6 +38,7 @@
start_(clock::now())
{
}
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
explicit simple_stopwatch(system::error_code & ec) :
start_(duration::zero())
{
@@ -51,6 +52,7 @@
}
start_ = tmp;
}
+#endif
~simple_stopwatch() BOOST_CHRONO_NOEXCEPT
{
@@ -60,6 +62,8 @@
{
return clock::now() - start_;
}
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
duration elapsed(system::error_code & ec)
{
time_point tmp = clock::now(ec);
@@ -70,6 +74,7 @@
}
return tmp - start_;
}
+#endif
private:
time_point start_;
Modified: trunk/boost/chrono/stopwatches/stopwatch_scoped.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/stopwatch_scoped.hpp (original)
+++ trunk/boost/chrono/stopwatches/stopwatch_scoped.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -20,23 +20,22 @@
{
public:
typedef Stopwatch stopwatch;
- stopwatch_runner(stopwatch & a, system::error_code & ec =
- BOOST_CHRONO_THROWS) :
+ stopwatch_runner(stopwatch & a) :
stopwatch_(a)
{
- stopwatch_.start(ec);
+ stopwatch_.start();
}
- ~stopwatch_runner()
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ stopwatch_runner(stopwatch & a, system::error_code & ec) :
+ stopwatch_(a)
{
- system::error_code ec;
- stopwatch_.stop(ec);
+ stopwatch_.start(ec);
}
-#if 0
- typename Stopwatch::duration elapsed(system::error_code & ec = BOOST_CHRONO_THROWS)
+#endif
+ ~stopwatch_runner()
{
- return stopwatch_.elapsed(ec)-stopwatch_.get_storage();
+ stopwatch_.stop();
}
-#endif
private:
stopwatch& stopwatch_;
stopwatch_runner();//= delete;
@@ -50,23 +49,22 @@
{
public:
typedef Stopwatch stopwatch;
- stopwatch_stopper(stopwatch & a, system::error_code & ec =
- BOOST_CHRONO_THROWS) :
+ stopwatch_stopper(stopwatch & a) :
stopwatch_(a)
{
- stopwatch_.stop(ec);
+ stopwatch_.stop();
}
- ~stopwatch_stopper()
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ stopwatch_stopper(stopwatch & a, system::error_code & ec) :
+ stopwatch_(a)
{
- system::error_code ec;
- stopwatch_.start(ec);
+ stopwatch_.stop(ec);
}
-#if 0
- typename Stopwatch::duration elapsed(system::error_code & ec = BOOST_CHRONO_THROWS)
+#endif
+ ~stopwatch_stopper()
{
- return stopwatch_.elapsed(ec)-stopwatch_.get_storage();
+ stopwatch_.start();
}
-#endif
private:
stopwatch& stopwatch_;
stopwatch_stopper();//= delete;
@@ -80,16 +78,22 @@
{
public:
typedef Stopwatch stopwatch;
- stopwatch_suspender(stopwatch & a, system::error_code & ec =
- BOOST_CHRONO_THROWS) :
+ stopwatch_suspender(stopwatch & a) :
+ stopwatch_(a)
+ {
+ stopwatch_.suspend();
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ stopwatch_suspender(stopwatch & a, system::error_code & ec) :
stopwatch_(a)
{
stopwatch_.suspend(ec);
}
+#endif
+
~stopwatch_suspender()
{
- system::error_code ec;
- stopwatch_.resume(ec);
+ stopwatch_.resume();
}
private:
stopwatch& stopwatch_;
@@ -103,16 +107,21 @@
{
public:
typedef Stopwatch stopwatch;
- stopwatch_resumer(stopwatch & a, system::error_code & ec =
- BOOST_CHRONO_THROWS) :
+ stopwatch_resumer(stopwatch & a) :
+ stopwatch_(a)
+ {
+ stopwatch_.resume();
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ stopwatch_resumer(stopwatch & a, system::error_code & ec) :
stopwatch_(a)
{
stopwatch_.resume(ec);
}
+#endif
~stopwatch_resumer()
{
- system::error_code ec;
- stopwatch_.suspend(ec);
+ stopwatch_.suspend();
}
private:
stopwatch& stopwatch_;
Modified: trunk/boost/chrono/stopwatches/suspendable_stopwatch.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/suspendable_stopwatch.hpp (original)
+++ trunk/boost/chrono/stopwatches/suspendable_stopwatch.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -38,8 +38,18 @@
typedef typename Clock::period period;
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
+ suspendable_stopwatch() :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(),
+ suspended_(false),
+ partial_(duration::zero())
+ {
+ start();
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
explicit suspendable_stopwatch(
- system::error_code & ec = BOOST_CHRONO_THROWS
+ system::error_code & ec
) :
start_(duration::zero()),
running_(false),
@@ -49,6 +59,8 @@
{
start(ec);
}
+#endif
+
explicit suspendable_stopwatch(
const dont_start_t&
) :
@@ -61,8 +73,21 @@
}
explicit suspendable_stopwatch(
+ laps_collector const& acc
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc),
+ suspended_(false),
+ partial_(duration::zero())
+ {
+ start();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit suspendable_stopwatch(
laps_collector const& acc,
- system::error_code & ec = BOOST_CHRONO_THROWS
+ system::error_code & ec
) :
start_(duration::zero()),
running_(false),
@@ -72,6 +97,7 @@
{
start(ec);
}
+#endif
suspendable_stopwatch(
laps_collector const& acc,
@@ -87,13 +113,28 @@
~suspendable_stopwatch()
{
- system::error_code ec;
- stop(ec);
+ stop();
}
- void restart(
- system::error_code & ec = BOOST_CHRONO_THROWS
- )
+ void restart()
+ {
+ time_point tmp = clock::now();
+
+ if (running_)
+ {
+ partial_ += tmp - start_;
+ laps_collector_.store(partial_);
+ partial_ = duration::zero();
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void restart(system::error_code & ec)
{
time_point tmp = clock::now(ec);
if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
@@ -110,10 +151,16 @@
}
start_ = tmp;
}
+#endif
- void start(
- system::error_code & ec = BOOST_CHRONO_THROWS
- )
+ void start()
+ {
+ start_ = clock::now();;
+ partial_ = duration::zero();
+ running_ = true;
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void start(system::error_code & ec)
{
time_point tmp = clock::now(ec);
if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
@@ -122,10 +169,19 @@
start_ = tmp;
running_ = true;
}
+#endif
- void stop(
- system::error_code & ec = BOOST_CHRONO_THROWS
- )
+ void stop()
+ {
+ partial_ += clock::now() - start_;
+ laps_collector_.store(partial_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ suspended_ = false;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void stop(system::error_code & ec)
{
time_point tmp = clock::now(ec);
if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
@@ -136,10 +192,22 @@
running_ = false;
suspended_ = false;
}
+#endif
- void suspend(
- system::error_code & ec = BOOST_CHRONO_THROWS
- )
+ void suspend()
+ {
+ if (is_running())
+ {
+ if (!suspended_)
+ {
+ partial_ += clock::now() - start_;
+ suspended_ = true;
+ }
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void suspend(system::error_code & ec)
{
if (is_running())
{
@@ -160,10 +228,19 @@
ec.clear();
}
}
+#endif
- void resume(
- system::error_code & ec = BOOST_CHRONO_THROWS
- )
+ void resume()
+ {
+ if (suspended_)
+ {
+ start_ = clock::now();
+ suspended_ = false;
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void resume(system::error_code & ec)
{
if (suspended_)
{
@@ -177,6 +254,7 @@
ec.clear();
}
}
+#endif
bool is_running() const {
return running_;
@@ -185,9 +263,24 @@
return suspended_;
}
- duration elapsed(
- system::error_code & ec = BOOST_CHRONO_THROWS
- ) const
+ duration elapsed() const
+ {
+ if (is_running())
+ {
+ if (suspended_) {
+ return partial_;
+ }
+ else
+ {
+ return partial_ + clock::now() - start_;
+ }
+ } else
+ {
+ return duration::zero();
+ }
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ duration elapsed(system::error_code & ec) const
{
if (is_running())
{
@@ -206,7 +299,7 @@
return duration::zero();
}
}
-
+#endif
void reset(
)
Modified: trunk/boost/chrono/system_clocks.hpp
==============================================================================
--- trunk/boost/chrono/system_clocks.hpp (original)
+++ trunk/boost/chrono/system_clocks.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -1,4 +1,4 @@
-// system_clocks.hpp --------------------------------------------------------------//
+// boost/chrono/system_clocks.hpp --------------------------------------------------------------//
// Copyright 2008 Howard Hinnant
// Copyright 2008 Beman Dawes
@@ -62,8 +62,10 @@
#include <boost/chrono/config.hpp>
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
#include <boost/chrono/detail/system.hpp>
#include <boost/system/error_code.hpp>
+#endif
#include <boost/chrono/io/clock_string.hpp>
#include <ctime>
@@ -129,7 +131,9 @@
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = false;
static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec);
+#endif
static BOOST_CHRONO_INLINE std::time_t to_time_t(const time_point& t) BOOST_CHRONO_NOEXCEPT;
static BOOST_CHRONO_INLINE time_point from_time_t(std::time_t t) BOOST_CHRONO_NOEXCEPT;
@@ -153,7 +157,9 @@
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = true;
static BOOST_CHRONO_INLINE time_point now() BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now(system::error_code & ec);
+#endif
};
#endif
//----------------------------------------------------------------------------//
Modified: trunk/boost/chrono/thread_clock.hpp
==============================================================================
--- trunk/boost/chrono/thread_clock.hpp (original)
+++ trunk/boost/chrono/thread_clock.hpp 2011-10-07 09:43:47 EDT (Fri, 07 Oct 2011)
@@ -15,8 +15,10 @@
#include <boost/chrono/config.hpp>
#include <boost/chrono/duration.hpp>
#include <boost/chrono/time_point.hpp>
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
#include <boost/system/error_code.hpp>
#include <boost/chrono/detail/system.hpp>
+#endif
#include <boost/chrono/io/clock_string.hpp>
#ifndef BOOST_CHRONO_HEADER_ONLY
@@ -34,7 +36,9 @@
BOOST_CHRONO_STATIC_CONSTEXPR bool is_steady = BOOST_CHRONO_THREAD_CLOCK_IS_STEADY;
static BOOST_CHRONO_INLINE time_point now( ) BOOST_CHRONO_NOEXCEPT;
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
static BOOST_CHRONO_INLINE time_point now( system::error_code & ec );
+#endif
};
template <class CharT>
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