Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74633 - trunk/libs/chrono/example
From: vicente.botet_at_[hidden]
Date: 2011-10-01 17:27:10


Author: viboes
Date: 2011-10-01 17:27:09 EDT (Sat, 01 Oct 2011)
New Revision: 74633
URL: http://svn.boost.org/trac/boost/changeset/74633

Log:
Chrono: remove not useful lightweight_stopwatch_reporter
Removed:
   trunk/libs/chrono/example/lightweight_stopwatch_reporter_example.cpp
Text files modified:
   trunk/libs/chrono/example/io_ex1.cpp | 4 ++++
   trunk/libs/chrono/example/rounding.cpp | 35 +++++++++++++++++++++++++----------
   2 files changed, 29 insertions(+), 10 deletions(-)

Modified: trunk/libs/chrono/example/io_ex1.cpp
==============================================================================
--- trunk/libs/chrono/example/io_ex1.cpp (original)
+++ trunk/libs/chrono/example/io_ex1.cpp 2011-10-01 17:27:09 EDT (Sat, 01 Oct 2011)
@@ -13,8 +13,10 @@
 */
 
 #include <iostream>
+#include <boost/chrono/config.hpp>
 #include <boost/chrono/chrono_io.hpp>
 #include <boost/chrono/thread_clock.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
 
 int main()
 {
@@ -56,9 +58,11 @@
 #if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
     cout << "\nthread_clock::now() = " << thread_clock::now() << '\n';
 #endif
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
     cout << "\nprocess_real_cpu_clock::now() = " << process_real_cpu_clock::now() << '\n';
     cout << "\nprocess_user_cpu_clock::now() = " << process_user_cpu_clock::now() << '\n';
     cout << "\nprocess_system_cpu_clock::now() = " << process_system_cpu_clock::now() << '\n';
     cout << "\nprocess_cpu_clock::now() = " << process_cpu_clock::now() << '\n';
+#endif
     return 0;
 }

Deleted: trunk/libs/chrono/example/lightweight_stopwatch_reporter_example.cpp
==============================================================================
--- trunk/libs/chrono/example/lightweight_stopwatch_reporter_example.cpp 2011-10-01 17:27:09 EDT (Sat, 01 Oct 2011)
+++ (empty file)
@@ -1,47 +0,0 @@
-// example/stopwatch_example.cpp ---------------------------------------------------//
-// Copyright Beman Dawes 2006, 2008
-// Copyright 2009-2011 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/stopwatches for documentation.
-
-//#include <iostream>
-#include <boost/chrono/stopwatches/basic_stopwatch.hpp>
-#include <boost/chrono/stopwatches/reporters/lightweight_stopwatch_reporter.hpp>
-#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
-#include <boost/chrono/chrono_io.hpp>
-#include <cmath>
-
-using namespace boost::chrono;
-
-elapsed_formatter fmtr;
-
-int f1(long j)
-{
-
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
- lightweight_stopwatch_reporter<simple_stopwatch<> > sw(fmtr);
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
-
- for ( long i = 0; i < j; ++i )
- std::sqrt( 123.456L ); // burn some time
-
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
- return 0;
-}
-int main()
-{
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
- lightweight_stopwatch_reporter<simple_stopwatch<> > sw(fmtr);
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
-
- f1(1000);
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
- f1(2000);
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
- f1(3000);
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
- f1(4000);
- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
- return 0;
-}

Modified: trunk/libs/chrono/example/rounding.cpp
==============================================================================
--- trunk/libs/chrono/example/rounding.cpp (original)
+++ trunk/libs/chrono/example/rounding.cpp 2011-10-01 17:27:09 EDT (Sat, 01 Oct 2011)
@@ -8,7 +8,7 @@
 // Adapted to Boost from the original Hawards's code
 
 #include <iostream>
-#include <boost/chrono/chrono_io.hpp>
+//#include <boost/chrono/chrono_io.hpp>
 #include <boost/chrono/floor.hpp>
 #include <boost/chrono/round.hpp>
 #include <boost/chrono/ceil.hpp>
@@ -16,14 +16,29 @@
 int main()
 {
   boost::chrono::milliseconds ms(2500);
- std::cout << boost::chrono::floor<boost::chrono::seconds>(ms) << '\n';
- std::cout << boost::chrono::round<boost::chrono::seconds>(ms) << '\n';
- std::cout << boost::chrono::ceil<boost::chrono::seconds>(ms) << '\n';
- ms = boost::chrono::milliseconds(2516);
- typedef boost::chrono::duration<long, boost::ratio<1, 30> > frame_rate;
- std::cout << boost::chrono::floor<frame_rate>(ms) << '\n';
- std::cout << boost::chrono::round<frame_rate>(ms) << '\n';
- std::cout << boost::chrono::ceil<frame_rate>(ms) << '\n';
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::floor<boost::chrono::seconds>(ms).count()
+ << " seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::round<boost::chrono::seconds>(ms).count()
+ << " seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::ceil<boost::chrono::seconds>(ms).count()
+ << " seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ ms = boost::chrono::milliseconds(2516);
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ typedef boost::chrono::duration<long, boost::ratio<1, 30> > frame_rate;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::floor<frame_rate>(ms).count()
+ << " [1/30] seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::round<frame_rate>(ms).count()
+ << " [1/30] seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
+ std::cout << boost::chrono::ceil<frame_rate>(ms).count()
+ << " [1/30] seconds\n";
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
 
- return 0;
+ 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