Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75408 - in trunk: boost/chrono/stopwatches boost/chrono/stopwatches/formatters boost/chrono/stopwatches/reporters libs/chrono/example libs/chrono/test libs/chrono/test/io libs/chrono/test/stopwatch
From: vicente.botet_at_[hidden]
Date: 2011-11-08 11:52:59


Author: viboes
Date: 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
New Revision: 75408
URL: http://svn.boost.org/trac/boost/changeset/75408

Log:
Chrono: refactor stopwatch_reporter
Text files modified:
   trunk/boost/chrono/stopwatches/basic_stopwatch.hpp | 3 ++-
   trunk/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp | 2 +-
   trunk/boost/chrono/stopwatches/reporters/basic_stopwatch_default_formatter.hpp | 22 ++++++++++++++--------
   trunk/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp | 22 ++++++++++++++--------
   trunk/boost/chrono/stopwatches/reporters/process_default_formatter.hpp | 24 ++++++++++++++++--------
   trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp | 20 +++++++++++---------
   trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp | 22 ++++++++++++++--------
   trunk/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp | 2 ++
   trunk/boost/chrono/stopwatches/simple_stopwatch.hpp | 3 ++-
   trunk/boost/chrono/stopwatches/stopwatch_scoped.hpp | 2 ++
   trunk/boost/chrono/stopwatches/suspendable_stopwatch.hpp | 4 ++--
   trunk/libs/chrono/example/french.cpp | 2 +-
   trunk/libs/chrono/test/Jamfile.v2 | 2 +-
   trunk/libs/chrono/test/cycle_count.hpp | 16 ++++++++--------
   trunk/libs/chrono/test/io/duration_input.cpp | 16 +++++-----------
   trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp | 2 +-
   trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp | 2 +-
   trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp | 4 ++--
   18 files changed, 99 insertions(+), 71 deletions(-)

Modified: trunk/boost/chrono/stopwatches/basic_stopwatch.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/basic_stopwatch.hpp (original)
+++ trunk/boost/chrono/stopwatches/basic_stopwatch.hpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -7,14 +7,15 @@
 #ifndef BOOST_CHRONO_STOPWATCHES_BASIC_STOPWATCH__HPP
 #define BOOST_CHRONO_STOPWATCHES_BASIC_STOPWATCH__HPP
 
