17#include <condition_variable>
43 static std::condition_variable
cv;
113 std::condition_variable cv_;
116 unsigned int timerID_;
122 std::atomic<uint64_t> tickCount_;
125 std::atomic<uint64_t> cycleCount_;
128 std::atomic<uint64_t> prevTickCount_;
131 std::atomic<uint64_t> cycleMissedTickCount_;
167 static void CALLBACK TimerCallback(
unsigned int uID,
unsigned int uMsg,
168 DWORD_PTR dwUser, DWORD_PTR dw1,
182 static void timer_handler(
int sig);
Cross-platform high-resolution periodic timer.
Definition: main_timer.h:32
uint64_t getTickCount() const
Returns the current tick count.
Definition: main_timer.cc:105
uint64_t getCycleMissedTickCount() const
Returns the number of missed timer ticks in the current cycle.
Definition: main_timer.cc:109
int64_t getElapsedTime() const
Returns the total elapsed time since the timer started.
Definition: main_timer.cc:113
static unsigned int DELAY
Static delay in milliseconds between each timer tick.
Definition: main_timer.h:37
uint64_t getCycleCount() const
Returns the number of completed wait cycles.
Definition: main_timer.cc:107
void wait()
Waits for the next timer tick to occur.
Definition: main_timer.cc:88
static std::condition_variable cv
Static condition variable used to notify waiting threads of timer ticks.
Definition: main_timer.h:43
static void notifyAllListeners()
Notifies all listeners (waiting threads) about a timer tick.
Definition: main_timer.cc:12
static MainTimer & getInstance()
Returns the singleton instance of the MainTimer.
Definition: main_timer.cc:7