Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59080 - in sandbox/chrono/libs/chrono: example test
From: vicente.botet_at_[hidden]
Date: 2010-01-16 12:58:38


Author: viboes
Date: 2010-01-16 12:58:37 EST (Sat, 16 Jan 2010)
New Revision: 59080
URL: http://svn.boost.org/trac/boost/changeset/59080

Log:
Boost.Chrono: Version 0.3.0,
* Added function_stopclock test
* usage of formatter macros using the current function
* Split of stopclock_example.cpp on several files
* Code cleanup
* revert to old interface process_times
Added:
   sandbox/chrono/libs/chrono/example/function_stopclock_example.cpp (contents, props changed)
Text files modified:
   sandbox/chrono/libs/chrono/example/digital_time_example.cpp | 6 +++---
   sandbox/chrono/libs/chrono/example/stopclock_example.cpp | 4 ++--
   sandbox/chrono/libs/chrono/example/stopwatch_accumulator_example.cpp | 3 +--
   sandbox/chrono/libs/chrono/example/stopwatch_example.cpp | 4 ++--
   sandbox/chrono/libs/chrono/test/Jamfile.v2 | 2 ++
   5 files changed, 10 insertions(+), 9 deletions(-)

Modified: sandbox/chrono/libs/chrono/example/digital_time_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/digital_time_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/digital_time_example.cpp 2010-01-16 12:58:37 EST (Sat, 16 Jan 2010)
@@ -13,11 +13,11 @@
 #include <boost/chrono/digital_time_formatter.hpp>
 #include <cmath>
 
-
 using namespace boost::chrono;
 int f1(long j)
 {
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss;
+ stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss(BOOST_CHRONO_DIGITAL_TIME_FUNCTION_FORMAT);
+ //stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss;
 
   for ( long i = 0; i < j; ++i )
     std::sqrt( 123.456L ); // burn some time
@@ -26,7 +26,7 @@
 }
 int main()
 {
- stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss();
+ stopwatch_reporter<stopwatch<process_real_cpu_clock>, digital_time_formatter> hhmmss(BOOST_CHRONO_DIGITAL_TIME_FUNCTION_FORMAT);
 
   f1(100000);
   f1(200000);

Added: sandbox/chrono/libs/chrono/example/function_stopclock_example.cpp
==============================================================================
--- (empty file)
+++ sandbox/chrono/libs/chrono/example/function_stopclock_example.cpp 2010-01-16 12:58:37 EST (Sat, 16 Jan 2010)
@@ -0,0 +1,31 @@
+// stopclock_example.cpp ---------------------------------------------------//
+
+// Copyright Beman Dawes 2006, 2008
+
+// 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/function_stopclock.hpp>
+#include <cmath>
+
+using namespace boost::chrono;
+int f1(long j)
+{
+ function_stopclock<> _(BOOST_CURRENT_FUNCTION);
+
+ for ( long i = 0; i < j; ++i )
+ std::sqrt( 123.456L ); // burn some time
+
+ return 0;
+}
+int main()
+{
+ function_stopclock<> _(BOOST_CURRENT_FUNCTION);
+
+ f1(100000);
+ f1(200000);
+ f1(300000);
+ return 0;
+}

Modified: sandbox/chrono/libs/chrono/example/stopclock_example.cpp
==============================================================================
--- sandbox/chrono/libs/chrono/example/stopclock_example.cpp (original)
+++ sandbox/chrono/libs/chrono/example/stopclock_example.cpp 2010-01-16 12:58:37 EST (Sat, 16 Jan 2010)
@@ -13,7 +13,7 @@
 using namespace boost::chrono;
 int f1(long j)
 {
- stopclock<> _;
+ stopclock<> _(BOOST_CHRONO_TIME_FUNCTION_FORMAT);
 
   for ( long i = 0; i < j; ++i )
     std::sqrt( 123.456L ); // burn some time
@@ -22,7 +22,7 @@
 }
 int main()
 {
- stopclock<> _("\nmain %ds\n");
+ stopclock<> _(BOOST_CHRONO_TIME_FUNCTION_FORMAT);
 
   f1(100000);
   f1(200000);

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-01-16 12:58:37 EST (Sat, 16 Jan 2010)
@@ -15,8 +15,7 @@
 using namespace boost::chrono;
 int f1(long j)
 {
- static stopwatch_accumulator<process_real_cpu_clock>::reporter acc(
- "\nf1 Count=%c times Sum=%ss Min=%ms Max=%Ms Mean=%as\n");
+ static stopwatch_accumulator<process_real_cpu_clock>::reporter acc(BOOST_CHRONO_ACCUMULATOR_FUNCTION_FORMAT);
   stopwatch_accumulator<process_real_cpu_clock>::reporter::scoped_run _(acc);
 
   for ( long i = 0; i < j; ++i )

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-01-16 12:58:37 EST (Sat, 16 Jan 2010)
@@ -13,7 +13,7 @@
 using namespace boost::chrono;
 int f1(long j)
 {
- stopwatch<>::reporter x("\nf1 %ds\n");
+ stopwatch<>::reporter _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
   
   for ( long i = 0; i < j; ++i )
     std::sqrt( 123.456L ); // burn some time
@@ -22,7 +22,7 @@
 }
 int main()
 {
- stopwatch<>::reporter _("\nMain %ds\n");
+ stopwatch<>::reporter _(BOOST_CHRONO_STOPWATCH_FUNCTION_FORMAT);
 
   f1(100000);
   f1(200000);

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-16 12:58:37 EST (Sat, 16 Jan 2010)
@@ -98,4 +98,6 @@
         [ run ../example/stopclock_example.cpp : : : <library>/boost/system//boost_system : stopclock_example_dll ]
         [ run ../example/digital_time_example.cpp : : : <link>static ]
         [ run ../example/digital_time_example.cpp : : : <library>/boost/system//boost_system : digital_time_example_dll ]
+ [ run ../example/function_stopclock_example.cpp : : : <link>static ]
+ [ run ../example/function_stopclock_example.cpp : : : <library>/boost/system//boost_system : function_stopclock_example_dll ]
         ;
\ No newline at end of file


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