A simple RAII-based timer for benchmarking. More...
#include <yoda.hpp>
Public Types | |
| enum class | Unit { Seconds , Milliseconds , Microseconds } |
| Timer resolution units. More... | |
Public Member Functions | |
| ScopedTimer (std::string label, Unit unit=Unit::Milliseconds) | |
| Start the timer with a label. | |
| ~ScopedTimer () | |
| Stop the timer and print elapsed time. | |
| const std::string & | label () const |
| Get the label for this timer. | |
A simple RAII-based timer for benchmarking.
Demonstrates nested types, constructors/destructors, and the @test directive.
|
strong |
|
explicit |
Start the timer with a label.
| label | A human-readable name for this timing region. |
| unit | The resolution to report (default: milliseconds). |
References label(), and Milliseconds.
| yoda::ScopedTimer::~ScopedTimer | ( | ) |
Stop the timer and print elapsed time.
stdout.
|
inlinenodiscard |
Get the label for this timer.
Definition at line 268 of file yoda.hpp.
Referenced by ScopedTimer().