10#ifndef STK_TIME_UTIL_H_
11#define STK_TIME_UTIL_H_
112 bool triggered =
false;
177 template <
typename Func>
194 template <
typename Func>
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
#define STK_UNLIKELY(x)
Provides a compiler hint that the given expression is highly unlikely to evaluate to true (typically ...
Namespace of STK package.
int64_t Ticks
Ticks value.
static Ticks GetTicks()
Get number of ticks elapsed since kernel start.
uint64_t Cycles
Cycles value.
Ticks m_next
Next trigger time in ticks.
uint32_t GetPeriod() const
Get currently configured trigger period.
void Restart()
Reset the trigger and start.
void SetPeriod(uint32_t period)
Change the trigger period while preserving phase.
uint32_t m_period
Trigger period in ticks. Modified only by SetPeriod(). Must be > 0.
bool Poll()
Check whether the scheduled trigger time has been reached.
PeriodicTrigger(uint32_t period, bool start=false)
Construct a PeriodicTrigger.
void Start(Func now_func)
Capture the start time.
Cycles m_prev
Counter value captured at the last Start() or Update() call.
static constexpr Cycles NOT_STARTED
Value of m_prev meaning that stopwatch is not started.
Cycles Update(Func now_func)
Return the number of cycles elapsed since the last Start() or Update().
Stopwatch()
Construct a Stopwatch.