- lib:
boost/libs/timer
- repo:
boostorg/timer
- commit:
da677f67
, 2015-10-27
<boost/timer.hpp>
<boost/progress.hpp>
timer()
restart()
- resetelapsed
valueelapsed() const -> double
elapsed_max() const -> double
,elapsed_min() const -> double
class progress_timer : public timer, noncopyable;
progress_timer(std::ostream& = std::cout)
~progress_timer()
- print "$elapsed s" on output stream.
class progress_display : noncopyable; // not a timer, just a progress ruler
explicit progress_display(unsigned long expected_count, os=std::cout, s1="\n", s2="", s3="")
restart(expected_count)
- display 3-line progress percentage ruler on ostream.+=
,++
- add progress ruler on demand.count() const -> unsigned long
expected_count() const -> unsigned long
Superseded by Boost.Chrono/Stopwatches
<boost/timer/timer.hpp>
struct cpu_times {
nanosecond_type wall, user, system;
void clear() { wall = user = system = 0LL; }
};
std::string format(const cpu_times& times, short places, const std::string& format);
std::string format(const cpu_times& times, short places = default_places);
w
- wall time.u
- user time.s
- system time.t
- total time.p
- percentage.- default format:
" %ws wall, %us user + %ss system = %ts CPU (%p%)\n"
. - default decimal places: 6.
cpu_timer() noexcept
is_stopped() const noexcept
elapsed() const noexcept -> cpu_times
format(...) const -> std::string
start() noexcept
stop() noexcept
resume() noexcept
class auto_cpu_timer : public cpu_timer;
auto_cpu_timer([std::ostream &], [short places], [const std::string& format])
~auto_cpu_timer()
- print result on output stream.ostream() const -> std::ostream&
places() const -> short
format_string() const -> const std::string&
report()
- Write current elapsed string to output stream
- On Windows, use
GetProcessTimes()
- On POSIX, use
times()
<boost/config.hpp>
<boost/config/auto_link.hpp>
- For timer library linkage.<boost/cstdint.hpp>
<boost/config/warning_disable.hpp>
<boost/config/abi_prefix.hpp>
,<boost/config/abi_suffix.hpp>
<boost/system/api_config.hpp>
- Detect POSIX/Windows.<boost/cerrno.hpp>
.
<boost/chrono/chrono.hpp>
<boost/io/ios_state.hpp>
- IOS state saver
<boost/throw_exception.hpp>