Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74848 - in branches/release: boost boost/timer libs/timer libs/timer/build libs/timer/doc libs/timer/example libs/timer/src libs/timer/test libs/timer/test/msvc10 libs/timer/test/msvc10/chrono_dll libs/timer/test/msvc10/chrono_dll/Debug libs/timer/test/msvc10/cpu_timer_test libs/timer/test/msvc10/cpu_timer_test/Debug libs/timer/test/msvc10/system_dll libs/timer/test/msvc10/timer_dll
From: bdawes_at_[hidden]
Date: 2011-10-09 08:17:52


Author: bemandawes
Date: 2011-10-09 08:17:51 EDT (Sun, 09 Oct 2011)
New Revision: 74848
URL: http://svn.boost.org/trac/boost/changeset/74848

Log:
Merge Boost.Timer version 2
Added:
   branches/release/boost/timer/config.hpp (contents, props changed)
   branches/release/boost/timer/timer.hpp (contents, props changed)
   branches/release/libs/timer/build/ (props changed)
      - copied from r74846, /trunk/libs/timer/build/
   branches/release/libs/timer/build/Jamfile.v2
      - copied unchanged from r74846, /trunk/libs/timer/build/Jamfile.v2
   branches/release/libs/timer/doc/ (props changed)
      - copied from r74846, /trunk/libs/timer/doc/
   branches/release/libs/timer/doc/cpu_timers.html
      - copied unchanged from r74846, /trunk/libs/timer/doc/cpu_timers.html
   branches/release/libs/timer/doc/index.html
      - copied unchanged from r74846, /trunk/libs/timer/doc/index.html
   branches/release/libs/timer/doc/original_timer.html
      - copied unchanged from r74846, /trunk/libs/timer/doc/original_timer.html
   branches/release/libs/timer/example/ (props changed)
      - copied from r74846, /trunk/libs/timer/example/
   branches/release/libs/timer/example/auto_cpu_timer_example.cpp
      - copied unchanged from r74846, /trunk/libs/timer/example/auto_cpu_timer_example.cpp
   branches/release/libs/timer/example/timex.cpp
      - copied unchanged from r74846, /trunk/libs/timer/example/timex.cpp
   branches/release/libs/timer/src/ (props changed)
      - copied from r74846, /trunk/libs/timer/src/
   branches/release/libs/timer/src/auto_timers_construction.cpp
      - copied unchanged from r74846, /trunk/libs/timer/src/auto_timers_construction.cpp
   branches/release/libs/timer/src/cpu_timer.cpp
      - copied unchanged from r74846, /trunk/libs/timer/src/cpu_timer.cpp
   branches/release/libs/timer/test/cpu_timer_info.cpp
      - copied unchanged from r74846, /trunk/libs/timer/test/cpu_timer_info.cpp
   branches/release/libs/timer/test/cpu_timer_test.cpp
      - copied unchanged from r74846, /trunk/libs/timer/test/cpu_timer_test.cpp
   branches/release/libs/timer/test/msvc10/ (props changed)
      - copied from r74846, /trunk/libs/timer/test/msvc10/
   branches/release/libs/timer/test/msvc10/chrono_dll/ (props changed)
      - copied from r74846, /trunk/libs/timer/test/msvc10/chrono_dll/
   branches/release/libs/timer/test/msvc10/chrono_dll/Debug/ (props changed)
      - copied from r74846, /trunk/libs/timer/test/msvc10/chrono_dll/Debug/
   branches/release/libs/timer/test/msvc10/chrono_dll/chrono_dll.vcxproj
      - copied unchanged from r74846, /trunk/libs/timer/test/msvc10/chrono_dll/chrono_dll.vcxproj
   branches/release/libs/timer/test/msvc10/common.props
      - copied unchanged from r74846, /trunk/libs/timer/test/msvc10/common.props
   branches/release/libs/timer/test/msvc10/cpu_timer_test/ (props changed)
      - copied from r74846, /trunk/libs/timer/test/msvc10/cpu_timer_test/
   branches/release/libs/timer/test/msvc10/cpu_timer_test/Debug/ (props changed)
      - copied from r74846, /trunk/libs/timer/test/msvc10/cpu_timer_test/Debug/
   branches/release/libs/timer/test/msvc10/cpu_timer_test/cpu_timer_test.vcxproj
      - copied unchanged from r74846, /trunk/libs/timer/test/msvc10/cpu_timer_test/cpu_timer_test.vcxproj
   branches/release/libs/timer/test/msvc10/system_dll/ (props changed)
      - copied from r74846, /trunk/libs/timer/test/msvc10/system_dll/
   branches/release/libs/timer/test/msvc10/system_dll/system_dll.vcxproj
      - copied unchanged from r74846, /trunk/libs/timer/test/msvc10/system_dll/system_dll.vcxproj
   branches/release/libs/timer/test/msvc10/timer.sln
      - copied unchanged from r74846, /trunk/libs/timer/test/msvc10/timer.sln
   branches/release/libs/timer/test/msvc10/timer_dll/ (props changed)
      - copied from r74846, /trunk/libs/timer/test/msvc10/timer_dll/
   branches/release/libs/timer/test/msvc10/timer_dll/timer_dll.vcxproj
      - copied unchanged from r74846, /trunk/libs/timer/test/msvc10/timer_dll/timer_dll.vcxproj
   branches/release/libs/timer/test/original_timer_test.cpp
      - copied unchanged from r74846, /trunk/libs/timer/test/original_timer_test.cpp
