Defined in runner.hpp
.
This class exists to collect some values related to reporting in its derived classes. These values are:
Public Types | |
using | nanoseconds = std::chrono::nanoseconds |
Alias for std::chrono::nanoseconds. | |
using | time_point = std::chrono::high_resolution_clock::time_point |
Alias for std::chrono::high_resolution_clock::time_point. | |
Public Member Functions | |
Reporter () | |
Default constructor. | |
Reporter (Reporter &&that) | |
Default move constructor. | |
Reporter (Reporter const &that) | |
Default copy constructor. | |
void | emit_divider () |
Emits the current divider string for reporting. | |
Reporter & | init () |
Initialize an existing Reporter object. | |
time_point | last_report () const noexcept |
Get the time point of the last report. | |
Reporter & | operator= (Reporter &&that) |
Default move assignment operator. | |
Reporter & | operator= (Reporter const &that) |
Default copy assignment operator. | |
bool | report () const |
Check if it is time to report. | |
std::string const & | report_divider () const noexcept |
Get the current divider string for reporting. | |
Reporter & | report_divider (std::string const &val) |
Set the divider string for reporting. | |
nanoseconds | report_every () const noexcept |
Get the minimum elapsed time between reports. | |
Reporter & | report_every (nanoseconds val) noexcept |
Set the minimum elapsed time between reports in nanoseconds. | |
template<typename Time> | |
Reporter & | report_every (Time t) noexcept |
Set the minimum elapsed time between reports in a unit of time other than nanoseconds. | |
std::string const & | report_prefix () const noexcept |
Get the current prefix string for reporting. | |
Reporter & | report_prefix (std::string const &val) |
Set the prefix string for reporting. | |
Reporter const & | reset_last_report () const |
Set the last report time point to now. | |
Reporter const & | reset_start_time () const |
Reset the start time (and last report) to now. | |
time_point | start_time () const noexcept |
Get the start time. | |
Related Symbols | |
(Note that these are not member symbols.) | |
static std::chrono::nanoseconds | delta (std::chrono::high_resolution_clock::time_point const &t) |
The time between a given point and now. | |
Reporter | ( | ) |
Default construct a Reporter object such that the following hold:
|
inline |
This function emits the current divider string for reporting (set via report_divider(std::string const&), and retrieved via report_divider()).
Reporter & init | ( | ) |
This function puts a Reporter object back into the same state as if it had been newly default constructed.
*this
.
|
inlinenodiscardnoexcept |
Returns the time point of the last report, as set by one of:
noexcept
and is guaranteed never to throw.
|
nodiscard |
This function can be used to check if enough time has passed that we should report again. That is if the time between last_report() and now is greater than the value of report_every().
If true
is returned, then last_report() is set to now.
bool
.
|
inlinenodiscardnoexcept |
This function gets the current value of the divider string for reporting (set via report_divider(std::string const&)).
noexcept
and is guaranteed never to throw.
|
inline |
This function sets the return value of report_divider() to (a copy of) the argument val
.
val | the new value of the report divider. |
this
.
|
inlinenodiscardnoexcept |
noexcept
and is guaranteed never to throw.
|
inlinenoexcept |
This function can be used to specify at run time the minimum elapsed time between two calls to report() that will return true
. If report() returns true
at time s
, then report() will only return true
again after at least time s
+ t
has elapsed.
val | the amount of time (in nanoseconds) between reports. |
this
.noexcept
and is guaranteed never to throw.
|
inlinenoexcept |
This function converts its argument to std::chrono::nanoseconds and calls report_every(std::chrono::nanoseconds).
Time | the type of the argument (should be std::chrono::something). |
t | the amount of time (in Time ) between reports. |
this
.noexcept
and is guaranteed never to throw.
|
inlinenodiscardnoexcept |
This function gets the current value of the prefix string for reporting (set via report_prefix(std::string const&)), which is typically the name of the algorithm being run at the outmost level.
noexcept
and is guaranteed never to throw.
|
inline |
This function sets the return value of report_prefix() to (a copy of) the argument val
. Typically this prefix should be the name of the algorithm being run at the outmost level.
val | the new value of the report prefix. |
this
.
|
inline |
Returns the time point of the last report, as set by one of:
this
.
|
inline |
this
.
|
inlinenodiscardnoexcept |
This is the time point at which reset_start_time() was last called, which is also the time of construction of a Reporter instance if reset_start_time() is not explicitly called.
noexcept
and is guaranteed never to throw.
|
The time between a given point and now.
t | the time point. |
t
and now.