|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64876 - sandbox/chrono/libs/chrono/example
From: vicente.botet_at_[hidden]
Date: 2010-08-17 19:52:52
Author: viboes
Date: 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
New Revision: 64876
URL: http://svn.boost.org/trac/boost/changeset/64876
Log:
* Reorganize default formatter
Text files modified:
sandbox/chrono/libs/chrono/example/run_timer_example.cpp | 3 ++-
sandbox/chrono/libs/chrono/example/run_timer_example2.cpp | 2 +-
sandbox/chrono/libs/chrono/example/scoped_stopclock_example.cpp | 8 ++++----
sandbox/chrono/libs/chrono/example/scoped_stopwatch_example.cpp | 11 +++++------
sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp | 28 ++++++++--------------------
sandbox/chrono/libs/chrono/example/stopwatch_accumulator_example.cpp | 12 ++++++------
sandbox/chrono/libs/chrono/example/stopwatch_example.cpp | 15 ++++++++-------
sandbox/chrono/libs/chrono/example/t24_hours_example.cpp | 7 ++++---
8 files changed, 38 insertions(+), 48 deletions(-)
Modified: sandbox/chrono/libs/chrono/example/run_timer_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/run_timer_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/run_timer_example.cpp 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
@@ -1,6 +1,7 @@
// run_timer_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
@@ -14,7 +15,7 @@
{
boost::chrono::run_timer t;
- for ( long i = 0; i < 10000000; ++i )
+ for ( long i = 0; i < 10000; ++i )
std::sqrt( 123.456L ); // burn some time
return 0;
Modified: sandbox/chrono/libs/chrono/example/run_timer_example2.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/run_timer_example2.cpp (original)
+++ sandbox/chrono/libs/chrono/example/run_timer_example2.cpp 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
@@ -17,7 +17,7 @@
boost::chrono::run_timer t( format, places );
- for ( long i = 0; i < 10000000; ++i )
+ for ( long i = 0; i < 10000; ++i )
std::sqrt( 123.456L ); // burn some time
return 0;
Modified: sandbox/chrono/libs/chrono/example/scoped_stopclock_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/scoped_stopclock_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/scoped_stopclock_example.cpp 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
@@ -1,19 +1,19 @@
// stopclock_example.cpp ---------------------------------------------------//
-// Copyright 2009 Vicente J. Botet Escriba
+// 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/scoped_stopclock.hpp>
+#include <boost/chrono/stopwatches.hpp>
#include <cmath>
using namespace boost::chrono;
int f1(long j)
{
- scoped_stopclock<> _(BOOST_CURRENT_FUNCTION);
+ scoped_stopclock<> _(BOOST_CURRENT_FUNCTION);
for ( long i = 0; i < j; ++i )
std::sqrt( 123.456L ); // burn some time
@@ -22,7 +22,7 @@
}
int main()
{
- scoped_stopclock<> _(BOOST_CURRENT_FUNCTION);
+ scoped_stopclock<> _(BOOST_CURRENT_FUNCTION);
f1(1000);
f1(2000);
Modified: sandbox/chrono/libs/chrono/example/scoped_stopwatch_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/scoped_stopwatch_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/scoped_stopwatch_example.cpp 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
@@ -1,32 +1,31 @@
// stopwatch_example.cpp ---------------------------------------------------//
-// Copyright 2009 Vicente J. Botet Escriba
+// 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/stopwatch.hpp>
+#include <boost/chrono/stopwatches.hpp>
#include <cmath>
-//#include <boost/thread.hpp>
#include "sleep_for.hpp"
using namespace boost::chrono;
double res;
void f1(long j)
{
- stopwatch<>::reporter _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
+ 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::scoped_suspend s(_);
+ stopwatch_reporter<stopwatch<> >::scoped_suspend s(_);
boost::this_thread::sleep_for(boost::chrono::milliseconds(10));
}
int main()
{
- stopwatch<>::reporter _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
+ stopwatch_reporter<stopwatch<> > _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
res=0;
for (long i =0; i< 3; ++i)
Modified: sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
@@ -1,6 +1,6 @@
// stopwatch_accumulator_example.cpp ---------------------------------------------------//
-// Copyright 2009 Vicente J. Botet Escriba
+// 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
@@ -65,31 +65,19 @@
typedef stopwatch_reporter<
- stopwatch_accumulator<process_real_cpu_clock,
- accumulator_set<process_real_cpu_clock::rep,
- features<
+ stopwatch_accumulator<process_real_cpu_clock,
+ accumulator_set<process_real_cpu_clock::rep,
+ features<
tag::count,
tag::sum,
tag::mean,
tag::variance(lazy)
+ >
>
>
- >
, my_stopwatch_accumulator_formatter
> my_stopwatch_accumulator_reporter;
-typedef stopwatch_accumulator<process_real_cpu_clock,
- accumulator_set<process_real_cpu_clock::rep,
- features<
- tag::count,
- tag::sum,
- tag::mean,
- tag::variance(lazy)
- >
- >
- >::get_reporter< my_stopwatch_accumulator_formatter>::type
- my_stopwatch_accumulator_reporter2;
-
int f1(long j)
{
//static my_stopwatch_accumulator_reporter acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
@@ -105,9 +93,9 @@
{
static my_stopwatch_accumulator_reporter acc;
- f1(100000);
- f1(200000);
- f1(300000);
+ f1(1000);
+ f1(2000);
+ f1(3000);
return 0;
}
Modified: sandbox/chrono/libs/chrono/example/stopwatch_accumulator_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/stopwatch_accumulator_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/stopwatch_accumulator_example.cpp 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
@@ -1,6 +1,6 @@
// stopwatch_accumulator_example.cpp ---------------------------------------------------//
-// Copyright 2009 Vicente J. Botet Escriba
+// 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
@@ -14,8 +14,8 @@
using namespace boost::chrono;
int f1(long j)
{
- static stopwatch_accumulator<process_real_cpu_clock>::reporter acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
- stopwatch_accumulator<process_real_cpu_clock>::reporter::scoped_run _(acc);
+ 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
@@ -25,8 +25,8 @@
int main()
{
- f1(100000);
- f1(200000);
- f1(300000);
+ f1(1000);
+ f1(2000);
+ f1(3000);
return 0;
}
Modified: sandbox/chrono/libs/chrono/example/stopwatch_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/stopwatch_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/stopwatch_example.cpp 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
@@ -1,20 +1,21 @@
// 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/stopwatch.hpp>
+#include <boost/chrono/stopwatches.hpp>
#include <cmath>
using namespace boost::chrono;
int f1(long j)
{
- stopwatch<>::reporter _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
-
+ stopwatch_reporter<stopwatch<> > _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
+
for ( long i = 0; i < j; ++i )
std::sqrt( 123.456L ); // burn some time
@@ -22,10 +23,10 @@
}
int main()
{
- stopwatch<>::reporter _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
+ stopwatch_reporter<stopwatch<> > _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
- f1(100000);
- f1(200000);
- f1(300000);
+ f1(1000);
+ f1(2000);
+ f1(3000);
return 0;
}
Modified: sandbox/chrono/libs/chrono/example/t24_hours_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/t24_hours_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/t24_hours_example.cpp 2010-08-17 19:52:50 EDT (Tue, 17 Aug 2010)
@@ -1,6 +1,7 @@
// 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
@@ -28,8 +29,8 @@
{
stopwatch_reporter<stopwatch<process_real_cpu_clock>, t24_hours_formatter> hhmmss(BOOST_CHRONO_24_HOURS_FUNCTION_FORMAT);
- f1(100000);
- f1(200000);
- f1(300000);
+ f1(1000);
+ f1(2000);
+ f1(3000);
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