Boost logo

Boost :

Subject: [boost] [chrono] v0.3 New Stopwatch Feature
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-01-17 15:14:24


I'm pleased to announce the new version of the Boost.Chrono library. The implementaton is quite stable; the new interface could suffer of some modifications, renaming, ... as far as you submit some proposals. I would request a formal review soon and I will need a review manager. I know that review managers are hard to find, so if you are interested in the library, please the Review Wizards.

The library can be downloaded from and the documentation is online on the sandbox

I've tested it with gcc and MSVC. Previoous version of the library have been testted on Mac, but I'm not able to test this platform. Could someone check if there are some regressions on Mac?

New Features:
* Process cpu clocks
    * Independent process cpu clocks for real, user, system process CPU time
    * Global process cpu clock for real, user, system process CPU time
* Stopwatch concept measuring elapsed time between different points in time associated to the operations start, stop, suspend and resume.
    * stopwatch is a model Stopwatch measuring the elapsed time between the start and the stop operations.
    * stopwatch_accumulator is a model Stopwatch allowing to accumulate several time samples and give the average, ...
    * Scoped helper classes allowing to pairwise start/stop operations, suspend/resume and resume/suspend a Stopwatch.
* Stopwatch Formatter concept
    * stopwatch formatter "%ds\n"
    * stopwatch accumulator formatter "%c times, sum%ss, min%ms, max%Ms, mean%as\n"
    * time formatter "real %rs, cpu %cs (%p%), user %us, system %ss\n"
    * digital_time decomposition class separating days, hours,minutes,seconds, nanoseconds from any duration class (looking for a better name)
    * digital_time formatter "%d days(s) %h:%m:%s.%n\n"
* stopwatch_reporter is a convenient generic class reporting elapsed time for the Stopwatch concept.
* stopclock<Clock> shortcut stopwatch_reporter<stopwatch<Clcok>>
* typeof registration for classes duration and time_point

Depreceated Features:
* The classes process_times, process_clock, process_timer, timer and run_timer are now deprecated as the preceding additions are more generic. However for backward compatibility they are preserved until inclusion of the library in Boost. Next follows the equivalences:
    timer<> ~ stopwatch<>
    process_timer ~ stopwatch<process_cpu_clock>
    run_timer ~ stopclock<>

Bug Fixes
* Try to correct warning C4251: 'boost::chrono::run_timer::m_format' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'boost::chrono::run_timer', by don't including inlines functions using the std::string m_format.

For people that doesn't know it yet, Boost.Chrono library provides:
* The C++0x Standard Library's common_type.
* The C++0x Standard Library's compile-time rational arithmetic.
* The C++0x Standard Library's time utilities, including:
    * Class template duration
    * Class template time_point
    * Clocks:
        * system_clock
        * monotonic_clock
        * high_resolution_clock
    * typeof registration for classes duration and time_point
* Process clocks:
    * process_real_CPU_clocks, capturing real-CPU times.
    * process_user_CPU_clocks, capturing user-CPU times.
    * process_system_CPU_clocks, capturing system-CPU times.
    * process_cpu_clock, tuple-like class capturing at once real, user-CPU, and system-CPU times.
* Stopwatches:
    * stopwatch, capturing elapsed Clock times.
    * stopwatch_accumulator, capturing cummulated elapsed Clock times.
    * scoped helper classes allowing to pairwise start/stop operations, suspend/resume and resume/suspend a Stopwatch.
* Stopclocks or Stopwatch reporters:
    * stopwatch_reporter, convenient reporting of models of Stopwatch results.
    * stopclock<Clock> shortcut of stopwatch_reporter<stopwatch<Clock>>

Best regards,
Vicente Juan Botet Escribá

Boost list run by bdawes at, gregod at, cpdaniel at, john at