Changeset 79029


Ignore:
Timestamp:
Jun 21, 2012, 9:11:08 PM (6 years ago)
Author:
viboes
Message:

Chrono/Stopwathes?: Rename main stopwatches classes

Location:
trunk/libs/chrono
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/chrono/doc/chrono.qbk

    r78719 r79029  
    4646[def __type [*type:]]
    4747[def __returns [*Returns:]]
     48[def __return_type [*Return Type:]]
    4849[def __throws [*Throws:]]
    4950[def __remarks [*Remarks:]]
    5051[def __effects [*Effects:]]
    51 [def __post_conditions [*PostConditions:]]
    52 [def __postcondition [*PostConditions:]]
    53 [def __pre_conditions [*PreConditions:]]
    54 [def __precondition [*PreConditions:]]
     52[def __post_conditions [*Post Conditions:]]
     53[def __post_condition [*Post Conditions:]]
     54[def __postcondition [*Post Conditions:]]
     55[def __pre_conditions [*Pre Conditions:]]
     56[def __precondition [*Pre Conditions:]]
    5557[def __requires [*Requires:]]
    5658[def __params [*Parameters:]]
     
    8183[def __ratio_greater `ratio_greater`]
    8284[def __ratio_greater_equal `ratio_greater_equal`]
     85
     86[def __failbit `failbit`]
    8387
    8488
     
    356360[/==================]
    357361
    358 [def __Stopwatch [link chrono.reference.stopwatches.simple_stopwatch_req `SimpleStopwatch`]]
    359 [def __SimpleStopwatch [link chrono.reference.stopwatches.simple_stopwatch_req `SimpleStopwatch`]]
    360 [def __simple_stopwatch_concept [link chrono.reference.stopwatches.simple_stopwatch_req `SimpleStopwatch`]]
    361 [def __simple_stopwatch [link chrono.reference.stopwatches.simple_stopwatch_hpp.simple_stopwatch `simple_stopwatch`]]
    362 [def __stopwatch [link chrono.reference.stopwatches.simple_stopwatch_hpp.simple_stopwatch `simple_stopwatch`]]
    363 
    364 [def __simple_stopclock [link chrono.reference.stopwatches.simple_stopwatch_hpp.simple_stopclock `simple_stopclock`]]
    365 [def __basic_stopclock [link chrono.reference.stopwatches.simple_stopwatch_hpp.basic_stopclock `basic_stopclock`]]
    366 
    367 [def __BasicStopwatch [link chrono.reference.stopwatches.stopwatch_req `BasicStopwatch`]]
    368 [def __basic_stopwatch_concept [link chrono.reference.stopwatches.stopwatch_req `BasicStopwatch`]]
    369 [def __laps_stopwatch [link chrono.reference.stopwatches.stopwatch_hpp.simple_stopwatch `laps_stopwatch`]]
    370 [def __laps_stopclock [link chrono.reference.stopwatches.stopwatch_hpp.simple_stopwatch `basic_stopclock`]]
    371 
    372 [def __SuspendableStopwatch [link chrono.reference.stopwatches.suspendable_stopwatch_req `SuspendableStopwatch`]]
     362[def __StrictStopwatch [link chrono.reference.stopwatches.req.strict_stopwatch_req `StrictStopwatch`]]
     363[def __strict_stopwatch_concept [link chrono.reference.stopwatches.req.strict_stopwatch_req `StrictStopwatch`]]
     364[def __strict_stopwatch [link chrono.reference.stopwatches.strict_stopwatch_hpp.strict_stopwatch `strict_stopwatch`]]
     365
     366
     367[def __strict_stopclock [link chrono.reference.stopwatches.strict_stopclock_hpp.strict_stopclock `strict_stopclock`]]
     368[def __basic_stopclock [link chrono.reference.stopwatches.strict_stopclock_hpp.basic_stopclock `basic_stopclock`]]
     369
     370[def __Stopwatch [link chrono.reference.stopwatches.req.stopwatch_req `Stopwatch`]]
     371[def __stopwatch_concept [link chrono.reference.stopwatches.req.stopwatch_req `Stopwatch`]]
     372[def __stopwatch [link chrono.reference.stopwatches.stopwatch_hpp.stopwatch `stopwatch`]]
     373[def __laps_stopwatch [link chrono.reference.stopwatches.stopwatch_hpp.stopwatch `laps_stopwatch`]]
     374[def __laps_stopclock [link chrono.reference.stopwatches.stopwatch_hpp.stopwatch `basic_stopclock`]]
     375
     376[def __SuspendableStopwatch [link chrono.reference.stopwatches.req.suspendable_stopwatch_req `SuspendableStopwatch`]]
    373377[def __suspendable_stopwatch_concept [link chrono.reference.stopwatches.suspendable_stopwatch_req `SuspendableStopwatch`]]
    374 [def __suspendable_stopwatch [link chrono.reference.stopwatches.suspendable_stopwatch_hpp.simple_stopwatch `suspendable_stopwatch`]]
    375 [def __suspendable_stopclock [link chrono.reference.stopwatches.suspendable_stopwatch_hpp.simple_stopwatch `suspendable_stopclock`]]
     378[def __suspendable_stopwatch [link chrono.reference.stopwatches.suspendable_stopwatch_hpp.suspendable_stopwatch `suspendable_stopwatch`]]
     379[def __suspendable_stopclock [link chrono.reference.stopwatches.suspendable_stopwatch_hpp.suspendable_stopwatch `suspendable_stopclock`]]
    376380
    377381[def __stopwatch_reporter `stopwatch_reporter `]
     
    460464
    461465Knowing how long a program, a function or a specific code block takes to execute is useful in both test and production environments.
    462 __Boost_Chrono introduces the __simple_stopwatch_concept concept which is a mechanism to measure the elapsed time.
    463 __simple_stopwatch`<>` is the basic model of __simple_stopwatch_concept.
     466__Boost_Chrono introduces the __strict_stopwatch_concept concept which is a mechanism to measure the elapsed time.
     467__strict_stopwatch`<>` is the basic model of __strict_stopwatch_concept.
    464468
    465469[heading Reporting elapsed time]
     
    470474    int main()
    471475    {
    472         stopwatch_reporter<stopwatch<process_cpu_clocks> > _;
     476        __stopwatch_reporter<__stopwatch<__process_cpu_clocks> > _;
    473477      // ...
    474478    }
     
    482486    int main()
    483487    {
    484         stopclock<process_cpu_clocks> _;
     488        __stopclock<__process_cpu_clocks> _;
    485489      // ...
    486490    }
     
    544548Stopwatches: Some facility to measure elapsed time with the ability to start, stop, suspend, or resume measurement.
    545549
    546 * __SimpleStopwatch, __BasicStopwatch, __SuspendableStopwatch concepts.
    547 * __simple_stopwatch, model of __SimpleStopwatch capturing elapsed __Clock times.
    548 * __laps_stopwatch, model of __BasicStopwatch allowing in addition to start and stop the capture of elapsed __Clock times.
     550* __StrictStopwatch, __Stopwatch, __SuspendableStopwatch concepts.
     551* __strict_stopwatch, model of __StrictStopwatch capturing elapsed __Clock times.
     552* __laps_stopwatch, model of __Stopwatch allowing in addition to start and stop the capture of elapsed __Clock times.
    549553* __suspendable_stopwatch, model of __SuspendableStopwatch allowing in addition to suspend and resume the capture of elapsed __Clock times.
    550554* __laps_stopwatch and __suspendable_stopwatch have __LapsCollector template parameter that allows to store information of the samples defined by a cycle start-stop.
     
    554558* __stopwatch_reporter`<__Stopwatch,__Formatter>`, convenient reporting to an output stream (including wide char streams) of the elapsed time of models of __Stopwatch results.
    555559* Some basic __Formatters.
    556 * `__simple_stopclock<__Clock>` shortcut of `__stopwatch_reporter<__simple_stopwatch<__Clock>>`
     560* `__strict_stopclock<__Clock>` shortcut of `__stopwatch_reporter<__strict_stopwatch<__Clock>>`
    557561* `__basic_stopclock<__Clock>` shortcut of `__stopwatch_reporter<__laps_stopwatch<__Clock>>`
    558562* `__suspendable_stopclock<__Clock>` shortcut of `__stopwatch_reporter<__suspendable_stopwatch<__Clock>>`
     
    719723    int main()
    720724    {
    721         boost::chrono::system_simple_stopclock _;
     725        boost::chrono::system_strict_stopclock _;
    722726
    723727        for ( long i = 0; i < 10000000; ++i )
     
    12331237[section process_cpu_clock]
    12341238
    1235 Process and thread clocks are used usually to measure the time spent by code blocks, as a basic time-spent profiling of different blocks of code (Boost.Stopwatch is a clear example of this use).
     1239Process and thread clocks are used usually to measure the time spent by code blocks, as a basic time-spent profiling of different blocks of code (Boost.Chrono.Stopwatch is a clear example of this use).
    12361240
    12371241[endsect]
     
    15791583The library encapsulate the locale-dependent parsing and formatting of __duration into a new facet class. Let's focus on formatting in this example. The concerned facet class is  __duration_put, analogous to time_put, money_put, etc.
    15801584
    1581 The use of this facet is similar to the time_put facet. duration_put provides a put function
     1585The use of this facet is similar to the time_put facet.
    15821586
    15831587[endsect] [/ Low level I/O]
     
    15861590
    15871591[section Stopwatches and Stopclocks]
     1592[/=================================]
    15881593
    15891594At the user level, the main use case of measuring the elapsed time is to report these measures on the display. For example
     
    15921597
    15931598    int f1(long j) {
    1594         simple_stopwatch<> sw;
     1599        strict_stopwatch<> sw;
    15951600
    15961601        for ( long i = 0; i < j; ++i )
     
    16171622We can replace the lines
    16181623
    1619         simple_stopwatch <> sw;
     1624        strict_stopwatch <> sw;
    16201625
    16211626        ...
     
    16271632
    16281633    int f1(long j) {
    1629         stopwatch_reporter<simple_stopwatch <> > _;
     1634        __stopwatch_reporter<__strict_stopwatch <> > _;
    16301635
    16311636        for ( long i = 0; i < j; ++i )
     
    16471652We can use even a shorter line using the __stopclock class, which allows to replace
    16481653
    1649         stopwatch_reporter<laps_stopwatch<> > _;
     1654        __stopwatch_reporter<__strict_stopwatch<> > _;
    16501655
    16511656by
    16521657
    1653         stopclock<> _;
    1654 
    1655 As noted above, stopwatches and stopclocks are mainly used to count elapsed
     1658        __strict_stopclock<> _;
     1659
     1660[section:accumulators Stopwatches accumulation and statistics]
     1661
     1662The preceding stopwatch manage only with a measure. It is also interesting to have an statisitical view of these times,
     1663for example the sum, min, max and mean. __laps_stopwatch`<>` associates an accumulator with a __stopwatch__, so we are able to retrieve any statistical feature Boost.Accumulator provides.
     1664
     1665For example
     1666
     1667    using namespace boost::chrono;
     1668   
     1669    int f1(long j) {
     1670        static __stopwatch_reporter<__laps_stopwatch<> > sw;
     1671        __stopwatch_reporter<__laps_stopwatch<> >::scoped_run _(sw);
     1672
     1673        for ( long i = 0; i < j; ++i )
     1674            std::sqrt( 123.456L );  // burn some time
     1675
     1676        return 0;
     1677    }
     1678    int main()  {
     1679        f1(100000);
     1680        f1(200000);
     1681        f1(300000);
     1682        return 0;
     1683    }
     1684
     1685Will produce the following output
     1686
     1687    3 times, sum=0.034s, min=0.006s, max=0.017s, mean=0.011s
     1688
     1689
     1690[endsect]
     1691
     1692
     1693
     1694[section:function How can I prefix each report with `BOOST_CURRENT_FUNCTION` function signature?]
     1695
     1696You will need to give a specific format to your __stopclock. You just need to concatenate your specific pattern to the default_format of the formatter.
     1697
     1698For example, for a __stopclock_accumulator the default formatter is __stopwatch_accumulator_formatter, you will need to do something like:
     1699
     1700    static __stopclock_accumulator<> acc(
     1701        std::string(BOOST_CURRENT_FUNCTION) + ":  "
     1702            + __stopwatch_accumulator_formatter::default_format()
     1703    );
     1704    __stopclock_accumulator<>::scoped_run _(acc);
     1705
     1706
     1707Some of you will say that this is too long to type just to get the a report. You can of course define your own macro as
     1708
     1709    #define REPORT_FUNCTION_ACCUMULATED_LIFETIME\
     1710        static boost::stopwatches::__stopclock_accumulator<> \
     1711                BOOST_JOIN(_accumulator_, __LINE__)_
     1712            ( std::string(BOOST_CURRENT_FUNCTION) + ":  " + \
     1713                boost::stopwatches::__stopwatch_accumulator_formatter::default_format() \
     1714        ); \
     1715        boost::stopwatches::__stopclock_accumulator<>::scoped_run \
     1716                BOOST_JOIN(_accumulator_run_, __LINE__) \
     1717            (BOOST_JOIN(_accumulator_, __LINE__))
     1718
     1719
     1720With this macro you will just have to write
     1721
     1722    void foo()
     1723    {
     1724        REPORT_FUNCTION_ACCUMULATED_LIFETIME() ;
     1725        boost::this_thread::sleep(boost::posix_time::milliseconds(100));
     1726        // ...
     1727    }
     1728
     1729[endsect]
     1730
     1731[section:file_line How can I prefix each report with `__FILE__[__LINE__]` pattern?]
     1732
     1733When you want to prefix with the `__FILE__[__LINE__]` pattern you can follow the same technique as described below:
     1734
     1735    #define REPORT_LINE_ACCUMULATED_LIFETIME \
     1736        static __stopclock_accumulator<>
     1737                BOOST_JOIN(_accumulator_, __LINE__) \
     1738                ( std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] "
     1739                    + __stopwatch_accumulator_formatter::default_format() \
     1740        ); \
     1741        __stopclock_accumulator<>::scoped_run \
     1742                BOOST_JOIN(_accumulator_run_, __LINE__)
     1743                (BOOST_JOIN(_accumulator_, __LINE__))
     1744
     1745Now you can mix fcntion and line reports as follows
     1746
     1747    void foo()
     1748    {
     1749        REPORT_FUNCTION_ACCUMULATED_LIFETIME;
     1750        boost::this_thread::sleep(boost::posix_time::milliseconds(100));
     1751        {
     1752            REPORT_LINE_ACCUMULATED_LIFETIME;
     1753            boost::this_thread::sleep(boost::posix_time::milliseconds(200));
     1754        }
     1755
     1756    }
     1757
     1758[endsect]
     1759
     1760[section:non_static_acc Can I use an stopclock accumulator which is not static?]
     1761
     1762The typical example of stopclock_accumulator is to get statistical measures of the time a function takes for each one of its calls.
     1763You can also use __stopclock_accumulator to get statistical measures of the time a given loop takes for each one of its laps.
     1764
     1765        __stopclock_accumulator<> acc(
     1766            std::string(__FILE__) + "[" + BOOST_STRINGIZE(__LINE__) + "] "
     1767                + __stopwatch_accumulator_formatter::default_format()
     1768        );
     1769        for (int i=0; i<N; i++) {
     1770            __stopclock_accumulator<>::scoped_run _(acc);
     1771            // ...
     1772        }
     1773
     1774
     1775[endsect]
     1776
     1777[section:suspend How can I suspend a stopwatch?]
     1778
     1779    #include <boost/stopwatches/stopwatch.hpp>
     1780    #include <cmath>
     1781    #include <boost/thread.hpp>
     1782
     1783
     1784    using namespace boost::stopwatches;
     1785    double res;
     1786    void f1(long j)
     1787    {
     1788        __stopwatch_reporter<__stopwatch__<> >:: _(BOOST_STOPWATCHES_STOPWATCH_FUNCTION_FORMAT);
     1789        for (long i =0; i< j; i+=1)
     1790            res+=std::sqrt( res+123.456L+i );  // burn some time
     1791        __stopwatch_reporter<__stopwatch__<> >::scoped_suspend s(_);
     1792        boost::this_thread::sleep(boost::posix_time::milliseconds(200));
     1793    }
     1794
     1795[endsect]
     1796
     1797[section:stats How to get specific statistics from stopwatches accumulator?]
     1798
     1799There are two use cases that coul need to change the statistics associated to a stopwatches accumulator:
     1800
     1801# We want to reduce the default reporting and we preffer to adapt the statistics to the reporting
     1802# We want to report other statistics of the samples
     1803
     1804For the first case we just need to change the accumulator_set and the format we want to get. Imagin we want to get only the count, sam and mean statistics, no need to calculate the min neither the max.
     1805
     1806    using namespace boost::accumulators;
     1807
     1808    typedef __stopwatch_reporter<__laps_stopwatch<__process_real_cpu_clock__,
     1809                accumulator_set<__process_real_cpu_clock__::rep,
     1810                    features<
     1811                            tag::count,
     1812                            tag::sum,
     1813                            tag::mean
     1814                    >
     1815                >
     1816      > my_stopwatch_accumulator_reporter;
     1817
     1818    int f1(long j)
     1819    {
     1820      static my_stopwatch_accumulator_reporter acc("%c times, sum=%ss, mean=%as\n");
     1821      my_stopwatch_accumulator_reporter::scoped_run _(acc);
     1822
     1823      for ( long i = 0; i < j; ++i )
     1824        std::sqrt( 123.456L );  // burn some time
     1825
     1826      return 0;
     1827    }
     1828
     1829But what would hapend if we haven't forced the format:
     1830
     1831      static my_stopwatch_accumulator_reporter acc;
     1832      my_stopwatch_accumulator_reporter::scoped_run _(acc);
     1833
     1834Unfortunately there is no error at compile time. Fortunately, the run-time execution is not undefined and will return 0 for the missing statistics.
     1835
     1836
     1837[endsect]
    16561838
    16571839[section Formatting]
    16581840
    1659 The preceding examples just print the elapsed duration of the stopwatch. How can I for example print the
     1841[section:other How can I make a specific formatter when the default do not satisfy my expectations]
     1842
     1843Imagine then that we want to report the `tag::variance(lazy)`. We will need to include the specific accumulator file
     1844
     1845    ...
     1846    #include <boost/accumulators/statistics/variance.hpp>
     1847    ...
     1848    typedef __stopwatch_reporter<__laps_stopwatch<__process_real_cpu_clock__,
     1849                accumulator_set<__process_real_cpu_clock__::rep,
     1850                    features<
     1851                            tag::count,
     1852                            tag::sum,
     1853                            tag::mean,
     1854                            tag::variance(lazy)
     1855                    >
     1856                >
     1857    > my_stopwatch_accumulator_reporter;
     1858
     1859But what happens if we add new statistics to the accumulator_set that are not taken in account by the default formatter? These statistics will simply be ignored. So we will need to define our own accumulator formatter.
     1860
     1861    typedef __stopwatch_reporter<__laps_stopwatch<__process_real_cpu_clock__,
     1862                accumulator_set<__process_real_cpu_clock__::rep,
     1863                    features<
     1864                            tag::count,
     1865                            tag::sum,
     1866                            tag::mean,
     1867                            tag::variance(lazy)
     1868                    >
     1869                >,
     1870                my_stopwatch_accumulator_formatter
     1871    > my_stopwatch_accumulator_reporter;
     1872
     1873Next follow the definition of a formatter taking care of count, sum, mean and variance
     1874
     1875    class my_stopwatch_accumulator_formatter {
     1876    public:
     1877        typedef std::string string_type;
     1878        typedef char char_type;
     1879        typedef std::ostream ostream_type;
     1880
     1881        static ostream_type &  default_os() {return std::cout;}
     1882        static const char_type* default_format() {
     1883            return "%c times, sum=%ss, mean=%as, variance=%vs\n";
     1884        }
     1885        static int default_places() { return 3; }
     1886
     1887        template <class Stopwatch >
     1888        static void show_time( Stopwatch & stopwatch_, const char_type* format,
     1889                                int places, ostream_type & os, system::error_code & ec)
     1890        {
     1891            typedef typename Stopwatch::duration duration_t;
     1892            typename Stopwatch::accumulator accumulator& acc = stopwatch_.accumulated();
     1893
     1894            boost::io::ios_flags_saver ifs( os );
     1895            os.setf( std::ios_base::fixed, std::ios_base::floatfield );
     1896            boost::io::ios_precision_saver ips( os );
     1897            os.precision( places );
     1898
     1899            for ( ; *format; ++format ) {
     1900                if ( *format != '%' || !*(format+1) || !std::strchr("acsv", *(format+1)) ) {
     1901                    os << *format;
     1902                } else {
     1903                    ++format;
     1904                    switch ( *format ) {
     1905                    case 's':
     1906                        os << boost::chrono::duration<double>(
     1907                                duration_t(accumulators::sum(acc))).count();
     1908                        break;
     1909                    case 'a':
     1910                        os << (accumulators::count(acc)>0)
     1911                                ? boost::chrono::__duration__<double>(duration_t(
     1912                                    duration_t::rep(accumulators::mean(acc)))).count()
     1913                                : 0;
     1914                        break;
     1915                    case 'c':
     1916                        os << accumulators::count(acc);
     1917                        break;
     1918                    case 'v':
     1919                        os << (accumulators::count(acc)>0)
     1920                                ? boost::chrono::__duration__<double>(duration_t(
     1921                                    duration_t::rep(accumulators::variance(acc)))).count()
     1922                                : 0;
     1923                        break;
     1924                    default:
     1925                        assert(0 && "my_stopwatch_accumulator_formatter internal logic error");
     1926                    }
     1927                }
     1928            }
     1929        }
     1930    };
     1931
     1932
     1933
     1934[endsect]
     1935
    16601936
    16611937[endsect]
     
    22302506        { std::cout << "command: \"" << s.c_str() << "\"\n"; }
    22312507
    2232       boost::chrono::__stopclock__<> t;
     2508      boost::chrono::__stopclock<> t;
    22332509
    22342510      return std::system( s.c_str() );
     
    70767352[endsect]
    70777353
     7354[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    70787355[section:stopwatches Stopwatches]
    70797356
    7080 [section:simple_stopwatch_req `SimpleStopwatch` Requirements]
    7081 
    7082 A SimpleStopwatch measure the amount of time elapsed from a start point in time.
    7083 
    7084 While __Clock are static and not instantiated, `SimpleStopwatch` are instantiated and associated to a given __Clock.
    7085 
    7086 A `S` meets the `SimpleStopwatch` requirements if:
     7357[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7358[section:req Requirements]
     7359[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7360[section:strict_stopwatch_req `StrictStopwatch` Requirements]
     7361
     7362A StrictStopwatch measure the amount of time elapsed from a start point in time.
     7363
     7364While __Clock are static and not instantiated, `StrictStopwatch` are instantiated and associated to a given __Clock.
     7365
     7366A `S` meets the `StrictStopwatch` requirements if:
    70877367
    70887368* `S::clock` meets the __Clock requirements, and
    70897369* meets the requirements specified in the following table.
    70907370
    7091 In this table `S` denote a SimpleStopwatch type. `s` is an instance of `S`, `ec` is instance of `system::error_code`.
    7092 
    7093 [table SimpleStopwatch Requirements
     7371In this table `S` denote a StrictStopwatch type. `sc` is an instance of `S` const, `ec` is instance of `system::error_code`.
     7372
     7373[table StrictStopwatch Requirements
    70947374    [[expression]        [return type]  [operational semantics]]
    70957375    [[`S::clock`]        [A model of __Clock.]          [The clock associated to this Stopwatch.]]
    70967376    [[`S::duration`]     [`S::clock::duration`]         [The __duration type of the `clock`.]]
    70977377    [[`S::time_point`]   [`S::clock::time_point`]       [The __time_point type of the `clock`.]]
    7098     [[`s.elapsed()`]     [`S::duration`]                [the elapsed time while the SimpleStopwatch was running.]]
    7099     [[`s.reset()`]       [-]                            [Resets as if it was constructed again.]]
    7100     [[`s.elapsed(ec)`]   [`S::duration`]                [the elapsed time while the SimpleStopwatch was running.]]
    7101     [[`s.reset(ec)`]     [-]                            [Resets as if it was constructed again.]]
     7378    [[`S()`]             [`S&&`]                        [Constructd a stopwatch.]]
     7379    [[`S(ec)`]           [`S&&`]                        [Constructd a stopwatch.]]
     7380    [[`sc.elapsed()`]    [`S::duration`]                [the elapsed time while the __StrictStopwatch was running.]]
     7381    [[`sc.elapsed(ec)`]  [`S::duration`]                [the elapsed time while the __StrictStopwatch was running.]]
    71027382]
    71037383
    7104 [section:elapsed Member Function `elapsed()`]
    7105 
    7106             duration elapsed() const noexcept;
     7384Models of `StrictStopwatch `:
     7385
     7386* __strict_stopwatch
     7387
     7388[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7389[section:elapsed `sc.elapsed()`]
     7390
     7391__return_type `S::duration`.
    71077392
    71087393__returns the elapsed time.
    71097394
    7110 [endsect]
    7111 
    7112 [section:elapsed_ec Member Function `elapsed(system::error_code & )`]
    7113 
    7114             duration elapsed(system::error_code & ec) const;
    7115 
    7116 __returns the cumulated elapsed time.
     7395__throws Any exception the S::clock::now` function can throw.
     7396
     7397[endsect]
     7398
     7399[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7400[section:elapsed_ec `sc.elapsed(ec)`]
     7401
     7402__return_type `S::duration`.
     7403
     7404__returns the elapsed time.
    71177405
    71187406__effects When there is an internal error stores the error code in the `ec` parameter if it is different from `boost::throws()`.
    71197407
    7120 __throws Any exception the `Clock::now` function can throw when `ec` is `throws()`, otherwise none.
    7121 
    7122 [endsect]
    7123 
    7124 
    7125 Models of `SimpleStopwatch `:
    7126 
    7127 * __simple_stopwatch
    7128 
    7129 [endsect]
    7130 
    7131 
     7408__throws Any exception the `S::clock::now` function can throw when `ec` is `throws()`, otherwise none.
     7409
     7410[endsect]
     7411
     7412[endsect]
     7413
     7414
     7415[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    71327416[section:stopwatch_req `Stopwatch` Requirements]
    71337417
    7134 As a __SimpleStopwatch, a Stopwatch measure the amount of time elapsed from a start point in time. The main difference is that a Stopwatch can be started and stopped (and restarted). The duration between these two time points is called a lap. It could have in addition the capability to collect these lap samples.
     7418As a __StrictStopwatch, a Stopwatch measure the amount of time elapsed from a start point in time. The main difference is that a Stopwatch can be started and stopped (and restarted). The duration between these two time points is called a lap. It could have in addition the capability to collect these lap samples.
    71357419
    71367420A `S` meets the `Stopwatch` requirements if:
    71377421
    7138 * `S` meets the __SimpleStopwatch requirements, and
     7422* `S` meets the __StrictStopwatch requirements, and
    71397423* meets the requirements specified in the following table.
    71407424
    7141 In this table `S` denote `Stopwatch` type. `s` is an instance of `S`, `ec` is instance of `system::error_code`.
     7425In this table `S` denote `Stopwatch` type. `s` is an instance of `S`,  `sc` is an instance of `S` const, `ec` is instance of `system::error_code`.
    71427426
    71437427[table Stopwatch Requirements
     
    71467430    [[`S::scoped_run`]           [`__stopwatch_runner<S>`]          [RAI which `start`/`stop` the `stopwatch`.]]
    71477431    [[`S::scoped_stop`]          [`__stopwatch_stopper<S>`]         [RAI which `stop`/`start` the `stopwatch`.]]
     7432
     7433    [[`S(dont_start)`]           [`S&&`]                        [Constructd a stopwatch.]]
     7434    [[`S(coll)`]                 [`S&&`]                        [Constructd a stopwatch.]]
     7435    [[`S(coll,ec)`]              [`S&&`]                        [Constructd a stopwatch.]]
     7436   
    71487437    [[`s.start()`]               [-]                                [starts a Stopwatch.]]
     7438    [[`s.start(ec)`]             [-]                                [starts a Stopwatch.]]
     7439    [[`s.stop()`]                [-]                                [stops a Stopwatch.]]
     7440    [[`s.stop(ec)`]              [-]                                [stops a Stopwatch.]]
    71497441    [[`s.restart()`]             [-]                                [restarts a Stopwatch.]]
    7150     [[`s.stop()`]                [-]                                [stops a Stopwatch.]]
    7151     [[`s.is_running()`]          [bool]                             [true if the Stopwatch is running.]]
    7152     [[`s.lap_collector()`]       [`S::laps_collector const&`]       [the elapsed time while the Stopwatch was running.]]
    7153     [[`s.start(ec)`]             [-]                                [starts a Stopwatch.]]
    71547442    [[`s.restart(ec)`]           [-]                                [restarts a Stopwatch.]]
    7155     [[`s.stop(ec)`]              [-]                                [stops a Stopwatch.]]
     7443    [[`s.reset()`]               [-]                                [Resets as if it was constructed again.]]
     7444    [[`s.reset(ec)`]             [-]                                [Resets as if it was constructed again.]]
     7445   
     7446    [[`sc.is_running()`]         [`bool`]                           [whether the stopwatch is running or not.]]
     7447    [[`sc.elapsed_current_lap()`]   [`S::duration`]                 [the elapsed time since the last start.]]
     7448    [[`sc.elapsed_current_lap(ec)`] [`S::duration`]                 [the elapsed time since the last start.]]
     7449    [[`sc.is_running()`]         [bool]                             [true if the Stopwatch is running.]]
     7450    [[`sc.lap_collector()`]      [`S::laps_collector const&`]       [the elapsed time while the Stopwatch was running.]]
    71567451]
    71577452
    7158 [section:start Member Function `start()`]
    7159 
    7160     void start() noexcept;
     7453Models of `Stopwatch`:
     7454
     7455* __stopwatch
     7456
     7457[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7458[section:start `start()`]
    71617459
    71627460__effects Starts running the stopwatch.
    71637461
    7164 __returns the starting time point.
    7165 
    7166 [endsect]
    7167 [section:start_ec Member Function `start(system::error_code&)`]
    7168 
    7169     void start( system::error_code & ec = throws() );
     7462__throws Any exception the `S::clock::now` function can throw.
     7463
     7464[endsect]
     7465[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7466[section:start_ec `start(ec)`]
    71707467
    71717468__effects Starts running the stopwatch.
    71727469When there is an internal error stores the error code in the `ec` parameter if it is different from `throws()`.
    71737470
    7174 __throws Any exception the `S::clock::now` function can throw when `ec` is `throws()`
    7175 
    7176 [endsect]
    7177 [section:stop Member Function `stop()`]
    7178 
    7179     void stop();
     7471__throws Any exception the `S::clock::now` function can throw when `ec` is `throws()`.
     7472
     7473[endsect]
     7474
     7475[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7476[section:stop `stop()`]
    71807477
    71817478__effects Stops running the stopwatch.
     
    71857482[endsect]
    71867483
    7187 [section:stop_ec Member Function `stop(system::error_code&)`]
    7188 
    7189     void stop( system::error_code & ec = throws() );
     7484[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7485[section:stop_ec `stop(ec)`]
    71907486
    71917487__effects Stops running the stopwatch.
     
    71967492[endsect]
    71977493
    7198 [section:restart Member Function `restart()`]
    7199 
    7200     void restart( system::error_code & ec = throws() );
     7494[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7495[section:restart `restart()`]
    72017496
    72027497__effects `stop`/`start` the stopwatch.
    72037498
    7204 __throws Any exception the `S::clock::now` function can throw when `ec` is `throws()`
    7205 
    7206 [endsect]
    7207 
    7208 [section:elapsed Member Function `get_laps_collector()`]
    7209 
    7210             duration get_laps_collector() const noexcpt;
     7499__throws Any exception the `S::clock::now` function can throw.
     7500
     7501[endsect]
     7502[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7503[section:restart_ec `restart(ec)`]
     7504
     7505__effects `stop`/`start` the stopwatch.
     7506
     7507__throws Any exception the `S::clock::now` function can throw when `ec` is `throws()`.
     7508
     7509[endsect]
     7510[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7511[section:is_running `sc.is_running()`]
     7512
     7513__return_type `bool`.
     7514
     7515__returns Whether the stopwatch is running or not.
     7516
     7517__throws Nothing.
     7518
     7519[endsect]
     7520
     7521[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7522[section:elapsed `get_laps_collector()`]
     7523
     7524__return_type `const S::laps_collector&`.
    72117525
    72127526__returns the laps_collector instance.
     
    72147528[endsect]
    72157529
    7216 
    7217 [endsect]
    7218 
     7530[endsect]
     7531
     7532[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    72197533[section:laps_collector_req `LapsCollector` Requirements]
    72207534
    7221 
    7222 [endsect]
    7223 
    7224 
     7535A LapsCollector is collector of the duration of laps.
     7536
     7537A `C` meets the `LapsCollector` requirements if:
     7538
     7539* it meets the requirements specified in the following table.
     7540
     7541In this table `C` denote `LapsCollector` type, `c` is an instance of `C`, `ec` is instance of `system::error_code`.
     7542
     7543[table LapsCollector Requirements
     7544    [[expression]               [return type]                       [operational semantics]]
     7545    [[`C::duration`]      [`duration<>`]        [The collected duration type.]]
     7546    [[`c.store(c)`]            [-]                                 [stores a duration.]]
     7547    [[`c.reset()`]             [-]                                 [clears the collector.]]
     7548]
     7549
     7550
     7551[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7552[section:suspend `c.store(d)`]
     7553
     7554__effects Stores the duration `d` on the collector `c`.
     7555
     7556__throws `std::bad_alloc` when no memory is available`
     7557
     7558[endsect]
     7559[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7560[section:resume `clear()`]
     7561
     7562__effects Clears the collector.
     7563
     7564__throws Nothing.
     7565
     7566[endsect]
     7567
     7568[endsect]
     7569
     7570[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    72257571[section:suspendable_stopwatch_req `SuspendableStopwatch ` Requirements]
    72267572
     
    72367582[table Stopwatch Requirements
    72377583    [[expression]               [return type]                       [operational semantics]]
     7584    [[`S::scoped_suspend`]      [`__stopwatch_suspender<S>`]        [RAI which `suspend`/`resume` the `stopwatch`.]]
    72387585    [[`S::scoped_resume`]       [`__stopwatch_resumer<S>`]          [RAI which `resume`/`suspend` the `stopwatch`.]]
    7239     [[`S::scoped_resume`]       [`__stopwatch_resumer<S>`]          [RAI which `resume`/`suspend` the `stopwatch`.]]
     7586    [[`s.suspend()`]            [-]                                 [suspends a Stopwatch.]]
    72407587    [[`s.resume()`]             [-]                                 [resumes a Stopwatch.]]
    7241     [[`s.suspend()`]            [-]                                 [suspends a Stopwatch.]]
     7588    [[`sc.is_suspended()`]      [`bool`]                            [whether the stopwatch is suspended or not.]]
    72427589]
    72437590
    72447591
    7245 [section:suspend Member Function `suspend()`]
    7246 
    7247     duration suspend( system::error_code & ec = throws() );
     7592[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7593[section:suspend `s.suspend()`]
    72487594
    72497595__effects Suspends the stopwatch.
    72507596
     7597__throws Any exception the `S::clock::now` function can throw.
     7598
     7599[endsect]
     7600[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7601[section:suspend_ec `s.suspend(ec)`]
     7602
     7603__effects Suspends the stopwatch.
     7604
    72517605__throws Any exception the `S::clock::now` function can throw when `ec` is `throws()`
    72527606
    72537607[endsect]
    7254 [section:resume Member Function `resume()`]
    7255 
    7256     time_point resume( system::error_code & ec = throws() );
     7608[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7609[section:resume `s.resume()`]
    72577610
    72587611__effects Resumes the stopwatch.
    72597612
    7260 __returns the starting time point.
    7261 
    72627613__throws Any exception the `S::clock::now` function can throw.
    72637614
    72647615[endsect]
    7265 
    7266 [endsect]
    7267 
     7616[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7617[section:resume_ec `s.resume(ec)`]
     7618
     7619__effects Resumes the stopwatch.
     7620
     7621__throws Any exception the `S::clock::now` function can throw when `ec` is `throws()`
     7622
     7623[endsect]
     7624[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7625[section:is_suspended `sc.is_suspended()`]
     7626
     7627__return_type `bool`.
     7628
     7629__returns Whether the stopwatch is suspended or not.
     7630
     7631__throws Nothing.
     7632
     7633[endsect]
     7634
     7635[endsect]
     7636
     7637[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7638[section:formatter_req `Formatter` Requirements]
     7639
     7640A Formatter outputs on a given ostream a formatted string combining informations from a _StrictStopwatch, the format and the double precision.
     7641
     7642A Formatter must meet the requirements in the following Table.
     7643
     7644In this table `F`  denote a Formatter type, `S` is a StrictStopwatch and `s` is an instance of `S`, `f` is `const char *` , `p` is and `int`, and `os` is a `std::ostream`, ec is a `system::error_code`.
     7645
     7646[table Formatter Requirements
     7647    [[expression]        [return type]  [operational semantics]]
     7648    [[`F()`]        [F&&]  [Default constructible.]]
     7649    [[`F(os)`]        [F&&]  [Explicit Constructible from an std::basic_ostream.]]
     7650    [[`F(os)`]        [F&&]  [Explicit Constructible from an std::basic_ostream.]]
     7651    [[`F::set_precision(n)`]        [`-`]  [Sets the precision used when displaying a double.]]
     7652    [[`F::set_duration_style(ds)`]  [`-`]  [Sets the duration style used when displaying a duration.]]
     7653    [[`f(s)`]             [`S::time_point`]  [outputs on `os` a formatted string combining informations from the Stopwatch `s`, the format `f` and the double precision `p`.]]
     7654]
     7655
     7656
     7657Models of `Formatter`:
     7658
     7659
     7660[endsect]
     7661[endsect]
     7662
     7663[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    72687664[/==================================================]
    7269 [section:simple_stopwatch_hpp Header `<boost/chrono/stopwatches/simple_stopwatch.hpp>`]
     7665[section:stopwatch_scoped_hpp Header `<boost/chrono/stopwatches/stopwatch_scoped.hpp>`]
     7666[/==================================================]
     7667
     7668    namespace boost {
     7669      namespace chrono  {
     7670        template<class Stopwatch>
     7671        class stopwatch_runner;
     7672
     7673        template<class Stopwatch>
     7674        class stopwatch_stopper;
     7675
     7676        template<class Stopwatch>
     7677        class stopwatch_suspender;
     7678
     7679        template<class Stopwatch>
     7680        class stopwatch_resumer;
     7681      }
     7682    }
     7683       
     7684[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7685[section:stopwatch_runner Template Class `stopwatch_runner<>`]
     7686
     7687Maintains the stopwatch running during the lifetime.
     7688
     7689    template<class Stopwatch>
     7690    class stopwatch_runner
     7691    {
     7692    public:
     7693      typedef Stopwatch stopwatch;
     7694      stopwatch_runner() = delete;
     7695      stopwatch_runner(const stopwatch_runner&) = delete;
     7696      stopwatch_runner& operator=(const stopwatch_runner&) = delete;
     7697     
     7698      stopwatch_runner(stopwatch & s);
     7699      stopwatch_runner(stopwatch & s, system::error_code & ec);
     7700      ~stopwatch_runner();
     7701    };
     7702       
     7703[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7704[section:c Constructor `stopwatch_runner(stopwatch &s)`]
     7705     
     7706__requires `! s.is_running()`.
     7707         
     7708__effects Stores a reference `s` and as if `s.start()`.
     7709
     7710__post_condition `s.is_running()`.
     7711
     7712__throws Any exception the `s.start()`can throw.
     7713   
     7714[endsect]
     7715[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7716[section:c_ec Constructor `stopwatch_runner(stopwatch &s, system::error_code &ec)`]
     7717       
     7718__requires `! s.is_running()`.
     7719
     7720__effects Stores a reference `s` and as if `s.start(ec)`.
     7721
     7722__post_condition `s.is_running()`.
     7723
     7724__throws Any exception the `s.start(ec)`can throw when `ec` is `throws()`
     7725   
     7726[endsect]
     7727[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7728[section:d Destructor `~stopwatch_runner()`]
     7729       
     7730__effects As if `s.stop()`.
     7731
     7732__post_condition `! s.is_running()`.
     7733
     7734__throws Nothing.
     7735   
     7736[endsect]
     7737   
     7738[endsect]
     7739[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7740[section:stopwatch_stopper Template Class `stopwatch_stopper<>`]
     7741
     7742Maintains the stopwatch stopped during the lifetime.
     7743
     7744    template<class Stopwatch>
     7745    class stopwatch_stopper
     7746    {
     7747    public:
     7748      typedef Stopwatch stopwatch;
     7749      stopwatch_stopper() = delete;
     7750      stopwatch_stopper(const stopwatch_stopper&) = delete;
     7751      stopwatch_stopper& operator=(const stopwatch_stopper&) = delete;
     7752     
     7753      stopwatch_stopper(stopwatch & s);
     7754      stopwatch_stopper(stopwatch & s, system::error_code & ec);
     7755      ~stopwatch_stopper();
     7756    };
     7757       
     7758[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7759[section:c Constructor `stopwatch_stopper(stopwatch &s)`]
     7760       
     7761__requires `s.is_running()`.
     7762         
     7763__effects Stores a reference `s` and as if `s.stop()`.
     7764
     7765__post_condition `! s.is_running()`.
     7766
     7767__throws Any exception the `s.stop()` can throw.
     7768   
     7769[endsect]
     7770[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7771[section:c_ec Constructor `stopwatch_stopper(stopwatch &s, system::error_code &ec)`]
     7772       
     7773__requires `s.is_running()`.
     7774
     7775__effects Stores a reference `s` and as if `s.stop(ec)`.
     7776
     7777__post_condition `! s.is_running()`.
     7778
     7779__throws Any exception the `s.stop(ec)` can throw when `ec` is `throws()`
     7780   
     7781[endsect]
     7782[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7783[section:d Destructor `~stopwatch_stopper()`]
     7784       
     7785__effects As if `s.start()`.
     7786
     7787__post_condition `s.is_running()`.
     7788
     7789__throws Nothing.
     7790   
     7791[endsect]
     7792   
     7793[endsect]
     7794[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7795[section:stopwatch_suspender Template Class `stopwatch_suspender<>`]
     7796
     7797Maintains the stopwatch supended during the lifetime.
     7798
     7799    template<class Stopwatch>
     7800    class stopwatch_suspender
     7801    {
     7802    public:
     7803      typedef Stopwatch stopwatch;
     7804      stopwatch_suspender() = delete;
     7805      stopwatch_suspender(const stopwatch_suspender&) = delete;
     7806      stopwatch_suspender& operator=(const stopwatch_suspender&) = delete;
     7807      stopwatch_suspender(stopwatch & s);
     7808      stopwatch_suspender(stopwatch & s, system::error_code & ec);
     7809      ~stopwatch_suspender();
     7810    };
     7811       
     7812[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7813[section:c Constructor `stopwatch_suspender(stopwatch &s)`]
     7814     
     7815__requires `s.is_running() && ! s.is_suspended()`.
     7816         
     7817__effects Stores a reference `s` and as if `s.suspend()`.
     7818
     7819__post_condition `s.is_running() && s.is_suspended()`.
     7820
     7821__throws Any exception the `s.suspend()` can throw.
     7822   
     7823[endsect]
     7824[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7825[section:c_ec Constructor `stopwatch_suspender(stopwatch &s, system::error_code &ec)`]
     7826       
     7827__requires `s.is_running() && ! s.is_suspended()`.
     7828         
     7829__effects Stores a reference `s` and as if `s.suspend(ec)`.
     7830
     7831__post_condition `s.is_running() && s.is_suspended()`.
     7832
     7833__throws Any exception the `s.suspend(ec)` can throw.
     7834   
     7835[endsect]
     7836[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7837[section:d Destructor `~stopwatch_suspender()`]
     7838       
     7839__effects As if `s.resume()`.
     7840
     7841__post_condition `s.is_running() && ! s.is_suspended()`.
     7842
     7843__throws Nothing.
     7844   
     7845[endsect]
     7846   
     7847[endsect]
     7848[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7849[section:stopwatch_resumer Template Class `stopwatch_resumer<>`]
     7850
     7851Maintains the stopwatch resumed during the lifetime.
     7852
     7853    template<class Stopwatch>
     7854    class stopwatch_resumer
     7855    {
     7856    public:
     7857      typedef Stopwatch stopwatch;
     7858      stopwatch_resumer() = delete;
     7859      stopwatch_resumer(const stopwatch_resumer&) = delete;
     7860      stopwatch_resumer& operator=(const stopwatch_resumer&) = delete;
     7861      stopwatch_resumer(stopwatch & s);
     7862      stopwatch_resumer(stopwatch & s, system::error_code & ec);
     7863      ~stopwatch_resumer();
     7864    };
     7865
     7866       
     7867[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7868[section:c Constructor `stopwatch_resumer(stopwatch &s)`]
     7869     
     7870__requires `s.is_running() && s.is_suspended()`.
     7871         
     7872__effects Stores a reference `s` and as if `s.resume()`.
     7873
     7874__post_condition `s.is_running() && ! s.is_suspended()`.
     7875
     7876__throws Any exception the `s.resume()` can throw.
     7877   
     7878[endsect]
     7879[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7880[section:c_ec Constructor `stopwatch_resumer(stopwatch &s, system::error_code &ec)`]
     7881       
     7882__requires `s.is_running() && s.is_suspended()`.
     7883         
     7884__effects Stores a reference `s` and as if `s.resume(ec)`.
     7885
     7886__post_condition `s.is_running() && ! s.is_suspended()`.
     7887
     7888__throws Any exception the `s.resume(ec)` can throw.
     7889   
     7890[endsect]
     7891[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7892[section:d Destructor `~stopwatch_resumer()`]
     7893       
     7894__effects As if `s.suspend()`.
     7895
     7896__post_condition `s.is_running() && s.is_suspended()`.
     7897
     7898__throws Nothing.
     7899   
     7900[endsect]
     7901   
     7902[endsect]
     7903
     7904[endsect]
     7905
     7906
     7907[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7908[/==================================================]
     7909[section:strict_stopwatch_hpp Header `<boost/chrono/stopwatches/strict_stopwatch.hpp>`]
    72707910[/==================================================]
    72717911
     
    72737913      namespace chrono  {
    72747914        template <class __Clock=high_resolution_clock>
    7275         class simple_stopwatch;
     7915        class strict_stopwatch;
    72767916
    72777917        // useful typedefs
    7278         typedef <see above> system_simple_stopwatch;
     7918        typedef <see above> system_strict_stopwatch;
    72797919        #ifdef __BOOST_CHRONO_HAS_CLOCK_STEADY
    7280         typedef <see above> steady_simple_stopwatch;
     7920        typedef <see above> steady_strict_stopwatch;
    72817921        #endif
    7282         typedef <see above> high_resolution_simple_stopwatch;
     7922        typedef <see above> high_resolution_strict_stopwatch;
    72837923    }}
    72847924
    7285 [section:simple_stopwatch Template Class `simple_stopwatch<>`]
     7925[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7926[section:strict_stopwatch Template Class `strict_stopwatch<>`]
    72867927
    72877928Knowing how long a part of a program takes to execute is useful in both test and production environments.
    7288 A __simple_stopwatch` object measures elapsed time. It is recommended to use it with clocks that measure wall clock rather than CPU time since the intended use is performance measurement on systems where total elapsed time is more important than just process or CPU time.
     7929A __strict_stopwatch` object measures elapsed time. It is recommended to use it with clocks that measure wall clock rather than CPU time since the intended use is performance measurement on systems where total elapsed time is more important than just process or CPU time.
    72897930
    72907931The maximum measurable elapsed time depends on the __Clock parameter. The accuracy of timings depends on the
    72917932accuracy of timing information provided the __Clock, and this could varies a great deal from one clock to another.
    72927933
    7293 `simple_stopwatch <>` is a model of a __simple_stopwatch_concept.
    7294 
    7295         template <class __Clock> class simple_stopwatch {
     7934`strict_stopwatch <>` is a model of a __strict_stopwatch_concept.
     7935
     7936        template <class __Clock> class strict_stopwatch {
    72967937        public:
    72977938            typedef Clock                       clock;
     
    72997940            typedef typename Clock::time_point  time_point;
    73007941
    7301             simple_stopwatch( );
    7302             explicit simple_stopwatch( system::error_code & ec );
    7303 
    7304             ~simple_stopwatch();
     7942            strict_stopwatch( );
     7943            explicit strict_stopwatch( system::error_code & ec );
     7944
     7945            ~strict_stopwatch();
    73057946
    73067947            duration elapsed( );
     
    73097950        };
    73107951
    7311 Only the specificities of this class are documented here. See __simple_stopwatch_concept for the common parts.
    7312 
    7313 [section:c1 Constructor `simple_stopwatch()`]
    7314 
    7315             simple_stopwatch();
    7316 
    7317 __effects constructs and starts the simple_stopwatch.
     7952Only the specificities of this class are documented here. See __strict_stopwatch_concept for the common parts.
     7953
     7954[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7955[section:c1 Constructor `strict_stopwatch()`]
     7956
     7957            strict_stopwatch();
     7958
     7959__effects constructs and starts the strict_stopwatch.
    73187960
    73197961__throws Any exception the `Clock::now()`can throw.
     
    73217963[endsect]
    73227964
    7323 [section:c2 Constructor `simple_stopwatch( system::error_code &)`]
    7324 
    7325             explicit simple_stopwatch( system::error_code & ec = throws() );
    7326 
    7327 __effects constructs and starts the simple_stopwatch.
     7965[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7966[section:c2 Constructor `strict_stopwatch( system::error_code &)`]
     7967
     7968            explicit strict_stopwatch( system::error_code & ec = throws() );
     7969
     7970__effects constructs and starts the strict_stopwatch.
    73287971
    73297972__throws Any exception the `Clock::now()`can throw when `ec` is `throws()`
     
    73337976[endsect]
    73347977
    7335 [section:typedefs `simple_stopwatch` useful typedefs]
     7978[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7979[section:typedefs `strict_stopwatch` useful typedefs]
    73367980
    73377981The following typedef are provided as syntactic sugar.
    73387982
    7339         typedef simple_stopwatch< boost::chrono::system_clock > system_simple_stopwatch;
     7983        typedef strict_stopwatch< boost::chrono::system_clock > system_strict_stopwatch;
    73407984        #ifdef __BOOST_CHRONO_HAS_CLOCK_STEADY
    7341         typedef simple_stopwatch< boost::chrono:: steady_clock >  steady_simple_stopwatch;
     7985        typedef strict_stopwatch< boost::chrono:: steady_clock >  steady_strict_stopwatch;
    73427986        #endif
    7343         typedef simple_stopwatch< boost::chrono:: high_resolution_clock >  high_resolution_simple_stopwatch;
    7344 
    7345 [endsect]
    7346 [endsect]
    7347 [endsect]
    7348 
    7349 
     7987        typedef strict_stopwatch< boost::chrono:: high_resolution_clock >  high_resolution_strict_stopwatch;
     7988
     7989[endsect] [/ typedefs]
     7990[endsect] [/ header ]
     7991
     7992
     7993[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     7994[/==================================================]
     7995[section:stopwatch_hpp Header `<boost/chrono/stopwatches/stopwatch.hpp>`]
     7996[/==================================================]
     7997
     7998    namespace boost {
     7999      namespace chrono  {
     8000        template<typename __Clock=high_resolution_clock, typename __LapsCollector=no_memory<typename Clock::duration> >
     8001        class stopwatch;
     8002       
     8003        // useful typedefs
     8004        typedef <see above> system_stopwatch;
     8005        #ifdef __BOOST_CHRONO_HAS_CLOCK_STEADY
     8006        typedef <see above> steady_stopwatch;
     8007        #endif
     8008        typedef <see above> high_resolution_stopwatch;
     8009    }}
     8010
     8011[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8012[section:stopwatch Template Class `stopwatch<>`]
     8013
     8014A __stopwatch is a model of __Stopwatch taking as parameters the __Clock and the __LapsCollector.
     8015
     8016The main difference respect to a __strict_stopwatch is that the user can stop it.
     8017
     8018Each sequence of start-stop results in a new elapsed duration sample that is provided to the __LapsCollector.
     8019It is up to the __LapsCollector to do whatever it wants with each sample.
     8020
     8021Even if it is preferable to use process or thread wide clocks, the default of the Clock parameter is high_resolution_clock,
     8022as it is the single one ensured on all platforms.
     8023     
     8024The maximum measurable elapsed time depends on the __Clock parameter. The accuracy of timings depends on the
     8025accuracy of timing information provided the __Clock, and this could varies a great deal from one clock to another.
     8026
     8027`stopwatch <>` is a model of a __Stopwatch.
     8028
     8029    template<typename Clock, typename LapsCollector >
     8030    class stopwatch
     8031    {
     8032    public:
     8033      typedef Clock clock;
     8034      typedef LapsCollector laps_collector;
     8035      typedef typename Clock::duration duration;
     8036      typedef typename Clock::time_point time_point;
     8037      typedef typename Clock::rep rep;
     8038      typedef typename Clock::period period;
     8039      BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
     8040
     8041      stopwatch();
     8042      explicit stopwatch(system::error_code & ec);
     8043      explicit stopwatch(const dont_start_t&) noexcept;
     8044      explicit stopwatch(laps_collector const& coll);
     8045      stopwatch(laps_collector const& acc, system::error_code & ec);
     8046      stopwatch(laps_collector const& acc, const dont_start_t&);
     8047
     8048      ~stopwatch();
     8049
     8050      void restart();
     8051      void restart(system::error_code & ec);
     8052
     8053      void start();
     8054      void start(system::error_code & ec);
     8055
     8056      void stop();
     8057      void stop(system::error_code & ec);
     8058
     8059      bool is_running() const;
     8060
     8061      /**
     8062       * Elapsed time getter for the current lap.
     8063       *
     8064       * Returns: the elapsed time since the last start if no internal error occur.
     8065       *
     8066       */
     8067      duration elapsed_current_lap() const;
     8068
     8069      /**
     8070       * Elapsed time getter for the current lap.
     8071       *
     8072       * Effects: Assign the error code if any internal error occur while retrieving the current time.
     8073       *
     8074       * Returns: the elapsed time since the start if no internal error occur.
     8075       *
     8076       */
     8077      duration elapsed_current_lap(system::error_code & ec) const;
     8078
     8079      duration elapsed() const;
     8080      duration elapsed(system::error_code & ec) const;
     8081      /**
     8082       * Elapsed time for the last lap.
     8083       *
     8084       * Returns: the elapsed time of the last lap.
     8085       *
     8086       */
     8087      duration last() const;
     8088     
     8089      void reset();
     8090      laps_collector const& get_laps_collector() const noexcept;
     8091
     8092      typedef stopwatch_runner<stopwatch<Clock, LapsCollector> > scoped_run;
     8093      typedef stopwatch_stopper<stopwatch<Clock, LapsCollector> > scoped_stop;
     8094
     8095    };
     8096
     8097
     8098Only the specificities of this class are documented here. See __Stopwatch for the common parts.
     8099
     8100[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8101[section:c Constructor `stopwatch()`]
     8102
     8103            stopwatch();
     8104
     8105__effects constructs and starts the stopwatch.
     8106
     8107__post_conditions: `is_running()`.
     8108
     8109__throws Any exception the `Clock::now()`can throw.
     8110
     8111[endsect]
     8112[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8113[section:c_ec Constructor `stopwatch( system::error_code &ec)`]
     8114
     8115            explicit stopwatch( system::error_code & ec = throws() );
     8116
     8117__effects constructs and starts the stopwatch.
     8118
     8119__post_conditions: `ec || is_running()`.
     8120
     8121__throws Any exception the `Clock::now()`can throw when `ec` is `throws()`
     8122
     8123[endsect]
     8124[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8125[section:c_ns Constructor `stopwatch( const dont_start_t& )`]
     8126
     8127      explicit stopwatch(const dont_start_t&) noexcept;
     8128
     8129__effects constructs and not starts the stopwatch.
     8130
     8131__post_conditions: `! is_running()`.
     8132
     8133__throws Nothing`
     8134
     8135[endsect]
     8136[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8137[section:c_coll Constructor `stopwatch(laps_collector const&)`]
     8138
     8139      explicit stopwatch(laps_collector const& coll);
     8140
     8141__effects constructs copying the laps collector and starts the stopwatch.
     8142
     8143__post_conditions: `is_running()`.
     8144
     8145__throws Any exception the `Clock::now()` or the __LapsCollector copy can throw.
     8146
     8147[endsect]
     8148[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8149[section:c_coll_ec Constructor `stopwatch(laps_collector const&, system::error_code &)`]
     8150
     8151      explicit stopwatch(laps_collector const& acc, system::error_code & ec);
     8152
     8153__effects constructs copying the laps collector and starts the stopwatch. Assign the error code if any internal error occur while retrieving the current time.
     8154
     8155__post_conditions: `ec || is_running()`.
     8156
     8157__throws Any exception the `Clock::now()` or the __LapsCollector copy can throw when `ec` is `throws()`
     8158
     8159[endsect]
     8160[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8161[section:c_coll_ns Constructor `stopwatch(laps_collector const&, const dont_start_t&)`]
     8162
     8163      stopwatch(laps_collector const& acc, const dont_start_t&);
     8164
     8165__effects constructs copying the laps collector and don't starts the stopwatch.
     8166
     8167__post_conditions: `! is_running()`.
     8168
     8169__throws Any exception the __LapsCollector copy can throw`
     8170
     8171[endsect]
     8172
     8173
     8174
     8175[endsect]
     8176[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8177[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8178[section:typedefs `stopwatch` useful typedefs]
     8179
     8180The following typedef are provided as syntactic sugar.
     8181
     8182        typedef stopwatch< boost::chrono::system_clock > system_stopwatch;
     8183        #ifdef __BOOST_CHRONO_HAS_CLOCK_STEADY
     8184        typedef stopwatch< boost::chrono:: steady_clock >  steady_stopwatch;
     8185        #endif
     8186        typedef stopwatch< boost::chrono:: high_resolution_clock >  high_resolution_stopwatch;
     8187
     8188[endsect] [/ typedefs]
     8189[endsect] [/ header ]
     8190
     8191
     8192[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8193[/==================================================]
     8194[section:suspendable_stopwatch_hpp Header `<boost/chrono/stopwatches/suspendable_stopwatch.hpp>`]
     8195[/==================================================]
     8196
     8197    namespace boost {
     8198      namespace chrono  {
     8199        template<typename __Clock=high_resolution_clock, typename __LapsCollector=no_memory<typename Clock::duration> >
     8200        class suspendable_stopwatch;
     8201       
     8202        // useful typedefs
     8203        typedef <see above> system_suspendable_stopwatch;
     8204        #ifdef __BOOST_CHRONO_HAS_CLOCK_STEADY
     8205        typedef <see above> steady_suspendable_stopwatch;
     8206        #endif
     8207        typedef <see above> high_resolution_suspendable_stopwatch;
     8208    }}
     8209
     8210[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8211[section:suspendable_stopwatch Template Class `suspendable_stopwatch<>`]
     8212
     8213A __suspendable_stopwatch is a model of __SuspendableStopwatch taking as parameters the __Clock and the __LapsCollector.
     8214
     8215The main difference respect to a __stopwatch is that the user can suspend/resume it.
     8216
     8217Each sequence of start-stop results in a new elapsed duration sample that is provided to the __LapsCollector.
     8218This lap can be suspended/resumed.
     8219
     8220Even if it is preferable to use process or thread wide clocks, the default of the Clock parameter is high_resolution_clock,
     8221as it is the single one ensured on all platforms.
     8222     
     8223The maximum measurable elapsed time depends on the __Clock parameter. The accuracy of timings depends on the
     8224accuracy of timing information provided the __Clock, and this could varies a great deal from one clock to another.
     8225
     8226`suspendable_stopwatch<>` is a model of a __SuspendableStopwatch.
     8227
     8228    template<typename Clock, typename LapsCollector >
     8229    class suspendable_stopwatch
     8230    {
     8231    public:
     8232      typedef Clock clock;
     8233      typedef LapsCollector laps_collector;
     8234      typedef typename Clock::duration duration;
     8235      typedef typename Clock::time_point time_point;
     8236      typedef typename Clock::rep rep;
     8237      typedef typename Clock::period period;
     8238      BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
     8239
     8240      suspendable_stopwatch();
     8241      explicit suspendable_stopwatch(system::error_code & ec);
     8242      explicit suspendable_stopwatch(const dont_start_t&) noexcept;
     8243      explicit suspendable_stopwatch(laps_collector const& coll);
     8244      suspendable_stopwatch(laps_collector const& acc, system::error_code & ec);
     8245      suspendable_stopwatch(laps_collector const& acc, const dont_start_t&);
     8246
     8247      ~suspendable_stopwatch();
     8248
     8249      void restart();
     8250      void restart(system::error_code & ec);
     8251
     8252      void start();
     8253      void start(system::error_code & ec);
     8254
     8255      void stop();
     8256      void stop(system::error_code & ec);
     8257
     8258      void suspend();
     8259      void suspend(system::error_code & ec);
     8260
     8261      void resume();
     8262      void resume(system::error_code & ec);
     8263
     8264      void reset();
     8265      void reset(system::error_code & ec);
     8266
     8267      bool is_running() const;
     8268      bool is_elapsed() const;
     8269
     8270      duration elapsed_current_lap() const;
     8271      duration elapsed_current_lap(system::error_code & ec) const;
     8272
     8273      duration elapsed() const;
     8274      duration elapsed(system::error_code & ec) const;
     8275     
     8276      duration last() const;
     8277     
     8278      laps_collector const& get_laps_collector() const noexcept;
     8279
     8280      typedef stopwatch_runner<suspendable_stopwatch<Clock, LapsCollector> > scoped_run;
     8281      typedef stopwatch_stopper<suspendable_stopwatch<Clock, LapsCollector> > scoped_stop;
     8282      typedef stopwatch_suspender<suspendable_stopwatch<Clock, LapsCollector> > scoped_suspend;
     8283      typedef stopwatch_resumer<suspendable_stopwatch<Clock, LapsCollector> > scoped_resume;
     8284
     8285    };
     8286
     8287
     8288Only the specificities of this class are documented here. See __Stopwatch for the common parts.
     8289
     8290[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8291[section:c Constructor `suspendable_stopwatch()`]
     8292
     8293            suspendable_stopwatch();
     8294
     8295__effects constructs and starts the stopwatch.
     8296
     8297__post_conditions: `is_running() && ! is_suspended()`.
     8298
     8299__throws Any exception the `Clock::now()`can throw.
     8300
     8301[endsect]
     8302[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8303[section:c_ec Constructor `suspendable_stopwatch( system::error_code &ec)`]
     8304
     8305            explicit suspendable_stopwatch( system::error_code & ec = throws() );
     8306
     8307__effects constructs and starts the stopwatch.
     8308
     8309__post_conditions: `is_running() && ! is_suspended()`.
     8310
     8311__throws Any exception the `Clock::now()`can throw when `ec` is `throws()`
     8312
     8313[endsect]
     8314[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8315[section:c_ns Constructor `suspendable_stopwatch( const dont_start_t& )`]
     8316
     8317      explicit suspendable_stopwatch(const dont_start_t&) noexcept;
     8318
     8319__effects constructs and not starts the stopwatch.
     8320
     8321__post_conditions: `! is_running() && ! is_suspended()`.
     8322
     8323__throws Nothing`
     8324
     8325[endsect]
     8326[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8327[section:c_coll Constructor `suspendable_stopwatch(laps_collector const&)`]
     8328
     8329      explicit suspendable_stopwatch(laps_collector const& coll);
     8330
     8331__effects constructs copying the laps collector and starts the stopwatch.
     8332
     8333__post_conditions: `is_running() && ! is_suspended()`.
     8334
     8335__throws Any exception the `Clock::now()` or the __LapsCollector copy can throw.
     8336
     8337[endsect]
     8338[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8339[section:c_coll_ec Constructor `suspendable_stopwatch(laps_collector const&, system::error_code &)`]
     8340
     8341      explicit suspendable_stopwatch(laps_collector const& acc, system::error_code & ec);
     8342
     8343__effects constructs copying the laps collector and starts the stopwatch. Assign the error code if any internal error occur while retrieving the current time.
     8344
     8345__post_conditions: `ec || (is_running() && ! is_suspended())`.
     8346
     8347__throws Any exception the `Clock::now()` or the __LapsCollector copy can throw when `ec` is `throws()`
     8348
     8349[endsect]
     8350[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8351[section:c_coll_ns Constructor `suspendable_stopwatch(laps_collector const&, const dont_start_t&)`]
     8352
     8353      suspendable_stopwatch(laps_collector const& acc, const dont_start_t&);
     8354
     8355__effects constructs copying the laps collector and don't starts the stopwatch.
     8356
     8357__post_conditions: `! is_running() && ! is_suspended()`.
     8358
     8359__throws Any exception the __LapsCollector copy can throw`
     8360
     8361[endsect]
     8362
     8363
     8364
     8365[endsect]
     8366[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8367[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8368[section:typedefs `suspendable_stopwatch` useful typedefs]
     8369
     8370The following typedef are provided as syntactic sugar.
     8371
     8372        typedef suspendable_stopwatch< boost::chrono::system_clock > system_suspendable_stopwatch;
     8373        #ifdef __BOOST_CHRONO_HAS_CLOCK_STEADY
     8374        typedef suspendable_stopwatch< boost::chrono:: steady_clock >  steady_suspendable_stopwatch;
     8375        #endif
     8376        typedef suspendable_stopwatch< boost::chrono:: high_resolution_clock >  high_resolution_suspendable_stopwatch;
     8377
     8378[endsect] [/ typedefs]
     8379[endsect] [/ header ]
     8380[endsect] [/ reference]
     8381
     8382
     8383[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8384[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    73508385[/
    73518386[section:deprecated Deprecated Headers]
     
    75578592[endsect]
    75588593]
    7559 
    7560 [endsect]
    7561 
    7562 
     8594[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8595[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
     8596
     8597[endsect]
     8598
     8599
     8600[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    75638601[/=================]
    75648602[section Appendices]
    75658603[/=================]
    75668604
     8605[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    75678606[/==================================]
    75688607[section:history Appendix: History]
    75698608[/==================================]
     8609[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    75708610[section [*Version 2.0.0, July 1, 2012] ]
    75718611
     
    75788618[*Deprecated:]
    75798619
    7580 * The chrono i/o version included in Boost.Chrono 1.2.x has been completmly refactored in version 2.0.0
     8620* The chrono i/o version included in Boost.Chrono 1.2.x has been completly refactored in version 2.0.0
    75818621* chrono I/O: The manipulators __duration_short, __duration_long are depreceated. You should use the parameterized form __duration_fmt or the renamed manipulators __duration_symbol and __duration_prefix  instead.
    75828622* chrono I/O: The duraction_punc<> facet is depreceated. You should use the __get_duration_style free function to get the informations and use the duration_units facet for localization purposes.
     
    75928632[endsect] [/section [*Version 2.0.0] ]
    75938633
     8634[//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////]
    75948635[section [*Version 1.2.2, April 1, 2012 - 1.50] ]
    75958636
     
    78148855* Added `scope_suspend` which do `suspend`/`resume` if the __Clock is a model of __SuspendibleClock__ concept, and nothing otherwise.
    78158856* __thread_clock support on platforms providing it natively.
    7816 * Added support for wide character for __stopwatch_reporter__, `stopclock`, and `stopclock_accumulator`.
     8857* Added support for wide character for __stopwatch_reporter, `stopclock`, and `stopclock_accumulator`.
    78178858* `digital_time` renamed `t24_hours`.
    78188859
     
    78698910* Added new __Stopwatch__ concept measuring elapsed time between different points in time associated to the operations `start`, `stop`, `suspend` and `resume`.
    78708911* Added __stopwatch__ is a model __Stopwatch__ measuring the elapsed time between the `start` and the `stop` operations.
    7871 * Added __stopwatch_accumulator__ is a model __Stopwatch__ allowing to accumulate several time samples and gives the average, ...
     8912* Added __laps_stopwatch is a model __Stopwatch__ allowing to accumulate several time samples and gives the average, ...
    78728913* Added scoped helper classes allowing to pairwise `start`/`stop` operations, `suspend`/`resume` and `resume`/`suspend` a __Stopwatch__.
    78738914* Added new stopwatch __Formatter__ concept
     
    78768917    * Added time formatter "real %rs, cpu %cs (%p%), user %us, system %ss\\n"
    78778918    * Added digital_time formatter "%d days(s) %h:%m:%s.%n\\n"
    7878 * __stopwatch_reporter__ is a convenient generic class reporting elapsed time for the Stopwatch concept.
     8919* __stopwatch_reporter is a convenient generic class reporting elapsed time for the Stopwatch concept.
    78798920* Added `stopclock<__Clock>` shortcut `stopwatch_reporter<stopwatch<__Clock>>`
    78808921* Added __scoped_stopclock__ which trace at the constuctor and destructor.
  • trunk/libs/chrono/example/stopwatch_example.cpp

    r74679 r79029  
    77
    88//#include <iostream>
    9 #include <boost/chrono/stopwatches/simple_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/strict_stopwatch.hpp>
    1010#include <boost/chrono/chrono_io.hpp>
    1111#include <boost/chrono/process_cpu_clocks.hpp>
     
    3636int f1(long j)
    3737{
    38   simple_stopwatch<clock_type> sw;
     38  strict_stopwatch<clock_type> sw;
    3939
    4040  for ( long i = 0; i < j; ++i )
     
    4747int main()
    4848{
    49   simple_stopwatch<clock_type> sw;
     49  strict_stopwatch<clock_type> sw;
    5050
    5151  f1(1000);
  • trunk/libs/chrono/example/stopwatch_reporter_example.cpp

    r74637 r79029  
    77
    88//#include <iostream>
    9 #include <boost/chrono/stopwatches/simple_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/strict_stopwatch.hpp>
    1010#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
    1111#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
     
    1818{
    1919  std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
    20   stopwatch_reporter<simple_stopwatch<> > sw;
     20  stopwatch_reporter<strict_stopwatch<> > sw;
    2121  std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
    2222
     
    3030{
    3131  std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
    32   stopwatch_reporter<simple_stopwatch<> > sw;
     32  stopwatch_reporter<strict_stopwatch<> > sw;
    3333  std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
    3434
  • trunk/libs/chrono/test/Jamfile.v2

    r78719 r79029  
    446446    test-suite "stopclock"
    447447        :
    448         [ stopwatch-run2 stopwatch/simple_stopwatch_reporter_pass.cpp  : simple_stopwatch_reporter_p ]
     448        [ stopwatch-run2 stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp  : basic_stopwatch_reporter_laps_accumulator_set_p ]
     449        #[ stopwatch-run2 stopwatch/basic_stopwatch_reporter_laps_container_pass.cpp  : basic_stopwatch_reporter_laps_container_p ]
     450        #[ stopwatch-run2 stopwatch/basic_stopwatch_reporter_last_lap_pass.cpp  : basic_stopwatch_reporter_last_lap_p ]
     451        #[ stopwatch-run2 stopwatch/basic_stopwatch_reporter_last_lap_pass.cpp  : basic_stopwatch_reporter_last_lap_p ]
    449452        [ stopwatch-run2 stopwatch/basic_stopwatch_reporter_pass.cpp  : basic_stopwatch_reporter_p ]
    450         [ stopwatch-run2 stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp  : basic_stopwatch_reporter_laps_accumulator_set_p ]
    451453        [ stopwatch-run2 stopwatch/laps_stopclock_pass.cpp  : laps_stopclock_p ]
    452454        [ stopwatch-run2 stopwatch/laps_stopclock_laps_accumulator_set_pass.cpp  : laps_stopclock_laps_accumulator_set_p ]
     455        [ stopwatch-run2 stopwatch/simple_stopclock_pass.cpp  : simple_stopclock_p ]
     456        [ stopwatch-run2 stopwatch/simple_stopwatch_reporter_pass.cpp  : simple_stopwatch_reporter_p ]
    453457
    454458        ;
  • trunk/libs/chrono/test/cycle_count.hpp

    r75408 r79029  
    1111#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
    1212#include <boost/chrono/stopwatches/formatters/elapsed_formatter.hpp>
    13 #include <boost/chrono/stopwatches/simple_stopwatch.hpp>
     13#include <boost/chrono/stopwatches/strict_stopwatch.hpp>
    1414
    1515namespace ex
     
    6565
    6666    template <typename CharT, long long speed>
    67     struct basic_stopwatch_reporter_default_formatter<CharT, simple_stopwatch<ex::cycle_count<speed> > >
     67    struct basic_stopwatch_reporter_default_formatter<CharT, strict_stopwatch<ex::cycle_count<speed> > >
    6868    {
    6969      typedef basic_elapsed_formatter<milli, CharT> type;
     
    7171
    7272//    template <long long speed>
    73 //    struct wstopwatch_reporter_default_formatter<simple_stopwatch<ex::cycle_count<speed> > >
     73//    struct wstopwatch_reporter_default_formatter<strict_stopwatch<ex::cycle_count<speed> > >
    7474//    {
    7575//      typedef welapsed_formatter type;
  • trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/laps_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/stopwatch.hpp>
    1010#include <boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp>
    1111#include <libs/chrono/test/cycle_count.hpp>
     
    213213{
    214214  std::cout << "cycle_count=";
    215   check_all<boost::chrono::laps_stopwatch< ex::cycle_count<1500>, boost::chrono::laps_accumulator_set<ex::cycle_count<1500>::duration> > >();
     215  check_all<boost::chrono::stopwatch< ex::cycle_count<1500>, boost::chrono::laps_accumulator_set<ex::cycle_count<1500>::duration> > >();
    216216  return boost::report_errors();
    217217}
  • trunk/libs/chrono/test/stopwatch/basic_stopwatch_laps_container_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/laps_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/stopwatch.hpp>
    1010#include <boost/chrono/stopwatches/collectors/laps_sequence_container.hpp>
    1111#include <libs/chrono/test/cycle_count.hpp>
     
    213213{
    214214  std::cout << "cycle_count=";
    215   check_all<boost::chrono::laps_stopwatch< ex::cycle_count<1500>, boost::chrono::laps_sequence_container<ex::cycle_count<1500>::duration> > >();
     215  check_all<boost::chrono::stopwatch< ex::cycle_count<1500>, boost::chrono::laps_sequence_container<ex::cycle_count<1500>::duration> > >();
    216216  return boost::report_errors();
    217217}
  • trunk/libs/chrono/test/stopwatch/basic_stopwatch_last_lap_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/laps_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/stopwatch.hpp>
    1010#include <boost/chrono/stopwatches/collectors/last_lap.hpp>
    1111#include <libs/chrono/test/cycle_count.hpp>
     
    215215{
    216216  std::cout << "cycle_count=";
    217   check_all<boost::chrono::laps_stopwatch< ex::cycle_count<1500>, boost::chrono::last_lap<ex::cycle_count<1500>::duration> > >();
     217  check_all<boost::chrono::stopwatch< ex::cycle_count<1500>, boost::chrono::last_lap<ex::cycle_count<1500>::duration> > >();
    218218  return boost::report_errors();
    219219}
  • trunk/libs/chrono/test/stopwatch/basic_stopwatch_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/laps_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/stopwatch.hpp>
    1010#include <libs/chrono/test/cycle_count.hpp>
    1111#include <boost/detail/lightweight_test.hpp>
     
    189189{
    190190  std::cout << "cycle_count=";
    191   check_all<boost::chrono::laps_stopwatch< ex::cycle_count<1500> > >();
    192 
     191  check_all<boost::chrono::stopwatch< ex::cycle_count<1500> > >();
    193192
    194193  return boost::report_errors();
  • trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_laps_accumulator_set_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/laps_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/stopwatch.hpp>
    1010#include <libs/chrono/test/cycle_count.hpp>
    1111#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
    1212#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
    13 #include <boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp>
     13#include <boost/chrono/stopwatches/reporters/laps_accumulator_set_stopwatch_default_formatter.hpp>
    1414#include <boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp>
    1515
     
    220220void check_all()
    221221{
    222   typedef stopwatch_reporter<laps_stopwatch<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration> > > Reporter;
    223   typedef stopwatch_reporter<laps_stopwatch<Clock>, elapsed_formatter > ReporterE;
     222  typedef stopwatch_reporter<stopwatch<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration> > > Reporter;
     223  typedef stopwatch_reporter<stopwatch<Clock>, elapsed_formatter > ReporterE;
    224224
    225225  check_invariants<Reporter>();
     
    248248int main()
    249249{
    250   typedef laps_stopwatch<high_resolution_clock > Stopwatch;
     250  typedef stopwatch<high_resolution_clock > Stopwatch;
    251251  typedef basic_stopwatch_reporter_default_formatter<char, Stopwatch>::type Formatter;
    252252  typedef stopwatch_reporter<Stopwatch> Reporter;
  • trunk/libs/chrono/test/stopwatch/basic_stopwatch_reporter_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/laps_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/stopwatch.hpp>
    1010#include <libs/chrono/test/cycle_count.hpp>
    1111#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
     
    218218void check_all()
    219219{
    220   typedef stopwatch_reporter<laps_stopwatch<Clock> > Reporter;
    221   typedef stopwatch_reporter<laps_stopwatch<Clock>, elapsed_formatter > ReporterE;
     220  typedef stopwatch_reporter<stopwatch<Clock> > Reporter;
     221  typedef stopwatch_reporter<stopwatch<Clock>, elapsed_formatter > ReporterE;
    222222
    223223  check_invariants<Reporter>();
     
    245245int main()
    246246{
    247   typedef laps_stopwatch<high_resolution_clock > Stopwatch;
     247  typedef stopwatch<high_resolution_clock > Stopwatch;
    248248  typedef basic_stopwatch_reporter_default_formatter<char, Stopwatch>::type Formatter;
    249249  typedef stopwatch_reporter<Stopwatch> Reporter;
  • trunk/libs/chrono/test/stopwatch/laps_stopclock_laps_accumulator_set_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/reporters/laps_stopclock.hpp>
     9#include <boost/chrono/stopwatches/reporters/stopclock.hpp>
    1010#include <libs/chrono/test/cycle_count.hpp>
    1111#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
     
    219219{
    220220
    221   typedef laps_stopclock<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration> > Reporter;
    222   typedef laps_stopclock<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration>, elapsed_formatter > ReporterE;
     221  typedef stopclock<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration> > Reporter;
     222  typedef stopclock<Clock, boost::chrono::laps_accumulator_set<typename Clock::duration>, elapsed_formatter > ReporterE;
    223223
    224224  check_invariants<Reporter>();
     
    247247int main()
    248248{
    249   typedef laps_stopclock<high_resolution_clock > Reporter;
     249  typedef stopclock<high_resolution_clock > Reporter;
    250250
    251251  static Reporter::formatter_type fmtr;
  • trunk/libs/chrono/test/stopwatch/laps_stopclock_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/reporters/laps_stopclock.hpp>
     9#include <boost/chrono/stopwatches/reporters/stopclock.hpp>
    1010#include <libs/chrono/test/cycle_count.hpp>
    1111#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
     
    217217void check_all()
    218218{
    219   typedef laps_stopclock<Clock> Reporter;
    220   typedef laps_stopclock<Clock, no_memory<typename Clock::duration>, elapsed_formatter > ReporterE;
     219  typedef stopclock<Clock> Reporter;
     220  typedef stopclock<Clock, no_memory<typename Clock::duration>, elapsed_formatter > ReporterE;
    221221
    222222  check_invariants<Reporter>();
     
    244244int main()
    245245{
    246   typedef laps_stopclock<high_resolution_clock > Reporter;
     246  typedef stopclock<high_resolution_clock > Reporter;
    247247
    248248  static Reporter::formatter_type fmtr;
  • trunk/libs/chrono/test/stopwatch/simple_stopwatch_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/simple_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/strict_stopwatch.hpp>
    1010#include <libs/chrono/test/cycle_count.hpp>
    1111#include <boost/detail/lightweight_test.hpp>
     
    6060void check_all(bool check=true)
    6161{
    62   typedef boost::chrono::simple_stopwatch<Clock> Stopwatch;
     62  typedef boost::chrono::strict_stopwatch<Clock> Stopwatch;
    6363  check_invariants<Stopwatch>();
    6464  check_default_constructor<Stopwatch>();
  • trunk/libs/chrono/test/stopwatch/simple_stopwatch_reporter_pass.cpp

    r75717 r79029  
    77#include <iostream>
    88#include <boost/type_traits/is_same.hpp>
    9 #include <boost/chrono/stopwatches/simple_stopwatch.hpp>
     9#include <boost/chrono/stopwatches/strict_stopwatch.hpp>
    1010#include <libs/chrono/test/cycle_count.hpp>
    1111#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
     
    3131    BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::duration, typename Stopwatch::clock::time_point::duration>::value), NOTHING, ());
    3232    BOOST_CHRONO_STATIC_ASSERT(Stopwatch::is_steady == Stopwatch::clock::is_steady, NOTHING, ());
    33     BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::stopwatch, simple_stopwatch<typename Stopwatch::clock> >::value), NOTHING, ());
     33    BOOST_CHRONO_STATIC_ASSERT((boost::is_same<typename Stopwatch::stopwatch_type, strict_stopwatch<typename Stopwatch::clock> >::value), NOTHING, ());
    3434}
    3535
     
    111111void check_all(bool check=true)
    112112{
    113   typedef stopwatch_reporter<simple_stopwatch<Clock> > Reporter;
    114   typedef stopwatch_reporter<simple_stopwatch<Clock>, elapsed_formatter > ReporterE;
     113  typedef stopwatch_reporter<strict_stopwatch<Clock> > Reporter;
     114  typedef stopwatch_reporter<strict_stopwatch<Clock>, elapsed_formatter > ReporterE;
    115115
    116116  check_invariants<Reporter>();
     
    127127int main()
    128128{
    129   typedef simple_stopwatch<high_resolution_clock > Stopwatch;
     129  typedef strict_stopwatch<high_resolution_clock > Stopwatch;
    130130  typedef basic_stopwatch_reporter_default_formatter<char, Stopwatch>::type Formatter;
    131131  typedef stopwatch_reporter<Stopwatch> Reporter;
Note: See TracChangeset for help on using the changeset viewer.