Removed:
   branches/release/libs/timer/test/timer_test.cpp
   branches/release/libs/timer/timer.htm
Properties modified:
   branches/release/boost/timer.hpp (props changed)
   branches/release/libs/timer/ (props changed)
Text files modified:
   branches/release/libs/timer/index.html | 49 ++++++---------------------------------
   branches/release/libs/timer/test/Jamfile.v2 | 42 +++++++++++++++++++++++++++++----
   2 files changed, 44 insertions(+), 47 deletions(-)

Added: branches/release/boost/timer/config.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/timer/config.hpp 2011-10-09 08:17:51 EDT (Sun, 09 Oct 2011)
@@ -0,0 +1,53 @@
+// boost/timer/config.hpp -----------------------------------------------------------//
+
+// Copyright Beman Dawes 2003, 2006, 2011
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org/libs/timer for documentation.
+
+#ifndef BOOST_TIMER_CONFIG_HPP
+#define BOOST_TIMER_CONFIG_HPP
+
+#include <boost/config.hpp>
+
+#include <boost/system/api_config.hpp>
+
+// This header implements separate compilation features as described in
+// http://www.boost.org/more/separate_compilation.html
+
+// enable dynamic or static linking as requested --------------------------------------//
+
+#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TIMER_DYN_LINK)
+# if defined(BOOST_TIMER_SOURCE)
+# define BOOST_TIMER_DECL BOOST_SYMBOL_EXPORT
+# else
+# define BOOST_TIMER_DECL BOOST_SYMBOL_IMPORT
+# endif
+#else
+# define BOOST_TIMER_DECL
+#endif
+
+// enable automatic library variant selection ----------------------------------------//
+
+#if !defined(BOOST_TIMER_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TIMER_NO_LIB)
+//
+// Set the name of our library, this will get undef'ed by auto_link.hpp
+// once it's done with it:
+//
+#define BOOST_LIB_NAME boost_timer
+//
+// If we're importing code from a dll, then tell auto_link.hpp about it:
+//
+#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TIMER_DYN_LINK)
+# define BOOST_DYN_LINK
+#endif
+//
+// And include the header that does the work:
+//
+#include <boost/config/auto_link.hpp>
+#endif // auto-linking disabled
+
+#endif // BOOST_TIMER_CONFIG_HPP
+

