Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59169 - in sandbox/chrono/libs/chrono: example test
From: vicente.botet_at_[hidden]
Date: 2010-01-20 18:09:11


Author: viboes
Date: 2010-01-20 18:09:10 EST (Wed, 20 Jan 2010)
New Revision: 59169
URL: http://svn.boost.org/trac/boost/changeset/59169

Log:
Boost.Chrono: Version 0.3.2,
* Added example/specific_stopwatch_accumulator_example.cpp
Added:
   sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp (contents, props changed)
Text files modified:
   sandbox/chrono/libs/chrono/test/Jamfile.v2 | 2 ++
   1 files changed, 2 insertions(+), 0 deletions(-)

Added: sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/specific_stopwatch_accumulator_example.cpp 2010-01-20 18:09:10 EST (Wed, 20 Jan 2010)
@@ -0,0 +1,46 @@
+// 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/stopwatches.hpp>
+#include <cmath>
+
+
+using namespace boost::chrono;
+using namespace boost::accumulators;
+typedef stopwatch_accumulator<process_real_cpu_clock,
+ accumulator_set<process_real_cpu_clock::rep,
+ features<
+ tag::count,
+ tag::sum,
+ tag::min,
+ tag::max,
+ tag::mean
+ >
+ >
+ >::reporter my_stopwatch_accumulator_reporter;
+
+int f1(long j)
+{
+ static my_stopwatch_accumulator_reporter acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
+ 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()
+{
+
+ f1(100000);
+ f1(200000);
+ f1(300000);
+ return 0;
+}
+

Modified: sandbox/chrono/libs/chrono/test/Jamfile.v2
==============================================================================
--- sandbox/chrono/libs/chrono/test/Jamfile.v2 (original)
+++ sandbox/chrono/libs/chrono/test/Jamfile.v2 2010-01-20 18:09:10 EST (Wed, 20 Jan 2010)
@@ -94,6 +94,8 @@
         [ run ../example/stopwatch_example.cpp : : : <library>/boost/system//boost_system : stopwatch_example_dll ]
         [ run ../example/stopwatch_accumulator_example.cpp : : : <link>static ]
         [ run ../example/stopwatch_accumulator_example.cpp : : : <library>/boost/system//boost_system : stopwatch_accumulator_example_dll ]
+ [ run ../example/specific_stopwatch_accumulator_example.cpp : : : <link>static ]
+ [ run ../example/specific_stopwatch_accumulator_example.cpp : : : <library>/boost/system//boost_system : specific_stopwatch_accumulator_example_dll ]
         [ run ../example/stopclock_example.cpp : : : <link>static ]
         [ run ../example/stopclock_example.cpp : : : <library>/boost/system//boost_system : stopclock_example_dll ]
         [ run ../example/stopclock_accumulator_example.cpp : : : <link>static ]


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