|
| | auto_timer_t (std::string title="Timer", time_print_t time_print=simple) |
| | Starts a timer that reports on destruction.
|
|
| auto_timer_t (const auto_timer_t &)=delete |
|
| auto_timer_t (auto_timer_t &&)=delete |
|
auto | operator= (const auto_timer_t &) -> auto_timer_t &=delete |
|
auto | operator= (auto_timer_t &&) -> auto_timer_t &=delete |
|
| ~auto_timer_t () |
| | Writes the measurement to std::cout.
|
| | timer_t (std::string title="Timer", time_print_t time_print=simple) |
| | Starts a timer.
|
| template<std::invocable F> |
| auto | time_it (F &&f, double target_time=1.0) -> std::string |
| | Repeatedly invokes f until target_time has elapsed.
|
| auto | make_time_str () const -> std::string |
| | Formats the time elapsed since construction, divided by the cycle count.
|
| auto | make_time_str (double time) const -> std::string |
| | Formats a duration, choosing a unit that keeps the value readable.
|
| auto | to_string () const -> std::string |
| | Renders the measurement through the configured print callable.
|
| auto | operator/ (std::size_t val) -> timer_t & |
| | Sets the divisor applied to the measured interval.
|
|
| static auto | simple (std::string title, std::string time) -> std::string |
| | Renders a measurement as "title: time".
|
| static auto | big (std::string title, std::string time) -> std::string |
| | Renders a measurement inside a full-width banner.
|
| using | clock_t = std::chrono::steady_clock |
| | The clock used for all measurements.
|
|
using | time_point_t = std::chrono::time_point<clock_t> |
| | A point in time as reported by clock_t.
|
|
using | time_print_t = std::function<std::string(std::string, std::string)> |
| | Renders a finished measurement given a title and a formatted duration.
|
|
std::string | title_ |
| | Label reported alongside the measurement.
|
|
time_print_t | time_print_ |
| | Callable used to render the finished measurement.
|
|
time_point_t | start_ |
| | The instant this timer started measuring.
|
|
std::size_t | cycles_ {1} |
| | Number of cycles the measured interval is divided by.
|
A timer_t that reports to std::cout when it goes out of scope.
Copying or moving one of these would report the same interval more than once, so both are deleted.