Added: branches/release/boost/timer/timer.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/timer/timer.hpp 2011-10-09 08:17:51 EDT (Sun, 09 Oct 2011)
@@ -0,0 +1,138 @@
+// boost/timer/timer.hpp -------------------------------------------------------------//
+
+// Copyright Beman Dawes 1994-2007, 2011
+
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+#ifndef BOOST_TIMER_TIMER_HPP
+#define BOOST_TIMER_TIMER_HPP
+
+#include <boost/config/warning_disable.hpp>
+
+#include <boost/timer/config.hpp>
+#include <boost/chrono/chrono.hpp>
+#include <boost/cstdint.hpp>
+#include <string>
+#include <cstring>
+#include <ostream>
+
+#include <boost/config/abi_prefix.hpp> // must be the last #include
+
+# if defined(_MSC_VER)
+# pragma warning(push) // Save warning settings
+# pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>'
+# endif // needs to have dll-interface...
+
+//--------------------------------------------------------------------------------------//
+
+// TODO:
+//
+// * Add BOOST_NOEXCEPT where applicable
+
+//--------------------------------------------------------------------------------------//
+
+namespace boost
+{
+namespace timer
+{
+ class cpu_timer;
+ class auto_cpu_timer;
+
+ typedef boost::int_least64_t nanosecond_type;
+
+ struct cpu_times
+ {
+ nanosecond_type wall;
+ nanosecond_type user;
+ nanosecond_type system;
+
+ void clear() { wall = user = system = 0LL; }
+ };
+
+ const short default_places = 6;
+
+ BOOST_TIMER_DECL
+ std::string format(const cpu_times& times, short places, const std::string& format);
+
+ BOOST_TIMER_DECL
+ std::string format(const cpu_times& times, short places = default_places);
+
+// cpu_timer -------------------------------------------------------------------------//
+
+ class BOOST_TIMER_DECL cpu_timer
+ {
+ public:
+
+ // constructor
+ cpu_timer() { start(); }
+
+ // observers
+ bool is_stopped() const { return m_is_stopped; }
+ cpu_times elapsed() const; // does not stop()
+ std::string format(short places, const std::string& format) const
+ { return ::boost::timer::format(elapsed(), places, format); }
+ std::string format(short places = default_places) const
+ { return ::boost::timer::format(elapsed(), places); }
+ // actions
+ void start();
+ void stop();
+ void resume();
+
+ private:
+ cpu_times m_times;
+ bool m_is_stopped;
+ };
+
+// auto_cpu_timer --------------------------------------------------------------------//
+
+ class BOOST_TIMER_DECL auto_cpu_timer : public cpu_timer
+ {
+ public:
+
+ // Explicit defaults for os are not provided to avoid including <iostream>, which has
+ // high costs even when the standard streams are not actually used. Explicit defaults
+ // for format are not provided to avoid order-of-dynamic-initialization issues with a
+ // std::string.
+
+ explicit auto_cpu_timer(short places = default_places); // #1
+ auto_cpu_timer(short places, const std::string& format); // #2
+ explicit auto_cpu_timer(const std::string& format); // #3
+ auto_cpu_timer(std::ostream& os, short places,
+ const std::string& format) // #4
+ : m_places(places), m_os(&os), m_format(format)
+ { start(); }
+ explicit auto_cpu_timer(std::ostream& os, short places = default_places); // #5
+ auto_cpu_timer(std::ostream& os, const std::string& format) // #6
+ : m_places(default_places), m_os(&os), m_format(format)
+ { start(); }
+
+ ~auto_cpu_timer();
+
+ // observers
+ // not particularly useful to users, but allow testing of constructor
+ // postconditions and ease specification of other functionality without resorting
+ // to "for exposition only" private members.
+ std::ostream& ostream() const { return *m_os; }
+ short places() const { return m_places; }
+ const std::string& format_string() const { return m_format; }
+
+ // actions
+ void report();
+
+ private:
+ short m_places;
+ std::ostream* m_os; // stored as ptr so compiler can generate operator=
+ std::string m_format;
+ };
+
+} // namespace timer
+} // namespace boost
+
+# if defined(_MSC_VER)
+# pragma warning(pop) // restore warning settings.
+# endif
+
+#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
+
+#endif // BOOST_TIMER_TIMER_HPP

Modified: branches/release/libs/timer/index.html
==============================================================================
--- branches/release/libs/timer/index.html (original)
+++ branches/release/libs/timer/index.html 2011-10-09 08:17:51 EDT (Sun, 09 Oct 2011)
@@ -1,47 +1,14 @@
 <html>
