Low level timer manager. More...
Classes | |
struct | Scaler_t |
Static Public Member Functions | |
static Tick * | get_instance (void) noexcept |
Get the global instance of the timer system. | |
static void | init (void) noexcept |
Initialize the low level timer manager. | |
static void | shutdown (void) noexcept |
Shut down the low level timer manager. | |
static uint64_t | get_high_precision_frequency (void) noexcept |
Get the frequency of the high precision timer. | |
static uint_t | is_initialized (void) noexcept |
Check if the timer manager is initialized. | |
static uint64_t | read_high_precision (void) noexcept |
Return the tick at the system's highest precision. | |
static uint32_t | read (void) noexcept |
Retrieve the 60 hertz timer system time. | |
static uint32_t | read_ms (void) noexcept |
Retrieve the 1Khz timer. | |
static uint32_t | read_us (void) noexcept |
Retrieve the 1Mhz timer. | |
static uint32_t | read_and_mark (void) noexcept |
Sync the 60 hertz timer. | |
static uint32_t | get_mark (void) noexcept |
Get the 60 hertz timer sync value. | |
static void | wait_one_tick (void) noexcept |
Sleep for a maximum of 1/60th of a second. | |
static void | wait (uint_t uCount=1) noexcept |
Wait for a number of system ticks. | |
static uint_t | wait_event (uint_t uCount=0) noexcept |
Sleep until a timeout or until a user input event. | |
Public Attributes | |
uint64_t | m_uHighPrecisionFrequency |
High precision timer resolution in units per second. | |
uint32_t | m_uLast60HertzMark |
Previously set 60 hertz tick value. | |
uint_t | m_bInitialized |
TRUE if initialized | |
Static Public Attributes | |
static const uint32_t | kTicksPerSecond = 60U |
Number of ticks per second. | |
Static Protected Member Functions | |
static uint64_t | get_high_precision_rate (void) noexcept |
Return the ticks per second at the system's highest precision. | |
Static Protected Attributes | |
static Tick | g_Tick |
Global instance of all data for timers. | |
Low level timer manager.
Upon this class being started up, a global 60 hertz timer is created and via a background interrupt, it will increment 60 times a second. This is global and shared by all threads. The timer cannot stop.
The value can be zero for 1/60th of a second, so do not assume that a zero is an uninitialized state.
In addition to starting up this timer, higher precision timers are initialized so ticks accurate to milliseconds, microseconds and system precision.
|
inlinestaticnoexcept |
Get the frequency of the high precision timer.
This value is in units per second. Divide the output of read_high_precision() by this number to determine the time in seconds.
|
staticprotectednoexcept |
Return the ticks per second at the system's highest precision.
This platform specific code will ask the operating system what is the highest precision timer tick rate and then will return that value.
This value is cached and is available from get_high_precision_frequency()
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
Get the 60 hertz timer sync value.
When wait(), wait_event() and read_and_mark() are called, an internal sync value is updated. This function returns that value.
|
staticnoexcept |
|
inlinestaticnoexcept |
|
staticnoexcept |
Retrieve the 60 hertz timer system time.
When init() is called, a 60 hertz timer is created and via a background interrupt or other means, will increment 60 times a second.
The value can be zero for 1/60th of a second, so do not assume that a zero is an uninitialized state.
|
staticnoexcept |
Sync the 60 hertz timer.
Read the current tick value and set the internal tick value it. Functions like wait() and wait_event() use this value to begin a time delay.
|
staticnoexcept |
Return the tick at the system's highest precision.
The value returns a tick that will increment at get_high_precision_frequency() ticks per second.
|
staticnoexcept |
Retrieve the 1Khz timer.
Upon application start up, a 1Khz hertz timer is created and via a hardware timer, it will increment 1Mhz times a second.
The value can be zero for 1/1,000th of a second, so do not assume that a zero is an uninitialized state.
|
staticnoexcept |
Retrieve the 1Mhz timer.
Upon application start up, a 1Mhz hertz timer is created and via a hardward timer, it will increment 1Mhz times a second.
The value can be zero for 1/1,000,000th of a second, so do not assume that a zero is an uninitialized state.
|
staticnoexcept |
|
staticnoexcept |
Wait for a number of system ticks.
Sleep the application for approximately the number of units in 1/60ths of a second. The delay is a maximum.
uCount | Number of 1/60ths of a second to sleep. |
|
staticnoexcept |
Sleep until a timeout or until a user input event.
uCount | Number of 1/60ths of a second to sleep for a timeout. Zero is no timeout. |
|
staticnoexcept |
Sleep for a maximum of 1/60th of a second.
Sync to the current tick mark and sleep the application until the next time the timer increments.
|
staticprotected |
Global instance of all data for timers.
uint64_t Burger::Tick::m_uHighPrecisionFrequency |
High precision timer resolution in units per second.
uint32_t Burger::Tick::m_uLast60HertzMark |
Previously set 60 hertz tick value.