12#ifndef ROC_CORE_TICKER_H_
13#define ROC_CORE_TICKER_H_
32 : ratio_(double(freq) /
Second)
40 roc_panic(
"ticker: can't start ticker twice");
Base class for non-copyable objects.
void wait(ticks_t ticks)
Wait until the given number of ticks elapses since start. If ticker is not started yet,...
ticks_t elapsed()
Returns number of ticks elapsed since start. If ticker is not started yet, it is started automaticall...
void start()
Start ticker.
uint64_t ticks_t
Number of ticks.
Ticker(ticks_t freq)
Initialize.
nanoseconds_t timestamp(clock_t clock)
Get current timestamp in nanoseconds.
const nanoseconds_t Second
One second represented in nanoseconds.
@ ClockMonotonic
Virtual monotonic clock.
void sleep_until(clock_t clock, nanoseconds_t timestamp)
Sleep until the specified absolute time point has been reached.
int64_t nanoseconds_t
Nanoseconds.
#define roc_panic(...)
Print error message and terminate program gracefully.