-
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
-<meta name="ProgId" content="FrontPage.Editor.Document">
-<title>Boost Timer Library</title>
+<meta http-equiv="refresh" content="0; URL=v3/doc/index.htm">
 </head>
-
-<body bgcolor="#FFFFFF" text="#000000">
-
-<table border="1" bgcolor="#007F7F" cellpadding="2">
- <tr>
- <td bgcolor="#FFFFFF"><img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86"></td>
- <td>Home </td>
- <td>Libraries </td>
- <td>People </td>
- <td>FAQ </td>
- <td>More </td>
- </tr>
-</table>
-
-<h1>Timer library</h1>
-
-<p>The timer library supplies a timer class for measuring elapsed time, a
-progress_timer class for reporting elapsed time, and a progress_display class
-for displaying an indication of progress toward a goal.
-
-<ul>
- <li>Documentation (HTML).</li>
- <li>Headers timer.hpp and progress.hpp</li>
- <li>Test program timer_test.cpp</li>
- <li>Submitted by Beman Dawes.</li>
-</ul>
-
-<p>&nbsp;</p>
+<body>
+Automatic redirection failed, please go to doc/index.html.
 <hr>
-<p>© Copyright Beman Dawes, 2001<br>
-Distributed under the Boost Software License, Version 1.0. See
-www.boost.org/LICENSE_1_0.txt</p>
-
-<p><!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->07 November, 2007<!--webbot bot="Timestamp" endspan i-checksum="39369" -->
-</p>
-
+<p>&copy; Copyright Beman Dawes, 2003, 2011</p>
+<p> Distributed under the Boost Software
+License, Version 1.0.</p>
+<p> See <a href="http://www.boost.org/LICENSE_1_0.txt">
+www.boost.org/LICENSE_1_0.txt</a></p>
 </body>
-
 </html>
\ No newline at end of file

Modified: branches/release/libs/timer/test/Jamfile.v2
==============================================================================
--- branches/release/libs/timer/test/Jamfile.v2 (original)
+++ branches/release/libs/timer/test/Jamfile.v2 2011-10-09 08:17:51 EDT (Sun, 09 Oct 2011)
@@ -1,9 +1,39 @@
-#~ Copyright Rene Rivera 2008
-#~ Distributed under the Boost Software License, Version 1.0.
-#~ (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+# Boost Timer Library test Jamfile
 
-import testing ;
+# Copyright Beman Dawes 2003, 2006, 2011
 
-test-suite timer
- : [ compile timer_test.cpp ]
+# Distributed under the Boost Software License, Version 1.0.
+# See http://www.boost.org/LICENSE_1_0.txt
+
+# See library home page at http://www.boost.org/libs/timer
+
+project
+ : requirements
+ <library>/boost/timer//boost_timer
+ <toolset>msvc:<asynch-exceptions>on
     ;
+
+ test-suite "timer"
+ :
+ [ run ../example/auto_cpu_timer_example.cpp
+ : # command line
+ : # input files
+ : <test-info>always_show_run_output # requirements
+ ]
+ [ run cpu_timer_info.cpp
+ : # command line
+ : # input files
+ : <test-info>always_show_run_output # requirements
+ ]
+ [ run cpu_timer_test.cpp
+ : # command line
+ : # input files
+ : <test-info>always_show_run_output # requirements
+ ]
+ [ run ../example/timex.cpp
+ : echo "Hello, world"
+ :
+ : <test-info>always_show_run_output
+ ]
+ [ compile original_timer_test.cpp ]
+ ;

