Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65222 - in sandbox/chrono/libs/chrono: example test
From: vicente.botet_at_[hidden]
Date: 2010-09-03 15:37:46


Author: viboes
Date: 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
New Revision: 65222
URL: http://svn.boost.org/trac/boost/changeset/65222

Log:
Remove Stopwatches files

Removed:
   sandbox/chrono/libs/chrono/example/loop_stopclock_accumulator_example.cpp
   sandbox/chrono/libs/chrono/example/nested_stopclock_accumulator_example.cpp
   sandbox/chrono/libs/chrono/example/scoped_stopclock_example.cpp
   sandbox/chrono/libs/chrono/example/scoped_stopwatch_example.cpp
   sandbox/chrono/libs/chrono/example/sleep_for.hpp
   sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp
   sandbox/chrono/libs/chrono/example/stopclock_accumulator_example.cpp
   sandbox/chrono/libs/chrono/example/stopclock_example.cpp
   sandbox/chrono/libs/chrono/example/stopwatch_accumulator_example.cpp
   sandbox/chrono/libs/chrono/example/stopwatch_example.cpp
   sandbox/chrono/libs/chrono/example/suspendible_stopclock_example.cpp
   sandbox/chrono/libs/chrono/example/t24_hours_example.cpp
   sandbox/chrono/libs/chrono/test/stopclock_constructor_overload_test.cpp
   sandbox/chrono/libs/chrono/test/wstopclock_constructor_overload_test.cpp

