mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Calculate timer resolution.
This commit is contained in:
parent
445d2831ed
commit
6a2cb2c14e
@ -358,6 +358,17 @@ void Profiler::CalibrateDelay()
|
||||
const auto df = t0 - f0;
|
||||
m_delay = ( dt - df ) / Events;
|
||||
|
||||
uint64_t mindiff = std::numeric_limits<uint64_t>::max();
|
||||
for( int i=0; i<Iterations * 10; i++ )
|
||||
{
|
||||
const auto t0 = GetTime();
|
||||
const auto t1 = GetTime();
|
||||
const auto dt = t1 - t0;
|
||||
if( dt > 0 && dt < mindiff ) mindiff = dt;
|
||||
}
|
||||
|
||||
m_resolution = mindiff;
|
||||
|
||||
enum { Bulk = 1000 };
|
||||
moodycamel::ConsumerToken token( s_queue );
|
||||
int left = Events * 2;
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
void CalibrateDelay();
|
||||
|
||||
double m_timerMul;
|
||||
uint64_t m_resolution;
|
||||
uint64_t m_delay;
|
||||
int64_t m_timeBegin;
|
||||
uint64_t m_mainThread;
|
||||
|
Loading…
Reference in New Issue
Block a user