Deleted: branches/release/libs/timer/test/timer_test.cpp
==============================================================================
--- branches/release/libs/timer/test/timer_test.cpp 2011-10-09 08:17:51 EDT (Sun, 09 Oct 2011)
+++ (empty file)
@@ -1,89 +0,0 @@
-// timer, job_timer, and progress_display sample program -------------------//
-
-// Copyright Beman Dawes 1998. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/timer for documentation.
-
-// Revision History
-// 12 Jan 01 Cut time to 1.0 secs to speed regression tests (Beman Dawes)
-// 25 Sep 99 added elapsed_min() and elapsed_max() reporting
-// 16 Jul 99 Second beta
-// 6 Jul 99 Initial boost version
-
-#include <boost/progress.hpp>
-#include <iostream>
-#include <climits>
-
-using boost::timer;
-using boost::progress_timer;
-using boost::progress_display;
-using std::cout;
-using std::endl;
-
-int main() {
-
- timer t0; // used only for elapsed_max() and elapsed_min()
-
- cout << "timer::elapsed_min() reports " << t0.elapsed_min() << " seconds\n";
- cout << "timer::elapsed_max() reports " << t0.elapsed_max()
- << " seconds, which is " << t0.elapsed_max()/3600.0 << " hours\n";
-
- cout << "\nverify progress_display(0) doesn't divide by zero" << endl;
- progress_display zero( 0 ); // verify 0 doesn't divide by zero
- ++zero;
-
- long loops;
- timer loop_timer;
- const double time = 1.0;
-
- cout << "\ndetermine " << time << " second iteration count" << endl;
- for ( loops = 0; loops < LONG_MAX
- && loop_timer.elapsed() < time; ++loops ) {}
- cout << loops << " iterations"<< endl;
-
- long i;
- bool time_waster; // defeat [some] optimizers by storing result here
-
- progress_timer pt;
- timer t1;
- timer t4;
- timer t5;
-
- cout << "\nburn about " << time << " seconds" << endl;
- progress_display pd( loops );
- for ( i = loops; i--; )
- { time_waster = loop_timer.elapsed() < time; ++pd; }
-
- timer t2( t1 );
- timer t3;
- t4 = t3;
- t5.restart();
-
- cout << "\nburn about " << time << " seconds again" << endl;
- pd.restart( loops );
- for ( i = loops; i--; )
- { time_waster = loop_timer.elapsed() < time; ++pd; }
-
- if ( time_waster ) cout << ' '; // using time_waster quiets compiler warnings
- progress_display pd2( 50, cout, "\nLead string 1 ", "Lead string 2 ", "Lead string 3 " );
- for ( ; pd2.count() < 50; ++pd2 ) {}
-
- cout << "\nt1 elapsed: " << t1.elapsed() << '\n';
- cout << "t2 elapsed: " << t2.elapsed() << '\n';
- cout << "t3 elapsed: " << t3.elapsed() << '\n';
- cout << "t4 elapsed: " << t4.elapsed() << '\n';
- cout << "t5 elapsed: " << t5.elapsed() << '\n';
- cout << "t1 and t2 should report the same times (very approximately "
- << 2*time << " seconds).\n";
- cout << "t3, t4 and t5 should report about the same times,\n";
- cout << "and these should be about half the t1 and t2 times.\n";
- cout << "The following elapsed time should be slightly greater than t1."
- << endl;
- return 0;
- } // main
-
-
-
-