Deleted: sandbox/chrono/libs/chrono/example/loop_stopclock_accumulator_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/loop_stopclock_accumulator_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,42 +0,0 @@
-// stopwatch_accumulator_example.cpp ---------------------------------------------------//
-
-// Copyright 2009 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-//#include <boost/chrono/stopclock_accumulator.hpp>
-#include <boost/chrono/stopwatches.hpp>
-
-#include <cmath>
-//#include <boost/thread.hpp>
-#include "sleep_for.hpp"
-
-using namespace boost::chrono;
-int f1(long j)
-{
- stopclock_accumulator<> acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
- for ( long i = 0; i < j; ++i ) {
- stopclock_accumulator<>::scoped_run _(acc);
- //~ std::cout << "i="<<i <<" ";
- //~ std::cout << " j="<<j <<" ";
- //~ stopclock<> s;
- std::sqrt( 123.456L ); // burn some time
- boost::this_thread::sleep_for(boost::chrono::milliseconds(20));
- }
-
-
- return 0;
-}
-int main()
-{
- static stopclock_accumulator<> acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
- stopclock_accumulator<>::scoped_run _(acc);
-
- f1(100);
- f1(200);
- f1(300);
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/nested_stopclock_accumulator_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/nested_stopclock_accumulator_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,70 +0,0 @@
-// stopwatch_accumulator_example.cpp ---------------------------------------------------//
-
-// Copyright 2009 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/stopwatches.hpp>
-#include <cmath>
-//#include <boost/thread.hpp>
-#include "sleep_for.hpp"
-
-using namespace boost::chrono;
-
-#define BOOST_CHRONO_STOPCLOCK_ACCUMULATOR \
- static stopclock_accumulator<> BOOST_JOIN(_boost_chrono_stopclock_accumulator_, __LINE__)( \
- std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format() \
- ); \
- stopclock_accumulator<>::scoped_run BOOST_JOIN(_boost_chrono_stopclock_accumulator_run_, __LINE__)(BOOST_JOIN(_boost_chrono_stopclock_accumulator_, __LINE__))
-
-#define BOOST_CHRONO_STOPCLOCK_ACCUMULATOR_FCT \
- static stopclock_accumulator<> BOOST_JOIN(_boost_chrono_stopclock_accumulator_, __LINE__)( \
- std::string(BOOST_CURRENT_FUNCTION) + ": " + stopwatch_accumulator_formatter::default_format() \
- ); \
- stopclock_accumulator<>::scoped_run BOOST_JOIN(_boost_chrono_stopclock_accumulator_run_, __LINE__)(BOOST_JOIN(_boost_chrono_stopclock_accumulator_, __LINE__))
-
-#define BOOST_CHRONO_STOPCLOCK_ACCUMULATOR_FCT_REVERSE \
- static stopclock_accumulator<> BOOST_JOIN(_boost_chrono_stopclock_accumulator_, __LINE__)( \
- std::string(BOOST_CURRENT_FUNCTION) + "(between calls): " + stopwatch_accumulator_formatter::default_format() \
- ); \
- stopclock_accumulator<>::scoped_stop BOOST_JOIN(_boost_chrono_stopclock_accumulator_stop_, __LINE__)(BOOST_JOIN(_boost_chrono_stopclock_accumulator_, __LINE__))
-
-void f1()
-{
- //~ static stopclock_accumulator<> acc(
- //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
- //~ );
- //~ stopclock_accumulator<>::scoped_run _(acc);
- BOOST_CHRONO_STOPCLOCK_ACCUMULATOR_FCT;
- //BOOST_CHRONO_STOPCLOCK_ACCUMULATOR_FCT_REVERSE;
- boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
- {
- BOOST_CHRONO_STOPCLOCK_ACCUMULATOR;
- //~ static stopclock_accumulator<> acc(
- //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
- //~ );
- //~ stopclock_accumulator<>::scoped_run _(acc);
- boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
- }
-
-}
-int main()
-{
- BOOST_CHRONO_STOPCLOCK_ACCUMULATOR_FCT;
- //~ static stopclock_accumulator<> acc(
- //~ std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] " + stopwatch_accumulator_formatter::default_format()
- //~ );
- //~ stopclock_accumulator<>::scoped_run _(acc);
-
- boost::this_thread::sleep_for(boost::chrono::milliseconds(10));
- f1();
- boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
- f1();
- boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
- f1();
- boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/scoped_stopclock_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/scoped_stopclock_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,31 +0,0 @@
-// stopclock_example.cpp ---------------------------------------------------//
-
-// Copyright 2009/2010 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopwatches.hpp>
-#include <cmath>
-
-using namespace boost::chrono;
-int f1(long j)
-{
- scoped_stopclock<> _(BOOST_CURRENT_FUNCTION);
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
-
- return 0;
-}
-int main()
-{
- scoped_stopclock<> _(BOOST_CURRENT_FUNCTION);
-
- f1(1000);
- f1(2000);
- f1(3000);
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/scoped_stopwatch_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/scoped_stopwatch_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,36 +0,0 @@
-// stopwatch_example.cpp ---------------------------------------------------//
-
-// Copyright 2009/2010 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopwatches.hpp>
-#include <cmath>
-#include "sleep_for.hpp"
-
-using namespace boost::chrono;
-long double res;
-void f1(long j)
-{
- stopwatch_reporter<stopwatch<> > _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
- for (long i =0; i< j; i+=1)
- res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) f1(j-1);
- stopwatch_reporter<stopwatch<> >::scoped_suspend s(_);
- boost::this_thread::sleep_for(boost::chrono::milliseconds(10));
-
-}
-int main()
-{
- stopwatch_reporter<stopwatch<> > _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
-
- res=0;
- for (long i =0; i< 3; ++i)
- f1(i*100);
-
- std::cout<< res << std::endl;
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/sleep_for.hpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/sleep_for.hpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,19 +0,0 @@
-#ifndef BOOST_CHRONO_SLEEP_FOR__HPP
-#define BOOST_CHRONO_SLEEP_FOR__HPP
-
-#include <boost/chrono/chrono.hpp>
-
-namespace boost {
-namespace this_thread {
-
-
-template <class Rep, class Period>
-void sleep_for(const boost::chrono::duration<Rep, Period>& d)
-{
- boost::chrono::high_resolution_clock::time_point go = boost::chrono::high_resolution_clock::now() + d;
- while (boost::chrono::high_resolution_clock::now() < go);
-}
-}
-}
-
-#endif //BOOST_CHRONO_SLEEP_FOR__HPP

Deleted: sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,100 +0,0 @@
-// stopwatch_accumulator_example.cpp ---------------------------------------------------//
-
-// Copyright 2009/2010 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopwatches.hpp>
-#include <cmath>
-#include <boost/accumulators/statistics/variance.hpp>
-
-using namespace boost::chrono;
-using namespace boost::accumulators;
-
- class my_stopwatch_accumulator_formatter {
- public:
- typedef std::string string_type;
- typedef char char_type;
- typedef std::ostream ostream_type;
-
- static ostream_type & default_os() {return std::cout;}
- static const char_type* default_format() {return "%c times, sum=%ss, mean=%as, variance=%vs\n";}
- static int default_places() { return 3; }
-
- template <class Stopwatch >
- static void show_time( Stopwatch & stopwatch_, const char_type* format,
- int places, ostream_type & os, boost::system::error_code & ec)
- {
- if (&ec != &boost::system::throws) ec.clear();
- typedef typename Stopwatch::storage_type accumulator_t;
- typedef typename Stopwatch::duration duration_t;
- accumulator_t& acc = stopwatch_.get_storage();
-
- boost::io::ios_flags_saver ifs( os );
- os.setf( std::ios_base::fixed, std::ios_base::floatfield );
- boost::io::ios_precision_saver ips( os );
- os.precision( places );
-
- for ( ; *format; ++format ) {
- if ( *format != '%' || !*(format+1) || !std::strchr("acsv", *(format+1)) ) {
- os << *format;
- } else {
- ++format;
- switch ( *format ) {
- case 's':
- os << boost::chrono::duration<double>(duration_t(sum(acc))).count();
- break;
- case 'a':
- os << count(acc)>0?boost::chrono::duration<double>(duration_t(typename duration_t::rep(sum(acc)))).count()/count(acc):0;
- break;
- case 'c':
- os << count(acc);
- break;
- case 'v':
- os << boost::chrono::duration<double>(duration_t(typename duration_t::rep(variance(acc)))).count();
- break;
- default:
- assert(0 && "my_stopwatch_accumulator_formatter internal logic error");
- }
- }
- }
- }
- };
-
-
-typedef stopwatch_reporter<
- stopwatch_accumulator<process_real_cpu_clock,
- features<
- tag::count,
- tag::sum,
- tag::mean,
- tag::variance(lazy)
- >
- >
- , my_stopwatch_accumulator_formatter
- > my_stopwatch_accumulator_reporter;
-
-int f1(long j)
-{
- //static my_stopwatch_accumulator_reporter acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
- static my_stopwatch_accumulator_reporter acc;
- my_stopwatch_accumulator_reporter::scoped_run _(acc);
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
-
- return 0;
-}
-int main()
-{
- static my_stopwatch_accumulator_reporter acc;
-
- f1(1000);
- f1(2000);
- f1(3000);
- return 0;
-}
-

Deleted: sandbox/chrono/libs/chrono/example/stopclock_accumulator_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/stopclock_accumulator_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,40 +0,0 @@
-// stopwatch_accumulator_example.cpp ---------------------------------------------------//
-
-// Copyright 2009 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopclock_accumulator.hpp>
-//#include <boost/chrono/stopwatches.hpp>
-
-#include <cmath>
-//#include <boost/thread.hpp>
-#include "sleep_for.hpp"
-
-using namespace boost::chrono;
-template <typename Clock>
-int f1(long j)
-{
- static stopclock_accumulator<Clock> acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
- typename stopclock_accumulator<Clock>::scoped_run _(acc);
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
- boost::this_thread::sleep_for(boost::chrono::milliseconds(20));
-
-
- return 0;
-}
-int main()
-{
- static stopclock_accumulator<process_cpu_clock> acc(BOOST_CHRONO_ACCUMULATOR_TIME_FUNCTION_FORMAT);
- stopclock_accumulator<process_cpu_clock>::scoped_run _(acc);
-
- f1<high_resolution_clock>(1000);
- f1<high_resolution_clock>(2000);
- f1<high_resolution_clock>(3000);
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/stopclock_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/stopclock_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,31 +0,0 @@
-// stopclock_example.cpp ---------------------------------------------------//
-
-// Copyright 2009 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopclock.hpp>
-#include <cmath>
-
-using namespace boost::chrono;
-int f1(long j)
-{
- stopclock<> _(BOOST_CHRONO_TIME_FUNCTION_FORMAT);
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
-
- return 0;
-}
-int main()
-{
- stopclock<> _(BOOST_CHRONO_TIME_FUNCTION_FORMAT);
-
- f1(1000);
- f1(2000);
- f1(3000);
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/stopwatch_accumulator_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/stopwatch_accumulator_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,32 +0,0 @@
-// stopwatch_accumulator_example.cpp ---------------------------------------------------//
-
-// Copyright 2009/2010 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopwatches.hpp>
-#include <cmath>
-
-
-using namespace boost::chrono;
-int f1(long j)
-{
- static stopwatch_reporter<stopwatch_accumulator<process_real_cpu_clock> > acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
- stopwatch_reporter<stopwatch_accumulator<process_real_cpu_clock> >::scoped_run _(acc);
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
-
- return 0;
-}
-int main()
-{
-
- f1(1000);
- f1(2000);
- f1(3000);
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/stopwatch_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/stopwatch_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,32 +0,0 @@
-// stopwatch_example.cpp ---------------------------------------------------//
-
-// Copyright Beman Dawes 2006, 2008
-// Copyright 2009/2010 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopwatches.hpp>
-#include <cmath>
-
-using namespace boost::chrono;
-int f1(long j)
-{
- stopwatch_reporter<stopwatch<> > _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
-
- return 0;
-}
-int main()
-{
- stopwatch_reporter<stopwatch<> > _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
-
- f1(1000);
- f1(2000);
- f1(3000);
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/suspendible_stopclock_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/suspendible_stopclock_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,40 +0,0 @@
-// stopclock_example.cpp ---------------------------------------------------//
-
-// Copyright 2009 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/thread.hpp>
-#include <boost/chrono/stopclock.hpp>
-#include <boost/chrono/suspendible_clock.hpp>
-#include <cmath>
-
-using namespace boost::chrono;
-long double res;
-
-int f1(long j)
-{
- stopclock<suspendible_clock<high_resolution_clock> > a(9);
- //stopclock<high_resolution_clock> b(9);
-
- for ( int i = 0; i < j; ++i )
- res+=std::sqrt( res+123.456L+i ); // burn some time
- if (j!=0) f1(j-1);
- //boost::this_thread::sleep(boost::posix_time::milliseconds(10));
- return 0;
-}
-int main()
-{
- //stopclock<> _(BOOST_CHRONO_TIME_FUNCTION_FORMAT);
- //stopclock<> _(9);
- stopclock<suspendible_clock<high_resolution_clock> > a(9);
- //stopclock<high_resolution_clock> b(9);
-
- for (int i =1; i<= 3; ++i)
- f1(i*100);
- std::cout<< res << std::endl;
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/example/t24_hours_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/t24_hours_example.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,36 +0,0 @@
-// t24_hours_example.cpp ---------------------------------------------------//
-
-// Copyright Beman Dawes 2006, 2008
-// Copyright 2009 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopwatch.hpp>
-#include <boost/chrono/stopwatch_reporter.hpp>
-#include <boost/chrono/process_cpu_clocks.hpp>
-#include <boost/chrono/t24_hours_formatter.hpp>
-#include <cmath>
-
-using namespace boost::chrono;
-int f1(long j)
-{
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss(BOOST_CHRONO_24_HOURS_FUNCTION_FORMAT);
- //stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss;
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
-
- return 0;
-}
-int main()
-{
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss(BOOST_CHRONO_24_HOURS_FUNCTION_FORMAT);
-
- f1(1000);
- f1(2000);
- f1(3000);
- return 0;
-}

Deleted: sandbox/chrono/libs/chrono/test/stopclock_constructor_overload_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/stopclock_constructor_overload_test.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,76 +0,0 @@
-// boost stopclock_constructor_overload_test.cpp -----------------------------------------------------//
-
-// Copyright Beman Dawes 2006, 2008
-// Copyright 2009 Vicente J. Botet Escriba
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopclock.hpp>
-#include <cstdlib> // for atol()
-#include <iostream>
-#include <sstream>
-#include <locale>
-#include <ctime>
-#include <cmath> // for sqrt(), used to burn time
-
-using boost::chrono::stopclock;
-using boost::chrono::time_formatter;
-using boost::system::error_code;
-
-#include <boost/test/minimal.hpp>
-
-namespace
-{
-
- void stopclock_constructor_overload_test()
- {
- // exercise each supported combination of constructor arguments
-
- std::ostream & os = std::cout;
- const int pl = 9;
- boost::system::error_code ec;
-
- stopclock<> t1;
- stopclock<> t2( os );
- stopclock<> t3( ec );
- stopclock<> t4( os, ec );
- stopclock<> t5( pl );
- stopclock<> t6( os, pl );
- stopclock<> t7( pl, ec );
- stopclock<> t8( os, pl, ec );
- stopclock<> t9( "t9, default places, r %r, c %c, p %p, u %u, s %s\n" );
- stopclock<> t10( os, "t10, default places, r %r, c %c, p %p, u %u, s %s\n" );
- stopclock<> t11( "t11, default places, r %r, c %c, p %p, u %u, s %s\n", ec );
- stopclock<> t12( os, "t12, default places, r %r, c %c, p %p, u %u, s %s\n", ec );
- stopclock<> t13( pl, "t13, explicitly code places, r %r, c %c, p %p, u %u, s %s\n" );
- stopclock<> t14( "t14, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl );
- stopclock<> t15( os, pl, "t15, explicitly code places, r %r, c %c, p %p, u %u, s %s\n" );
- stopclock<> t16( os, "t16, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl );
- stopclock<> t17( pl, "t17, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", ec );
- stopclock<> t18( "t18, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl, ec );
- stopclock<> t19( os, pl, "t19, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", ec );
- stopclock<> t20( os, "t20, explicitly code places, r %r, c %c, p %p, u %u, s %s\n", pl, ec );
-
- std::cout << "Burn some time so run_timers have something to report...";
- boost::chrono::stopwatch<boost::chrono::high_resolution_clock> t;
- while ( t.elapsed() < boost::chrono::seconds(1) ) {}
- std::cout << "\n";
- std::cout << time_formatter::default_places() << " default places\n";
- std::cout << pl << " explicitly coded places\n";
- }
-
-}
-
-int test_main( int /*argc*/, char * /*argv*/[] )
-{
- std::locale loc( "" ); // test with appropriate locale
- std::cout.imbue( loc );
-
- stopclock_constructor_overload_test();
-
- return 0;
-}
-

Deleted: sandbox/chrono/libs/chrono/test/wstopclock_constructor_overload_test.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/test/wstopclock_constructor_overload_test.cpp 2010-09-03 15:37:42 EDT (Fri, 03 Sep 2010)
+++ (empty file)
@@ -1,137 +0,0 @@
-// boost run_timer_test.cpp -----------------------------------------------------//
-
-// Copyright Beman Dawes 2006, 2008
-// Copyright 2009 Vicente J. Botet Escriba
-// Copyright 2010 Tan Zhi(Tom)
-
-// Distributed under the Boost Software License, Version 1.0.
-// See http://www.boost.org/LICENSE_1_0.txt
-
-// See http://www.boost.org/libs/chrono for documentation.
-
-#include <boost/chrono/stopclock.hpp>
-#include <boost/chrono/process_cpu_clocks.hpp>
-#include <boost/chrono/stopwatch.hpp>
-
-#include <cstdlib> // for atol()
-#include <iostream>
-#include <sstream>
-#include <locale>
-#include <ctime>
-#include <cmath> // for sqrt(), used to burn time
-
-#include <string>
-
-using boost::chrono::stopwatch;
-using boost::chrono::stopclock;
-using boost::chrono::process_cpu_clock;
-using boost::chrono::wtime_formatter;
-using boost::chrono::time_formatter;
-using boost::system::error_code;
-using boost::chrono::detail::adaptive_string;
-#include <boost/test/minimal.hpp>
-
-
-namespace util
-{
-
- /**
- * this class return std::cout or std::wcout according to
- * the context(e.g. type on the left side of '=' operator)
- */
- struct console
- {
-
- template <
- typename Traits
- >
- operator std::basic_ostream<char,Traits>&() const
- {
- return std::cout;
- }
-#ifndef BOOST_NO_STD_WSTRING
- template <
- typename Traits
- >
- operator std::basic_ostream<wchar_t,Traits>&() const
- {
- return std::wcout;
- }
-#endif
- };
-
-} // namespace util
-
-
- // overload adaptive_string for streaming operation with cout/wcout
- template<class charT>
- std::basic_ostream<charT>& operator << (std::basic_ostream<charT>& os, const boost::chrono::detail::adaptive_string& s)
- {
- os << std::basic_string<charT>(s);
- return os;
- }
-
-
-namespace
-{
- using namespace util;
-
- template<class stopclock_type>
- void stopclock_constructor_overload_test()
- {
- // exercise each supported combination of constructor arguments
-
- typename stopclock_type::ostream_type& os = console();
- const int pl = 9;
- boost::system::error_code ec;
-
- stopclock_type t1;
- stopclock_type t2( os );
- stopclock_type t3( ec );
- stopclock_type t4( os, ec );
- stopclock_type t5( pl );
- stopclock_type t6( os, pl );
- stopclock_type t7( pl, ec );
- stopclock_type t8( os, pl, ec );
- stopclock_type t9( adaptive_string("t9, default places, r %r, c %c, p %p, u %u, s %s\n") );
- stopclock_type t10( os, adaptive_string("t10, default places, r %r, c %c, p %p, u %u, s %s\n") );
- stopclock_type t11( adaptive_string("t11, default places, r %r, c %c, p %p, u %u, s %s\n"), ec );
- stopclock_type t12( os, adaptive_string("t12, default places, r %r, c %c, p %p, u %u, s %s\n"), ec );
- stopclock_type t13( pl, adaptive_string("t13, explicitly code places, r %r, c %c, p %p, u %u, s %s\n") );
- stopclock_type t14( adaptive_string("t14, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl );
- stopclock_type t15( os, pl, adaptive_string("t15, explicitly code places, r %r, c %c, p %p, u %u, s %s\n") );
- stopclock_type t16( os, adaptive_string("t16, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl );
- stopclock_type t17( pl, adaptive_string("t17, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), ec );
- stopclock_type t18( adaptive_string("t18, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl, ec );
- stopclock_type t19( os, pl, adaptive_string("t19, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), ec );
- stopclock_type t20( os, adaptive_string("t20, explicitly code places, r %r, c %c, p %p, u %u, s %s\n"), pl, ec );
-
- std::cout << adaptive_string("Burn some time so run_timers have something to report...");
-
- boost::chrono::stopwatch<boost::chrono::high_resolution_clock> t;
- while ( t.elapsed() < boost::chrono::seconds(1) ) {}
-
- std::cout << adaptive_string("\n");
- std::cout << time_formatter::default_places() << adaptive_string(" default places\n");
- std::cout << pl << adaptive_string(" explicitly coded places\n");
- }
-
- typedef stopclock <> stopclock_t;
- typedef stopclock <
- process_cpu_clock,
- boost::chrono::wtime_formatter
- > wstopclock_t;
-}
-
-int test_main( int /*argc*/, char * /*argv*/[] )
-{
- std::locale loc( "" ); // test with appropriate locale
- std::cout.imbue( loc );
-
- stopclock_constructor_overload_test<stopclock_t>(); // test for char
-#ifndef BOOST_NO_STD_WSTRING
- stopclock_constructor_overload_test<wstopclock_t>(); // test for wchar_t
-#endif
- return 0;
-}
-


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