-#include <utility>
 
 #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
 {

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-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -27,7 +27,7 @@
   namespace chrono
   {
 
- template<typename Ratio = milli, typename CharT = char,
+ template<typename Ratio, typename CharT,
         typename Traits = std::char_traits<CharT>,
         class Alloc = std::allocator<CharT> >
     class basic_elapsed_formatter: public base_formatter<CharT, Traits>, public basic_format<CharT, Traits>

Modified: trunk/boost/chrono/stopwatches/reporters/basic_stopwatch_default_formatter.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/reporters/basic_stopwatch_default_formatter.hpp (original)
+++ trunk/boost/chrono/stopwatches/reporters/basic_stopwatch_default_formatter.hpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -19,17 +19,23 @@
   namespace chrono
   {
 
- template <typename Clock, typename Features, typename Weight>
- struct stopwatch_reporter_default_formatter<basic_stopwatch<Clock,laps_accumulator_set<typename Clock::duration,Features, Weight> > >
+ 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 accumulator_set_formatter type;
+ typedef basic_accumulator_set_formatter<milli,CharT> 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;
- };
+// 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

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-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -15,17 +15,23 @@
   namespace chrono
   {
 
- template<class Clock>
- struct clock_default_formatter
+ template<class CharT, class Clock>
+ struct basic_clock_default_formatter
     {
- typedef elapsed_formatter type;
+ typedef basic_elapsed_formatter<milli, CharT> type;
     };
 
- template<class Clock>
- struct wclock_default_formatter
- {
- typedef welapsed_formatter 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
 

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-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -8,6 +8,8 @@
 #ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_PROCESS_DEFAULT_FORMATTER_HPP
 #define BOOST_CHRONO_STOPWATCHES_REPORTERS_PROCESS_DEFAULT_FORMATTER_HPP
 
+#include <boost/chrono/config.hpp>
+
 #include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
 #include <boost/chrono/stopwatches/reporters/clock_default_formatter.hpp>
 #include <boost/chrono/stopwatches/formatters/elapsed_formatter.hpp>
@@ -21,17 +23,23 @@
   namespace chrono
   {
 
- template<>
- struct clock_default_formatter<process_cpu_clock>
+ template <typename CharT>
+ struct basic_clock_default_formatter<CharT, process_cpu_clock>
     {
- typedef times_formatter type;
+ typedef basic_times_formatter<milli, CharT> type;
     };
 
- template<>
- struct wclock_default_formatter<process_cpu_clock>
- {
- typedef wtimes_formatter 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.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp (original)
+++ trunk/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -8,6 +8,8 @@
 #ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_STOPWATCH_REPORTER_HPP
 #define BOOST_CHRONO_STOPWATCHES_REPORTERS_STOPWATCH_REPORTER_HPP
 
+#include <boost/chrono/config.hpp>
+
 #if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
 #if defined __GNUC__
 #pragma GCC system_header
@@ -31,7 +33,7 @@
   namespace chrono
   {
 
- template<class Stopwatch, class Formatter>
+ template<class CharT, class Stopwatch, class Formatter=basic_stopwatch_reporter_default_formatter<CharT, Stopwatch> >
     class basic_stopwatch_reporter: public Stopwatch
     {
     public:
@@ -112,22 +114,22 @@
 
 
     template<class Stopwatch,
- class Formatter = typename stopwatch_reporter_default_formatter<
+ class Formatter = typename basic_stopwatch_reporter_default_formatter<char,
             Stopwatch>::type>
     class stopwatch_reporter;
 
     template<class Stopwatch, class Formatter>
- struct stopwatch_reporter_default_formatter<stopwatch_reporter<Stopwatch,
+ struct basic_stopwatch_reporter_default_formatter<char, stopwatch_reporter<Stopwatch,
         Formatter> >
     {
       typedef Formatter type;
     };
 
     template<class Stopwatch, class Formatter>
- class stopwatch_reporter: public basic_stopwatch_reporter<Stopwatch,
+ class stopwatch_reporter: public basic_stopwatch_reporter<char, Stopwatch,
         Formatter>
     {
- typedef basic_stopwatch_reporter<Stopwatch, Formatter> base_type;
+ typedef basic_stopwatch_reporter<char, Stopwatch, Formatter> base_type;
     public:
       typedef typename Stopwatch::clock clock;
       typedef Stopwatch stopwatch;
@@ -179,22 +181,22 @@
     };
 
     template<class Stopwatch,
- class Formatter = typename wstopwatch_reporter_default_formatter<
+ class Formatter = typename basic_stopwatch_reporter_default_formatter<wchar_t,
             Stopwatch>::type>
     class wstopwatch_reporter;
 
     template<class Stopwatch, class Formatter>
- struct wstopwatch_reporter_default_formatter<wstopwatch_reporter<
+ struct basic_stopwatch_reporter_default_formatter<wchar_t, wstopwatch_reporter<
         Stopwatch, Formatter> >
     {
       typedef Formatter type;
     };
 
     template<class Stopwatch, class Formatter>
- class wstopwatch_reporter: public basic_stopwatch_reporter<Stopwatch,
+ class wstopwatch_reporter: public basic_stopwatch_reporter<wchar_t, Stopwatch,
         Formatter>
     {
- typedef basic_stopwatch_reporter<Stopwatch, Formatter> base_type;
+ typedef basic_stopwatch_reporter<wchar_t, Stopwatch, Formatter> base_type;
     public:
       typedef typename Stopwatch::clock clock;
       typedef Stopwatch stopwatch;

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-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -15,17 +15,23 @@
   namespace chrono
   {
 
- template<class Stopwatch>
- struct stopwatch_reporter_default_formatter
- : clock_default_formatter<typename Stopwatch::clock>
+ template <class CharT, class Stopwatch>
+ struct basic_stopwatch_reporter_default_formatter
+ : basic_clock_default_formatter<CharT, typename Stopwatch::clock>
     {
     };
 
- template<class Stopwatch>
- struct wstopwatch_reporter_default_formatter
- : wclock_default_formatter<typename Stopwatch::clock>
- {
- };
+// 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-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -8,6 +8,8 @@
 #ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_THREAD_DEFAULT_FORMATTER_HPP
 #define BOOST_CHRONO_STOPWATCHES_REPORTERS_THREAD_DEFAULT_FORMATTER_HPP
 
+#include <boost/chrono/config.hpp>
+
 #if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
 
 #include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>

Modified: trunk/boost/chrono/stopwatches/simple_stopwatch.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/simple_stopwatch.hpp (original)
+++ trunk/boost/chrono/stopwatches/simple_stopwatch.hpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -7,12 +7,13 @@
 #ifndef BOOST_CHRONO_STOPWATCHES_SIMPLE_STOPWATCH__HPP
 #define BOOST_CHRONO_STOPWATCHES_SIMPLE_STOPWATCH__HPP
 
-#include <utility>
+#include <boost/chrono/config.hpp>
 
 #include <boost/chrono/chrono.hpp>
 #include <boost/system/error_code.hpp>
 #include <boost/chrono/thread_clock.hpp>
 #include <boost/chrono/process_cpu_clocks.hpp>
+#include <utility>
 
 namespace boost
 {

Modified: trunk/boost/chrono/stopwatches/stopwatch_scoped.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/stopwatch_scoped.hpp (original)
+++ trunk/boost/chrono/stopwatches/stopwatch_scoped.hpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -7,6 +7,8 @@
 #ifndef BOOST_CHRONO_STOPWATCHES_STOPWATCH_SCOPED_HPP
 #define BOOST_CHRONO_STOPWATCHES_STOPWATCH_SCOPED_HPP
 
+#include <boost/chrono/config.hpp>
+
 #include <boost/chrono/chrono.hpp>
 #include <boost/system/error_code.hpp>
 

Modified: trunk/boost/chrono/stopwatches/suspendable_stopwatch.hpp
==============================================================================
--- trunk/boost/chrono/stopwatches/suspendable_stopwatch.hpp (original)
+++ trunk/boost/chrono/stopwatches/suspendable_stopwatch.hpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -7,13 +7,13 @@
 #ifndef BOOST_CHRONO_STOPWATCHES_SUSPENDABLE_STOPWATCH__HPP
 #define BOOST_CHRONO_STOPWATCHES_SUSPENDABLE_STOPWATCH__HPP
 
-#include <utility>
-
 #include <boost/chrono/config.hpp>
+
 #include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
 #include <boost/chrono/stopwatches/collectors/no_memory.hpp>
 #include <boost/system/error_code.hpp>
 #include <boost/chrono/system_clocks.hpp>
+#include <utility>
 
 namespace boost
 {

Modified: trunk/libs/chrono/example/french.cpp
==============================================================================
--- trunk/libs/chrono/example/french.cpp (original)
+++ trunk/libs/chrono/example/french.cpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -35,7 +35,7 @@
       }
     protected:
 
- std::size_t do_get_plural_form(int_least64_t value) const
+ std::size_t do_get_plural_form(boost::int_least64_t value) const
       {
         return (value == -1 || value == 0 || value == 1) ? 0 : 1;
       }

Modified: trunk/libs/chrono/test/Jamfile.v2
==============================================================================
--- trunk/libs/chrono/test/Jamfile.v2 (original)
+++ trunk/libs/chrono/test/Jamfile.v2 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -286,7 +286,7 @@
         : :
         : <define>BOOST_CHRONO_HEADER_ONLY
            <define>BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
- : v1_$(sources[1]:B)header ]
+ : v1_$(sources[1]:B)_header ]
     ;
 }
 

Modified: trunk/libs/chrono/test/cycle_count.hpp
==============================================================================
--- trunk/libs/chrono/test/cycle_count.hpp (original)
+++ trunk/libs/chrono/test/cycle_count.hpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -63,17 +63,17 @@
   namespace chrono
   {
 
- template <long long speed>
- struct stopwatch_reporter_default_formatter<simple_stopwatch<ex::cycle_count<speed> > >
+ template <typename CharT, long long speed>
+ struct basic_stopwatch_reporter_default_formatter<CharT, simple_stopwatch<ex::cycle_count<speed> > >
     {
- typedef elapsed_formatter type;
+ typedef basic_elapsed_formatter<milli, CharT> type;
     };
 
- template <long long speed>
- struct wstopwatch_reporter_default_formatter<simple_stopwatch<ex::cycle_count<speed> > >
- {
- typedef welapsed_formatter type;
- };
+// template <long long speed>
+// struct wstopwatch_reporter_default_formatter<simple_stopwatch<ex::cycle_count<speed> > >
+// {
+// typedef welapsed_formatter type;
+// };
 
   } // namespace chrono
 } // namespace boost

Modified: trunk/libs/chrono/test/io/duration_input.cpp
==============================================================================
--- trunk/libs/chrono/test/io/duration_input.cpp (original)
+++ trunk/libs/chrono/test/io/duration_input.cpp 2011-11-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -7,16 +7,7 @@
 #include <sstream>
 #include <boost/detail/lightweight_test.hpp>
 
-template<typename D>
-void test_good2(const char* str, D res)
-{
- std::istringstream in(str);
- D d(0);
- in >> d;
- BOOST_TEST(in.eof());
- BOOST_TEST(!in.fail());
- BOOST_TEST(d == res);
-}
+
 template<typename D>
 void test_good(const char* str, D res)
 {
@@ -26,6 +17,7 @@
   BOOST_TEST(in.eof());
   BOOST_TEST(!in.fail());
   BOOST_TEST(d == res);
+ std::cout << str << " " << res << " " << d << std::endl;
 }
 
 template<typename DFail>
@@ -37,6 +29,7 @@
     in >> d;
     BOOST_TEST(in.fail());
     BOOST_TEST(d == DFail::zero());
+ std::cout << str << " " << res << " " << d << std::endl;
   }
 }
 
@@ -49,6 +42,7 @@
     in >> d;
     BOOST_TEST(!in.eof());
     BOOST_TEST(d == res);
+ std::cout << str << " " << res << " " << d << std::endl;
   }
 }
 int main()
@@ -56,7 +50,7 @@
   using namespace boost::chrono;
   using namespace boost;
 
- test_good2("5000", 5000);
+ test_good("5000", 5000);
 
   test_good("5000 hours", hours(5000));
   test_good("5000 minutes", minutes(5000));

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-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -255,7 +255,7 @@
 int main()
 {
   typedef basic_stopwatch<high_resolution_clock > Stopwatch;
- typedef stopwatch_reporter_default_formatter<Stopwatch>::type Formatter;
+ 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-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -252,7 +252,7 @@
 int main()
 {
   typedef basic_stopwatch<high_resolution_clock > Stopwatch;
- typedef stopwatch_reporter_default_formatter<Stopwatch>::type Formatter;
+ typedef basic_stopwatch_reporter_default_formatter<char, Stopwatch>::type Formatter;
   typedef stopwatch_reporter<Stopwatch> Reporter;
   static Formatter fmtr;
 

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-08 11:52:56 EST (Tue, 08 Nov 2011)
@@ -134,7 +134,7 @@
 int main()
 {
   typedef simple_stopwatch<high_resolution_clock > Stopwatch;
- typedef stopwatch_reporter_default_formatter<Stopwatch>::type Formatter;
+ typedef basic_stopwatch_reporter_default_formatter<char, Stopwatch>::type Formatter;
   typedef stopwatch_reporter<Stopwatch> Reporter;
   static Formatter fmtr;
 
@@ -157,7 +157,7 @@
   std::cout << "thread_clock=\n";
   check_all<thread_clock>(false);
 #endif
-
+
 #if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
   std::cout << "process_real_cpu_clock=\n";
   check_all<process_real_cpu_clock>(false);


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