Deleted: branches/release/libs/timer/timer.htm
==============================================================================
--- branches/release/libs/timer/timer.htm 2011-10-09 08:17:51 EDT (Sun, 09 Oct 2011)
+++ (empty file)
@@ -1,213 +0,0 @@
-<html>
-
-<head>
-<meta http-equiv="Content-Language" content="en-us">
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
-<meta name="ProgId" content="FrontPage.Editor.Document">
-<title>Boost Timer Documentation</title>
-</head>
-
-<body bgcolor="#FFFFFF" text="#000000">
-
-<h1>
-<img src="../../boost.png" alt="boost.png (6897 bytes)" align="center" width="277" height="86">
- Timer Library</h1>
-<p>The timer library provides two headers and three classes: </p>
-
-<blockquote>
- <table border="1" cellpadding="5">
- <tr>
- <td><b>Header</b></td>
- <td><b>Class</b></td>
- <td><b>Functionality</b></td>
- </tr>
- <tr>
- <td>timer.hpp</td>
- <td>timer</td>
- <td>Measure elapsed time.</td>
- </tr>
- <tr>
- <td>progress.hpp</td>
- <td>progress_timer</td>
- <td>Measure elapsed time (using timer), display on destruction.</td>
- </tr>
- <tr>
- <td>progress.hpp</td>
- <td>progress_display</td>
- <td>Display an indication of progress toward a known goal.</td>
- </tr>
- </table>
-</blockquote>
-<p>The objective in designing these classes was fairly limited - they are
-intended for simple uses like timing and reporting progress for programmer's
-tests or batch job streams. The specifications of the progress classes are
-worded in very general terms to permit alternate implementations such as for
-graphical user interfaces.</p>
-<h2><a name="Class timer">Class timer</a></h2>
-<p>Class timer measures elapsed time.&nbsp; It is generally useful for minor
-timing tasks.&nbsp; Its supplied implementation offers moderate portability at
-the cost of depending on the unknown accuracy and precision of the C Standard
-Library clock() function.&nbsp; The maximum measurable elapsed time may be as
-low as 596.5 hours (or even less) for the supplied implementation. Because of
-these limitations, this timer cannot be depended upon to
-be robust, and should not be used if that is of any concern.</p>
-<h3>Synopsis</h3>
-<pre>#include &lt;boost/timer.hpp&gt;
-namespace boost {
-class timer {
- public:
- timer(); // postcondition: elapsed()==0
- // compiler generated copy constructor, copy assignment, and dtor apply
- void restart(); // post: elapsed()==0
- double elapsed() const; // return elapsed time in seconds
-
- double elapsed_max() const; // return estimated maximum value for elapsed()
- // Portability warning: elapsed_max() may return too high a value on systems
- // where std::clock_t overflows or resets at surprising values.
-
- double elapsed_min() const; // return minimum value for elapsed()
- }; // timer
-} // namespace boost</pre>
-<h3>Exception safety</h3>
-<p>The constructors may throw <code>std::bad_alloc</code>.&nbsp; No other member
-functions throw exceptions.</p>
-<h3>Future directions</h3>
-<p>There was a very reasonable request from Ed Brey for a method of determining
-the maximum value which may be returned by elapsed(), but there isn't a way to do so
-portably. The issue has been raised with the group working on extended time functionality for the C language. A solution
-may be years in the future. In the meantime, elapsed_max() provides an
-approximation.</p>
-<h2><a name="Class progress_timer">Class progress_timer</a></h2>
-<p>Class progress_timer automatically measures elapsed time, and then on
-destruction displays an elapsed time message at an appropriate place in an appropriate form.&nbsp;
-The supplied implementation defaults to a character display on std::cout.</p>
-<p>Class progress_timer is often used to time program execution.&nbsp; Its use is as simple as:</p>
-<blockquote>
- <pre>#include &lt;boost/progress.hpp&gt;
-int main()
-{
- progress_timer t; // start timing
- // do something ...
- return 0;
-}</pre>
-</blockquote>
-<p>Which will produce some appropriate output, for example:</p>
-<blockquote>
- <pre>1.23 s</pre>
-</blockquote>
-<p>Note that &quot;s&quot; is the official System International d'Unités
-abbreviation for seconds.</p>
-<h3>Synopsis</h3>
-<pre>#include &lt;boost/progress.hpp&gt;
-namespace boost {
-class progress_timer : public timer, noncopyable {
- public:
- progress_timer();
- progress_timer( std::ostream&amp; os ); // os is hint; implementation may ignore
- ~progress_timer();
- }; // progress_display
-} // namespace boost</pre>
-<h3>Exception safety</h3>
-<p>The constructors may throw <code>std::bad_alloc</code>.&nbsp; No other member
-functions throw exceptions.</p>
-<h2><a name="Class progress_display">Class progress_display</a></h2>
-<p>Class progress_display displays an appropriate indication of progress toward
-a predefined goal at an appropriate place in an appropriate form.&nbsp; This
-meets a human need to know if a program is progressing.</p>
-<p>For example, if a lengthy computation must be done on a std::map&lt;&gt;
-named big_map, the follow code would display an indication of progress:</p>
-<pre> progress_display show_progress( big_map.size() );
- for ( big_map_t::iterator itr = big_map:begin();
- itr != big_map.end(); ++itr )
- {
- // do the computation
- ...
- ++show_progress;
- }</pre>
-<p>After 70% of the elements have been processed, the display might look
-something like this:</p>
-<blockquote>
- <pre>0% 10 20 30 40 50 60 70 80 90 100%
-|----|----|----|----|----|----|----|----|----|----|
-************************************</pre>
-</blockquote>
-
-<h2>Synopsis</h2>
-<pre>#include &lt;boost/progress.hpp&gt;
-namespace boost {
-class progress_display : noncopyable {
- public:
- progress_display( unsigned long expected_count );
- // Effects: restart(expected_count)
-
- progress_display( unsigned long expected_count,
- std::ostream&amp; os, // os is hint; implementation may ignore
- const std::string &amp; s1 = &quot;\n&quot;, //leading strings
- const std::string &amp; s2 = &quot;&quot;,
- const std::string &amp; s3 = &quot;&quot; )
- // Effects: save copy of leading strings, restart(expected_count)
-
- void restart( unsigned long expected_count );
- // Effects: display appropriate scale on three lines,
- // prefaced by stored copy of s1, s2, s3, respectively, from constructor
- // Postconditions: count()==0, expected_count()==expected_count
-
- unsigned long operator+=( unsigned long increment )
- // Effects: Display appropriate progress tic if needed.
- // Postconditions: count()== original count() + increment
- // Returns: count().
-
- unsigned long operator++()
- // Returns: operator+=( 1 ).
-
- unsigned long count() const
- // Returns: The internal count.
-
- unsigned long expected_count() const
- // Returns: The expected_count from the constructor.
-
- }; // progress_display
-} // namespace boost</pre>
-<h3>Exception safety</h3>
-<p>All member functions except count() and expected_count() do output, and so in
-theory may throw exceptions.&nbsp; In practice it seems an exception being
-thrown is pretty unlikely, and probably implies such serious problems that an
-exception is warranted.&nbsp; Note that there is no explicit destructor, so the
-destructor throwing is not an issue.</p>
-<h2>History</h2>
-<p>These classes are descended from older C++ and C functionality found useful
-by programmers for many years. Via the Boost mailing list, Reid Sweatman
-suggested separating the more widely useful timer class from the more targeted
-progress classes. Sean Corfield suggested allowing output to any ostream.&nbsp;
-Dave Abrahams, Valentin Bonnard, Ed Brey, Andy Glew, and Dietmar Kühl also
-provided useful comments.&nbsp; Ed Brey suggested timer::elapsed_max(). John
-Maddock suggested timer::elapsed_min(). Toon Knapen suggested the optional
-leading strings, to allow for labeling the progress display</p>
-<h2>Rationale</h2>
-<p>The early versions of the timer classes had separate implementation
-files.&nbsp; This caused problems for users not wishing to build libraries,
-caused difficulties building DLL's (because of cascaded use of other libraries
-which in turn brought illuminated compiler deficiencies), and caused the classes
-not to be used even when clearly applicable.&nbsp; Thus the implementation was
-changed to all inline code.</p>
-<p>There have been several requests for platform specific implementations to use
-supposedly high-performance timers from the operating system API.&nbsp; John
-Maddock submitted an implementation using the Win32 API.&nbsp; Tests showed that
-while the precision of these timers was high, the latency was sometimes very
-much higher than for the std::clock() function, and that is very bad.&nbsp;
-Furthermore, results using the Win32 API were very dependent on both the
-compiler (Microsoft and Borland were tested) and the operating system version
-(Windows NT, Windows 95, etc.)&nbsp; Thus the std::clock() function was much
-more reliable, and so was retained even on this platform with its own timer API.</p>
-<hr>
-<p>© Copyright Beman Dawes 1999.<br>
-Distributed under the Boost Software License, Version 1.0. See
-www.boost.org/LICENSE_1_0.txt</p>
-
-<p>Revised <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%B %d, %Y" startspan -->November 07, 2007<!--webbot bot="Timestamp" i-checksum="39599" endspan -->
-</p>
-
-</body>
-
-</html>
\ 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