38 explicit inline Timer (
bool started =
false) : m_startTicks((started) ?
queryTicks() : -1), m_totalTicks(0) {}
43 inline void unstart (
void) { m_startTicks = -1; }
57 inline S64 getElapsedTicks (
void);
60 static F64 s_ticksToSecsCoef;
61 static S64 s_prevTicks;
71 S64 elapsed = getElapsedTicks();
72 m_startTicks += elapsed;
73 m_totalTicks += elapsed;
81 m_startTicks = other.m_startTicks;
82 m_totalTicks = other.m_totalTicks;
91 QueryPerformanceCounter(&ticks);
92 ticks.QuadPart =
max(s_prevTicks, ticks.QuadPart);
93 s_prevTicks = ticks.QuadPart;
94 return ticks.QuadPart;
101 if (s_ticksToSecsCoef == -1.0)
103 return (
F32)((
F64)ticks * s_ticksToSecsCoef);
108 S64 Timer::getElapsedTicks(
void)
111 if (m_startTicks == -1)
113 return curr - m_startTicks;
static void staticInit(void)
Timer(const Timer &other)
static S64 queryTicks(void)
FW_CUDA_FUNC T max(const VectorBase< T, L, S > &v)
static F32 ticksToSecs(S64 ticks)
Timer(bool started=false)
Timer & operator=(const Timer &other)