|
iceberg-cpp
|
Thread-safe timer backed by std::atomic<int64_t>. More...
#include <timer.h>
Public Member Functions | |
| DefaultTimer (TimerUnit unit=TimerUnit::kNanoseconds) | |
| int64_t | Count () const override |
| Number of timing recordings made so far. | |
| std::chrono::nanoseconds | TotalDuration () const override |
| Total accumulated duration across all recordings. | |
| void | Record (std::chrono::nanoseconds duration) override |
| Record a nanosecond duration directly. | |
| std::string_view | Unit () const override |
| Return the time unit used by this timer. | |
Public Member Functions inherited from iceberg::Timer | |
| template<typename Rep , typename Period > | |
| void | Record (std::chrono::duration< Rep, Period > duration) |
| Record a duration of any chrono type, converting to nanoseconds. | |
| virtual bool | IsNoop () const |
| Return true if this timer is a no-op. | |
| Timed | Start () |
| Start timing and return a RAII Timed guard. | |
| template<typename Callable > | |
| decltype(auto) | Time (Callable &&fn) |
| Execute a callable, record its wall-clock duration, and return its result. | |
Additional Inherited Members | |
Static Public Member Functions inherited from iceberg::Timer | |
| static std::shared_ptr< Timer > | Noop () |
| Return a shared no-op timer singleton. | |
Thread-safe timer backed by std::atomic<int64_t>.
|
overridevirtual |
Number of timing recordings made so far.
Implements iceberg::Timer.
|
overridevirtual |
Record a nanosecond duration directly.
Use the template overload below to record any std::chrono duration type with automatic unit conversion.
Implements iceberg::Timer.
|
overridevirtual |
Total accumulated duration across all recordings.
Implements iceberg::Timer.
|
inlineoverridevirtual |
Return the time unit used by this timer.
Reimplemented from iceberg::Timer.