15#include "llvm/ADT/SmallVector.h"
49 std::function<void()>
run;
76 llvm::SmallVector<std::unique_ptr<Timer>, 4>
timers;
88 void add(std::unique_ptr<Timer> timer);
TimerGroup(const time::Span &minInterval)
void reset()
Reset all timers.
void add(std::unique_ptr< Timer > timer)
time::Point currentTime
Time of last invoke call.
void invoke()
Invoke registered timers with current time only if minimum interval exceeded.
Timer invocationTimer
Timer that invokes all registered timers after minimum interval.
llvm::SmallVector< std::unique_ptr< Timer >, 4 > timers
Registered timers.
time::Span interval
Approximate interval between callback invocations.
time::Point nextInvocationTime
Wall time for next invocation.
Timer(const time::Span &interval, std::function< void()> &&callback)
std::function< void()> run
The event callback.
void invoke(const time::Point ¤tTime)
Execute callback if invocation time exceeded.
time::Span getInterval() const
Return specified interval between invocations.
void reset(const time::Point ¤tTime)
Set new invocation time to currentTime + interval.
time::Span delta() const
Return the delta since the timer was created.